2025-1-8 MES-完产清线点检

master
元气满满(jgy) 2 months ago
parent 501ca0b094
commit bb68edc6bb

@ -2,9 +2,6 @@ package com.op.mes.controller;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.log.annotation.Log;
import com.op.common.log.enums.BusinessType;
import com.op.common.security.annotation.RequiresPermissions;
import com.op.mes.domain.MesInspectionReport;
import com.op.mes.domain.ProOrderWorkorder;
import com.op.mes.service.IMesInspectionReportService;
@ -26,18 +23,24 @@ public class MesInspectionReportController extends BaseController {
return iMesInspectionReportService.selectSelfMutualInspectionList(mesInspectionReport);
}
//自检互检记录报表 产品名称 检查人 生产产线 检查日期 异常处理 备注
//查询表头表尾内容
@GetMapping("/selfMutualInspectionData")
public MesInspectionReport selfMutualInspectionData(MesInspectionReport mesInspectionReport) {
return iMesInspectionReportService.selfMutualInspectionData(mesInspectionReport);
}
//修改表头表位内容
//修改整个表
@PutMapping("/updateTable")
public AjaxResult updateTable(@RequestBody MesInspectionReport mesInspectionReport) {
return iMesInspectionReportService.updateTable(mesInspectionReport);
}
//修改点检表
@PutMapping("/updatePointInspectionTable")
public AjaxResult updatePointInspectionTable(@RequestBody MesInspectionReport mesInspectionReport) {
return iMesInspectionReportService.updatePointInspectionTable(mesInspectionReport);
}
//查询产线
@GetMapping("/getLineCodeList")
public List<MesInspectionReport> getLineCodeList() {
@ -59,13 +62,13 @@ public class MesInspectionReportController extends BaseController {
return list;
}
//首检记录 左侧报表 主体 查询
//这个不用了
@GetMapping("/listFirstInspectionLeft")
public List<MesInspectionReport> firstInspectionLeftList(MesInspectionReport mesInspectionReport) {
return iMesInspectionReportService.selectFirstInspectionLeftList(mesInspectionReport);
}
//首检记录 右侧报表 主体 查询
//这个也不用了
@GetMapping("/listFirstInspectionRight")
public List<MesInspectionReport> firstInspectionRightList(MesInspectionReport mesInspectionReport) {
return iMesInspectionReportService.selectFirstInspectionRightList(mesInspectionReport);
@ -76,10 +79,4 @@ public class MesInspectionReportController extends BaseController {
public List<MesInspectionReport> listPointInspection(MesInspectionReport mesInspectionReport) {
return iMesInspectionReportService.selectPointInspectionList(mesInspectionReport);
}
//点检记录
@GetMapping("/listCheckBox")
public List<MesInspectionReport> listCheckBox(MesInspectionReport mesInspectionReport) {
return iMesInspectionReportService.selectCheckBoxList(mesInspectionReport);
}
}

@ -268,4 +268,21 @@ public class MesInspectionReport extends BaseEntity {
public String getFactoryCode() {
return factoryCode;
}
private Boolean whetherOpenLine;//是开线还是清换线 开线是1 清换线是0
public void setWhetherOpenLine(Boolean whetherOpenLine) {
this.whetherOpenLine = whetherOpenLine;
}
public Boolean getWhetherOpenLine() {
return whetherOpenLine;
}
//点检
private ArrayList<LinkedHashMap<String, Object>> pointTableData;
public ArrayList<LinkedHashMap<String, Object>> getPointTableData() {
return pointTableData;
}
public void setPointTableData(ArrayList<LinkedHashMap<String, Object>> pointTableData) {
this.pointTableData = pointTableData;
}
}

@ -15,8 +15,6 @@ public interface MesInspectionReportMapper {
List<MesInspectionReport> selectPointInspectionProjectList(String param);//点检项目
List<String> selectTeamArray(MesInspectionReport mesInspectionReport);//班组
List<MesInspectionReport> selectCheckBoxList(MesInspectionReport mesInspectionReport);
List<MesInspectionReport> getProductList(MesInspectionReport mesInspectionReport);//查询产品列表
List<ProOrderWorkorder> getDataCodeList(MesInspectionReport data);

@ -19,11 +19,11 @@ public interface IMesInspectionReportService {
List<MesInspectionReport> selectPointInspectionList(MesInspectionReport mesInspectionReport);//产品转换/完产清线点检表
List<MesInspectionReport> selectCheckBoxList(MesInspectionReport mesInspectionReport);//点检上方备选框
List<MesInspectionReport> getProductList(MesInspectionReport mesInspectionReport);//查询产线
AjaxResult updateTable(MesInspectionReport mesInspectionReport);//修改表头 表尾部 表主体
List<ProOrderWorkorder> getWorkList(MesInspectionReport mesInspectionReport);
AjaxResult updatePointInspectionTable(MesInspectionReport mesInspectionReport);
}

@ -245,15 +245,6 @@ public class MesInspectionReportServiceImpl implements IMesInspectionReportServi
@Override
@DS("#header.poolName")
public List selectFirstInspectionLeftList(MesInspectionReport mesInspectionReport) {
//0.时间处理
// if(mesInspectionReport.getCheckDate() != null){
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");//设置格式
// Calendar calendar = Calendar.getInstance();
// calendar.add(Integer.valueOf(mesInspectionReport.getCheckDate()), -1); //当前时间减去一天,即一天前的时间
// String checkDate = simpleDateFormat.format(calendar.getTime());
// mesInspectionReport.setCheckDate(checkDate);
// }
// 1.报表名
mesInspectionReport.setReportName("ConversionReportLeft");
List<MesInspectionReport> list = mesInspectionReportMapper.selectSelfMutualInspectionList(mesInspectionReport);
@ -381,19 +372,42 @@ public class MesInspectionReportServiceImpl implements IMesInspectionReportServi
List<String> teamArray = mesInspectionReportMapper.selectTeamArray(mesInspectionReport);
List<Object> listDTO = new ArrayList<>();
MesInspectionReport buildDTO = new MesInspectionReport();
buildDTO.setId("");
buildDTO.setRemark("");
buildDTO.setCheckResult("");
buildDTO.setBelongTo(mesInspectionReport.getId());
buildDTO.setWhetherOpenLine(null);
for(MesInspectionReport project : projectList){
Map<String,String> dynamicRow = new LinkedHashMap<>();
dynamicRow.put("序号",project.getTableLine() + "");
dynamicRow.put("点检项目",project.getProjectName());
dynamicRow.put("点检内容",project.getInfoName());
Map<String,MesInspectionReport> dynamicRow = new LinkedHashMap<>();
MesInspectionReport buildDTO1 = new MesInspectionReport();
buildDTO1.setData(project.getTableLine() + "");
dynamicRow.put("序号",buildDTO1);
MesInspectionReport buildDTO2 = new MesInspectionReport();
buildDTO2.setData(project.getProjectName());
dynamicRow.put("点检项目",buildDTO2);
MesInspectionReport buildDTO3 = new MesInspectionReport();
buildDTO3.setData(project.getInfoName());
dynamicRow.put("点检内容",buildDTO3);
if(CollectionUtils.isEmpty(teamArray)){
dynamicRow.put("", "");
dynamicRow.put(" ", "");
dynamicRow.put(" ", "");
dynamicRow.put(" ", "");
dynamicRow.put(" ", "");
dynamicRow.put(" ", "");
buildDTO.setTableLine(1);
dynamicRow.put("第1列", buildDTO);
buildDTO.setTableLine(2);
dynamicRow.put("第2列", buildDTO);
buildDTO.setTableLine(3);
dynamicRow.put("第3列", buildDTO);
buildDTO.setTableLine(4);
dynamicRow.put("第4列", buildDTO);
buildDTO.setTableLine(5);
dynamicRow.put("第5列", buildDTO);
buildDTO.setTableLine(6);
dynamicRow.put("第6列", buildDTO);
}else{
for(String team : teamArray){
List<MesInspectionReport> result = list.stream()
@ -402,32 +416,40 @@ public class MesInspectionReportServiceImpl implements IMesInspectionReportServi
.collect(Collectors.toList()); // 收集结果
if(!CollectionUtils.isEmpty(result)){
if(StringUtils.isNotBlank(result.get(0).getCheckResult())){
dynamicRow.put(team, result.get(0).getCheckResult());
result.get(0).setWhetherOpenLine( result.get(0).getBz().equals("1") ? true : false);
dynamicRow.put(team, result.get(0));
}else{
dynamicRow.put(team, "");
result.get(0).setWhetherOpenLine( result.get(0).getBz().equals("1") ? true : false);
dynamicRow.put(team, result.get(0));
}
}else{
dynamicRow.put(team, "");
dynamicRow.put(team, buildDTO);
}
}
}
if(teamArray.size() < 6){
for(int i = 0 ; i < 6-(teamArray.size()) ; i++){
for(int i = 0 ; i < 6 - (teamArray.size()) ; i++){
if(i == 0){
dynamicRow.put("", "");
buildDTO.setTableLine(teamArray.size() + 1);
dynamicRow.put("第"+ (teamArray.size()+1)+"列", buildDTO);
}else if(i == 1){
dynamicRow.put(" ", "");
buildDTO.setTableLine(teamArray.size() + 2);
dynamicRow.put("第"+(teamArray.size()+2)+"列", buildDTO);
}else if(i == 2){
dynamicRow.put(" ", "");
buildDTO.setTableLine(teamArray.size() + 3);
dynamicRow.put("第"+(teamArray.size()+3)+"列", buildDTO);
}else if(i == 3){
dynamicRow.put(" ", "");
buildDTO.setTableLine(teamArray.size() + 4);
dynamicRow.put("第"+(teamArray.size()+4)+"列", buildDTO);
}else if(i == 4){
dynamicRow.put(" ", "");
buildDTO.setTableLine(teamArray.size() + 5);
dynamicRow.put("第"+(teamArray.size()+5)+"列", buildDTO);
}else if(i == 5){
dynamicRow.put(" ", "");
buildDTO.setTableLine(teamArray.size() + 6);
dynamicRow.put("第"+(teamArray.size() + 6)+"列", buildDTO);
}
}
}
@ -440,101 +462,74 @@ public class MesInspectionReportServiceImpl implements IMesInspectionReportServi
return listDTO;
}
//点检上半部分数据
@Override
@DS("#header.poolName")
public List selectCheckBoxList(MesInspectionReport mesInspectionReport) {
List<Object> listDTO = new ArrayList<>();
//1.报表名
mesInspectionReport.setReportName("CheckReport");
List<MesInspectionReport> lists = mesInspectionReportMapper.selectCheckBoxList(mesInspectionReport);
Map<String,Map<String,Boolean>> dynamicRow1 = new LinkedHashMap<>();
Map<String,String> dynamicRow2 = new LinkedHashMap<>();
String str = "str";
int i = 0;
for(MesInspectionReport list :lists){
Map<String,Boolean> dynamicRow10 = new LinkedHashMap<>();
if(list.getBz().equals("1")){
dynamicRow10.put("openLine",Boolean.TRUE);
dynamicRow10.put("clearLine",Boolean.FALSE);
dynamicRow1.put(str + i + "",dynamicRow10);
}else{
dynamicRow10.put("clearLine",Boolean.TRUE);
dynamicRow10.put("openLine",Boolean.FALSE);
dynamicRow1.put(str + i + "",dynamicRow10);
}
//修改表头部和表尾部
public AjaxResult updatePointInspectionTable(MesInspectionReport mesInspectionReport) {
mesInspectionReport.setUpdateBy(SecurityContextHolder.getUserName());
mesInspectionReport.setUpdateTime(DateUtils.getNowDate());
mesInspectionReportMapper.updateHeaderFooter(mesInspectionReport);//修改主表
dynamicRow2.put(str + i + "","班次:" + list.getRemark());
i++;
}
if(lists == null){
Map<String,Boolean> dynamicRow10 = new LinkedHashMap<>();
dynamicRow10.put("openLine",Boolean.FALSE);
dynamicRow10.put("clearLine",Boolean.FALSE);
dynamicRow1.put(str + 0 + "", dynamicRow10);
dynamicRow1.put(str + 1 + "", dynamicRow10);
dynamicRow1.put(str + 2 + "", dynamicRow10);
dynamicRow1.put(str + 3 + "", dynamicRow10);
dynamicRow1.put(str + 4 + "", dynamicRow10);
dynamicRow1.put(str + 5 + "", dynamicRow10);
dynamicRow2.put(str + 0 + "", "班次:");
dynamicRow2.put(str + 1 + "", "班次:");
dynamicRow2.put(str + 2 + "", "班次:");
dynamicRow2.put(str + 3 + "", "班次:");
dynamicRow2.put(str + 4 + "", "班次:");
dynamicRow2.put(str + 5 + "", "班次:");
}
//需要新增的
List<MesInspectionReport> addList = new ArrayList<>();
//需要修改的
List<MesInspectionReport> updateList = new ArrayList<>();
ArrayList<LinkedHashMap<String, LinkedHashMap<String, Object>>> tableData = mesInspectionReport.getTableData();
if (tableData!= null) {
for (LinkedHashMap<String, LinkedHashMap<String, Object>> item : tableData) {
//提取出来开始结束那一行数据的 项目名字
String infoName = (String) item.get("点检内容").get("data");
if(dynamicRow1.size() < 6){
for(int j = 0 ; j < 6-(lists.size()) ; j++){
Map<String,Boolean> dynamicRow10 = new LinkedHashMap<>();
dynamicRow10.put("openLine",Boolean.FALSE);
dynamicRow10.put("clearLine",Boolean.FALSE);
if(j == 0){
dynamicRow1.put(str + 5 +"", dynamicRow10);
}else if(j == 1){
dynamicRow1.put(str + 4 +"", dynamicRow10);
}else if(j == 2){
dynamicRow1.put(str + 3 +"", dynamicRow10);
}else if(j == 3){
dynamicRow1.put(str + 2 +"", dynamicRow10);
}else if(j == 4){
dynamicRow1.put(str + 1 +"", dynamicRow10);
}else if(j == 5){
dynamicRow1.put(str + 0 +"", dynamicRow10);
for (Map.Entry<String, LinkedHashMap<String, Object>> entry : item.entrySet()) {
if(!entry.getKey().equals("序号") && !entry.getKey().equals("点检内容") && !entry.getKey().equals("点检项目")){
LinkedHashMap<String, Object> innerMap = entry.getValue();
String id = (String) innerMap.get("id");
String checkResult = (String) innerMap.get("checkResult");
Boolean whetherOpenLine = (Boolean) innerMap.get("whetherOpenLine");
String remark = (String) innerMap.get("remark");
String belongTo = (String) innerMap.get("belongTo");
Integer tableLine = (Integer) innerMap.get("tableLine");
if(StringUtils.isNotBlank(id) && StringUtils.isNotBlank(checkResult)){
MesInspectionReport updateDto = new MesInspectionReport();
updateDto.setId(id);
updateDto.setUpdateBy(SecurityContextHolder.getUserName());
updateDto.setUpdateTime(DateUtils.getNowDate());
updateDto.setCheckResult(checkResult);
updateDto.setBz(whetherOpenLine == true ? "1": "0");
updateDto.setRemark(remark);
updateList.add(updateDto);
}else if(StringUtils.isBlank(id) && StringUtils.isNotBlank(checkResult)){
MesInspectionReport addDto = new MesInspectionReport();
addDto.setId(IdUtils.fastSimpleUUID());
addDto.setBelongTo(StringUtils.isNotBlank(belongTo)? belongTo: mesInspectionReport.getId());
addDto.setCreateBy(SecurityContextHolder.getUserName());
addDto.setCreateTime(DateUtils.getNowDate());
addDto.setUpdateBy(SecurityContextHolder.getUserName());
addDto.setUpdateTime(DateUtils.getNowDate());
addDto.setCheckResult(checkResult);
addDto.setBz(whetherOpenLine == true ? "1": "0");
addDto.setDelFlag("0");
addDto.setRemark(remark);
addDto.setInfoName(infoName);
addDto.setTableLine(tableLine);
addList.add(addDto);
}
}
}
}
}
if(dynamicRow2.size() < 6){
for(int j = 0 ; j < 6-(lists.size()) ; j++){
if(j == 0){
dynamicRow2.put(str + 5 +"", "班次:");
}else if(j == 1){
dynamicRow2.put(str + 4 +"", "班次:");
}else if(j == 2){
dynamicRow2.put(str + 3 +"", "班次:");
}else if(j == 3){
dynamicRow2.put(str + 2 +"", "班次:");
}else if(j == 4){
dynamicRow2.put(str + 1 +"", "班次:");
}else if(j == 5){
dynamicRow2.put(str + 0 +"", "班次:");
}
}
//更新表的主体部分 也就是数据库的子表
if(updateList.size() > 0 ){
mesInspectionReportMapper.updateBatch(updateList);
}
String s1 = JSON.toJSONString(dynamicRow1);
String s2 = JSON.toJSONString(dynamicRow2);
JSONObject object1 = JSONObject.parseObject(s1, Feature.OrderedField);
JSONObject object2 = JSONObject.parseObject(s2, Feature.OrderedField);
log.info("点检动态添加属性: = {}",object1);
log.info("点检动态添加属性: = {}",object2);
listDTO.add(object1);
listDTO.add(object2);
log.info("点检动态添加属性: = {}", JSON.toJSONString(listDTO));
return listDTO;
if(addList.size() >0){
mesInspectionReportMapper.addBatch(addList);
}
return AjaxResult.success();
}
}

@ -57,7 +57,8 @@
mtsd.remark
from mes_table_self mts
left join mes_table_self_detial mtsd on mts.id = mtsd.belong_to
where mts.id = #{id}
where 1 = 1
and mts.id = #{id}
and mtsd.del_flag = '0'
</select>
@ -125,7 +126,16 @@
mts.remark,
mts.create_by
from mes_table_self mts
where id = #{id}
where 1=1
<if test="reportName == 'CheckReport'">
and report_name = #{reportName}
and line_code = #{lineCode}
and CONVERT(date, mts.check_date) = CONVERT(date,#{checkDate})
</if>
<if test="reportName != 'CheckReport'">
and id = #{id}
</if>
and del_flag = '0'
</select>
<select id="getLineCodeList" resultMap="MesInspectionReportResult" parameterType="MesInspectionReport">
@ -135,21 +145,6 @@
and equipment_category = '1'
</select>
<select id="selectCheckBoxList" resultMap="MesInspectionReportResult" parameterType="MesInspectionReport">
select
mtsd.remark, mtsd.bz
from mes_table_self mts
left join mes_table_self_detial mtsd on mts.id = mtsd.belong_to
where 1=1
and mts.del_flag = '0'
and mtsd.del_flag = '0'
and CONVERT(date, mts.check_date) = CONVERT(date,#{checkDate})
and mts.line_code = #{lineCode}
and mts.report_name = #{reportName}
group by mtsd.remark,mtsd.bz
order by mtsd.remark
</select>
<select id="getProductList" resultMap="MesInspectionReportResult" parameterType="MesInspectionReport">
select
mts.id,
@ -203,6 +198,8 @@
<if test="item.checkResult != null">check_result = #{item.checkResult},</if>
<if test="item.updateBy != null">update_by = #{item.updateBy},</if>
<if test="item.updateTime != null">update_time = #{item.updateTime},</if>
<if test="item.remark != null">remark = #{item.remark},</if>
<if test="item.bz != null">bz = #{item.bz},</if>
</trim>
where id = #{item.id}
</foreach>

Loading…
Cancel
Save