线体管理修改

master
shaoyong 8 months ago
parent bec9763ca4
commit 8ecedca10d

@ -1,10 +1,12 @@
package com.op.mes.controller;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.nacos.shaded.com.google.protobuf.Internal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
@ -74,7 +76,13 @@ public class MesLineController extends BaseController {
@Log(title = "线体管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MesLine mesLine) {
return toAjax(mesLineService.insertMesLine(mesLine));
MesLine vali = mesLineService.validate(mesLine.getLineCode());
if (ObjectUtils.isEmpty(vali)){
return toAjax(mesLineService.insertMesLine(mesLine));
}else {
return error("线体已存在不能重复添加!");
}
}
/**

@ -64,4 +64,6 @@ public interface MesLineMapper {
* 线
*/
public List<MesLine> selectLineBody(MesLine mesLine);
public MesLine validate(String lineCode);
}

@ -63,4 +63,6 @@ public interface IMesLineService {
* 线
*/
public List<MesLine> selectLineBody(MesLine mesLine);
public MesLine validate(String lineCode);
}

@ -105,7 +105,6 @@ public class MesLineServiceImpl implements IMesLineService {
mesLine.setUpdateBy(SecurityUtils.getUsername());
List<String> processList = mesLine.getProcessList();
List<BigDecimal> qualityList = mesLine.getQualityList();
int flag = 0;
if (!CollectionUtils.isEmpty(processList)) {
//删除旧的工艺项
mesLineProcessService.deleteMesLineProcessByBelongTo(mesLine.getId());
@ -126,16 +125,12 @@ public class MesLineServiceImpl implements IMesLineService {
mesLineProcess.setLineCode(lineCode);
mesLineProcess.setLineName(lineName);
mesLineProcess.setFactoryCode(factoryCode);
flag += mesLineProcessService.insertMesLineProcess(mesLineProcess);
mesLineProcessService.insertMesLineProcess(mesLineProcess);
}
}else {
return 0;
}
if (flag > 0){
return mesLineMapper.updateMesLine(mesLine);
}else {
return 0;
}
return mesLineMapper.updateMesLine(mesLine);
}
/**
@ -166,4 +161,10 @@ public class MesLineServiceImpl implements IMesLineService {
public List<MesLine> selectLineBody(MesLine mesLine) {
return mesLineMapper.selectLineBody(mesLine);
}
@Override
@DS("#header.poolName")
public MesLine validate(String lineCode) {
return mesLineMapper.validate(lineCode);
}
}

@ -57,7 +57,7 @@
<if test="factoryCode != null and factoryCode != ''">
and factory_code = #{factoryCode}
</if>
and del_flag = '0'
and del_flag = '0' order by create_time
</where>
</select>
@ -148,4 +148,9 @@
and equipment_name like concat('%', #{lineName}, '%')
</if>
</select>
<select id="validate" parameterType="MesLine" resultMap="MesLineResult">
select id, line_code, line_name, use_man, efficiency
from mes_line
where line_code = #{lineCode} and del_flag = '0'
</select>
</mapper>

@ -75,7 +75,7 @@
<select id="selectMesLineProcessByBelongTo" parameterType="String"
resultMap="MesLineProcessResult">
<include refid="selectMesLineProcessVo"/>
where belong_to = #{belongTo}
where belong_to = #{belongTo} order by create_time ASC
</select>
<insert id="insertMesLineProcess" parameterType="MesLineProcess">

Loading…
Cancel
Save