|
|
@@ -1,16 +1,19 @@
|
|
|
package com.jeesite.modules.mes.web;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
-
|
|
|
+import com.jeesite.common.collect.ListUtils;
|
|
|
import com.jeesite.common.collect.MapUtils;
|
|
|
-import com.jeesite.common.mybatis.mapper.query.QueryType;
|
|
|
+import com.jeesite.common.config.Global;
|
|
|
+import com.jeesite.common.entity.Page;
|
|
|
+import com.jeesite.common.lang.DateUtils;
|
|
|
+import com.jeesite.common.utils.excel.ExcelExport;
|
|
|
+import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
|
|
+import com.jeesite.common.web.BaseController;
|
|
|
import com.jeesite.modules.file.entity.FileUpload;
|
|
|
import com.jeesite.modules.file.service.FileUploadService;
|
|
|
import com.jeesite.modules.file.utils.FileUploadUtils;
|
|
|
+import com.jeesite.modules.mes.entity.MesProductGp12;
|
|
|
import com.jeesite.modules.mes.resp.CommonResp;
|
|
|
+import com.jeesite.modules.mes.service.MesProductGp12Service;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -21,17 +24,12 @@ 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.collect.ListUtils;
|
|
|
-import com.jeesite.common.entity.Page;
|
|
|
-import com.jeesite.common.lang.DateUtils;
|
|
|
-import com.jeesite.common.utils.excel.ExcelExport;
|
|
|
-import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
-import com.jeesite.common.web.BaseController;
|
|
|
-import com.jeesite.modules.mes.entity.MesProductGp12;
|
|
|
-import com.jeesite.modules.mes.service.MesProductGp12Service;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* 工件拍照记录Controller
|
|
|
@@ -182,19 +180,34 @@ public class MesProductGp12Controller extends BaseController {
|
|
|
if (StringUtils.isBlank(lineSn))
|
|
|
return renderResult(Global.FALSE, "缺少必要参数");
|
|
|
|
|
|
- // 根据工件码查询是否已存在该数据
|
|
|
+ String result = mesProductGp12.getResult();
|
|
|
+ if (StringUtils.isBlank(result))
|
|
|
+ return renderResult(Global.FALSE, "缺少必要参数");
|
|
|
+
|
|
|
+ /* // 根据工件码查询是否已存在该数据
|
|
|
mesProductGp12.getSqlMap().getWhere().and("a.sn", QueryType.EQ, sn);
|
|
|
List<MesProductGp12> list = mesProductGp12Service.findList(mesProductGp12);
|
|
|
- if (list.size() > 0){return renderResult(Global.FALSE, "该记录已存在");}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ if (list.size() == 1){
|
|
|
+ MesProductGp12 entry = list.get(0);
|
|
|
+ entry.setSn(mesProductGp12.getSn());
|
|
|
+ entry.setLineSn(mesProductGp12.getLineSn());
|
|
|
+ entry.setOprno(mesProductGp12.getOprno());
|
|
|
+ entry.setRemark(mesProductGp12.getRemark());
|
|
|
+ entry.setResult(result);
|
|
|
+ mesProductGp12Service.save(entry);
|
|
|
+ FileUploadUtils.saveFileUpload(entry, entry.getId(), "mesProductGp12_image");
|
|
|
+ return renderResult(Global.TRUE, "操作成功");
|
|
|
+ }
|
|
|
+ if (list.size() > 1){
|
|
|
+ return renderResult(Global.FALSE, "该记录存在多条");
|
|
|
+ }*/
|
|
|
// 向数据库添加数据
|
|
|
MesProductGp12 entry = new MesProductGp12();
|
|
|
entry.setSn(mesProductGp12.getSn());
|
|
|
entry.setLineSn(mesProductGp12.getLineSn());
|
|
|
entry.setOprno(mesProductGp12.getOprno());
|
|
|
entry.setRemark(mesProductGp12.getRemark());
|
|
|
+ entry.setResult(result);
|
|
|
mesProductGp12Service.save(entry);
|
|
|
|
|
|
FileUploadUtils.saveFileUpload(entry, entry.getId(), "mesProductGp12_image");
|
|
|
@@ -285,7 +298,6 @@ public class MesProductGp12Controller extends BaseController {
|
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 删除数据
|
|
|
*/
|
|
|
@@ -297,4 +309,4 @@ public class MesProductGp12Controller extends BaseController {
|
|
|
return renderResult(Global.TRUE, text("删除工件拍照记录成功!"));
|
|
|
}
|
|
|
|
|
|
-}
|
|
|
+}
|