|
|
@@ -1,9 +1,12 @@
|
|
|
package com.jeesite.modules.mes.web;
|
|
|
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
+import com.jeesite.modules.mes.entity.MesLineProcess;
|
|
|
import com.jeesite.modules.mes.req.MesSearchDateReq;
|
|
|
import com.jeesite.modules.mes.util.CommonUitl;
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
@@ -20,11 +23,14 @@ 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.lang.StringUtils;
|
|
|
import com.jeesite.common.utils.excel.ExcelExport;
|
|
|
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
|
|
+import org.springframework.util.ObjectUtils;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
import com.jeesite.common.web.BaseController;
|
|
|
import com.jeesite.modules.mes.entity.MesProductModifyRecord;
|
|
|
+import com.jeesite.modules.mes.service.MesLineProcessService;
|
|
|
import com.jeesite.modules.mes.service.MesProductModifyRecordService;
|
|
|
|
|
|
/**
|
|
|
@@ -38,6 +44,9 @@ public class MesProductModifyRecordController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private MesProductModifyRecordService mesProductModifyRecordService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MesLineProcessService mesLineProcessService;
|
|
|
|
|
|
/**
|
|
|
* 获取数据
|
|
|
@@ -69,9 +78,45 @@ public class MesProductModifyRecordController extends BaseController {
|
|
|
public Page<MesProductModifyRecord> listData(MesProductModifyRecord mesProductModifyRecord, HttpServletRequest request, HttpServletResponse response) {
|
|
|
mesProductModifyRecord.setPage(new Page<>(request, response));
|
|
|
Page<MesProductModifyRecord> page = mesProductModifyRecordService.findPage(mesProductModifyRecord);
|
|
|
+ fillOprnoTitle(page.getList());
|
|
|
return page;
|
|
|
}
|
|
|
|
|
|
+ private void fillOprnoTitle(List<MesProductModifyRecord> list) {
|
|
|
+ if (ListUtils.isEmpty(list)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Map<String, String> oprnoTitleMap = new HashMap<>();
|
|
|
+ for (MesProductModifyRecord record : list) {
|
|
|
+ if (StringUtils.isBlank(record.getLineSn()) || StringUtils.isBlank(record.getOprno())) {
|
|
|
+ record.setOprnoTitle("");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ String key = record.getLineSn() + "|" + record.getOprno();
|
|
|
+ if (!oprnoTitleMap.containsKey(key)) {
|
|
|
+ oprnoTitleMap.put(key, findOprnoTitle(record.getLineSn(), record.getOprno()));
|
|
|
+ }
|
|
|
+ record.setOprnoTitle(oprnoTitleMap.get(key));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private String findOprnoTitle(String lineSn, String oprno) {
|
|
|
+ MesLineProcess mesLineProcess = new MesLineProcess();
|
|
|
+ mesLineProcess.setLineSn(lineSn);
|
|
|
+ mesLineProcess.setOprno(oprno);
|
|
|
+ MesLineProcess mesLineProcess1 = mesLineProcessService.findInfo(mesLineProcess);
|
|
|
+ if (!ObjectUtils.isEmpty(mesLineProcess1)) {
|
|
|
+ return mesLineProcess1.getTitle();
|
|
|
+ }
|
|
|
+ String formattedOprno = CommonUitl.formatOprno(oprno);
|
|
|
+ if (StringUtils.equals(oprno, formattedOprno)) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ mesLineProcess.setOprno(formattedOprno);
|
|
|
+ mesLineProcess1 = mesLineProcessService.findInfo(mesLineProcess);
|
|
|
+ return ObjectUtils.isEmpty(mesLineProcess1) ? "" : mesLineProcess1.getTitle();
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 查看编辑表单
|
|
|
*/
|
|
|
@@ -100,6 +145,7 @@ public class MesProductModifyRecordController extends BaseController {
|
|
|
@RequestMapping(value = "exportData")
|
|
|
public void exportData(MesProductModifyRecord mesProductModifyRecord, HttpServletResponse response) {
|
|
|
List<MesProductModifyRecord> list = mesProductModifyRecordService.findList(mesProductModifyRecord);
|
|
|
+ fillOprnoTitle(list);
|
|
|
String fileName = "产品修改记录" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
|
|
try(ExcelExport ee = new ExcelExport("产品修改记录", MesProductModifyRecord.class)){
|
|
|
ee.setDataList(list).write(response, fileName);
|
|
|
@@ -146,4 +192,4 @@ public class MesProductModifyRecordController extends BaseController {
|
|
|
return renderResult(Global.TRUE, text("删除产品修改记录成功!"));
|
|
|
}
|
|
|
|
|
|
-}
|
|
|
+}
|