|
@@ -0,0 +1,155 @@
|
|
|
|
|
+package com.jeesite.modules.mes.web;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
+
|
|
|
|
|
+import com.jeesite.common.lang.StringUtils;
|
|
|
|
|
+import com.jeesite.modules.mes.resp.CommonResp;
|
|
|
|
|
+import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.stereotype.Controller;
|
|
|
|
|
+import org.springframework.ui.Model;
|
|
|
|
|
+import org.springframework.util.ObjectUtils;
|
|
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
|
|
+import org.springframework.web.bind.annotation.ModelAttribute;
|
|
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
+
|
|
|
|
|
+import com.jeesite.common.config.Global;
|
|
|
|
|
+import com.jeesite.common.entity.Page;
|
|
|
|
|
+import com.jeesite.common.web.BaseController;
|
|
|
|
|
+import com.jeesite.modules.mes.entity.MesProductProgress;
|
|
|
|
|
+import com.jeesite.modules.mes.entity.MesMaterialKw;
|
|
|
|
|
+import com.jeesite.modules.mes.service.MesProductProgressService;
|
|
|
|
|
+import com.jeesite.modules.mes.service.MesMaterialKwService;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * 半成品仓库表Controller
|
|
|
|
|
+ * @author jingbo
|
|
|
|
|
+ * @version 2026-05-27
|
|
|
|
|
+ */
|
|
|
|
|
+@Controller
|
|
|
|
|
+@RequestMapping(value = "${adminPath}/mes/mesProductProgress")
|
|
|
|
|
+public class MesProductProgressController extends BaseController {
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private MesProductProgressService mesProductProgressService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private MesMaterialKwService mesMaterialKwService;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取数据
|
|
|
|
|
+ */
|
|
|
|
|
+ @ModelAttribute
|
|
|
|
|
+ public MesProductProgress get(String id, boolean isNewRecord) {
|
|
|
|
|
+ return mesProductProgressService.get(id, isNewRecord);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 查询列表
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequiresPermissions("mes:mesProductProgress:view")
|
|
|
|
|
+ @RequestMapping(value = {"list", ""})
|
|
|
|
|
+ public String list(MesProductProgress mesProductProgress, Model model) {
|
|
|
|
|
+ model.addAttribute("mesProductProgress", mesProductProgress);
|
|
|
|
|
+ model.addAttribute("kwList", mesMaterialKwService.findList(new MesMaterialKw()));
|
|
|
|
|
+ return "modules/mes/mesProductProgressList";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 查询列表数据
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequiresPermissions("mes:mesProductProgress:view")
|
|
|
|
|
+ @RequestMapping(value = "listData")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ public Page<MesProductProgress> listData(MesProductProgress mesProductProgress, HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
|
+ mesProductProgress.setPage(new Page<>(request, response));
|
|
|
|
|
+ Page<MesProductProgress> page = mesProductProgressService.findPage(mesProductProgress);
|
|
|
|
|
+ return page;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 查看编辑表单
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequiresPermissions("mes:mesProductProgress:view")
|
|
|
|
|
+ @RequestMapping(value = "form")
|
|
|
|
|
+ public String form(MesProductProgress mesProductProgress, Model model) {
|
|
|
|
|
+ model.addAttribute("mesProductProgress", mesProductProgress);
|
|
|
|
|
+ model.addAttribute("kwList", mesMaterialKwService.findList(new MesMaterialKw()));
|
|
|
|
|
+ return "modules/mes/mesProductProgressForm";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 保存数据
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequiresPermissions("mes:mesProductProgress:edit")
|
|
|
|
|
+ @PostMapping(value = "save")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ public String save(@Validated MesProductProgress mesProductProgress) {
|
|
|
|
|
+ mesProductProgressService.save(mesProductProgress);
|
|
|
|
|
+ return renderResult(Global.TRUE, text("保存半成品仓库表成功!"));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 删除数据
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequiresPermissions("mes:mesProductProgress:edit")
|
|
|
|
|
+ @RequestMapping(value = "delete")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ public String delete(MesProductProgress mesProductProgress) {
|
|
|
|
|
+ mesProductProgressService.delete(mesProductProgress);
|
|
|
|
|
+ return renderResult(Global.TRUE, text("删除半成品仓库表成功!"));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * pda扫码入库
|
|
|
|
|
+ *
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping(value = "pdaIn")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ public CommonResp pdaIn(HttpServletRequest request) {
|
|
|
|
|
+ CommonResp resp = new CommonResp<>();
|
|
|
|
|
+ //获取参数
|
|
|
|
|
+ String kwId = request.getParameter("kwId");
|
|
|
|
|
+ String sn = request.getParameter("sn");
|
|
|
|
|
+ String lineSn = request.getParameter("lineSn");
|
|
|
|
|
+ if (StringUtils.isEmpty(lineSn) || StringUtils.isEmpty(sn) || StringUtils.isEmpty(kwId)){
|
|
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
|
|
+ resp.setMessage("参数错误");
|
|
|
|
|
+ return resp;
|
|
|
|
|
+ }
|
|
|
|
|
+ MesProductProgress mesProductProgress = new MesProductProgress();
|
|
|
|
|
+ mesProductProgress.setKwId(kwId);
|
|
|
|
|
+ mesProductProgress.setSn(sn);
|
|
|
|
|
+ mesProductProgress.setLineSn(lineSn);
|
|
|
|
|
+ // 查询是否存在
|
|
|
|
|
+ MesProductProgress mesProductProgress1 = mesProductProgressService.getBySnAndLineSn(mesProductProgress);
|
|
|
|
|
+ if (!ObjectUtils.isEmpty(mesProductProgress1)){
|
|
|
|
|
+ if ("0".equals(mesProductProgress1.getState())){
|
|
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
|
|
+ resp.setMessage("该工件已入库");
|
|
|
|
|
+ return resp;
|
|
|
|
|
+ }
|
|
|
|
|
+ if ("1".equals(mesProductProgress1.getState())){
|
|
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
|
|
+ resp.setMessage("该工件已出库");
|
|
|
|
|
+ return resp;
|
|
|
|
|
+ }
|
|
|
|
|
+ }else {
|
|
|
|
|
+ mesProductProgress.setState("0");
|
|
|
|
|
+ mesProductProgressService.save(mesProductProgress);
|
|
|
|
|
+ resp.setResult(Global.TRUE);
|
|
|
|
|
+ resp.setMessage("入库成功");
|
|
|
|
|
+ return resp;
|
|
|
|
|
+ }
|
|
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
|
|
+ resp.setMessage("入库失败");
|
|
|
|
|
+ return resp;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+}
|