线体管理修改

master
shaoyong 8 months ago
parent bec9763ca4
commit 8ecedca10d

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

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

@ -105,7 +105,6 @@ public class MesLineServiceImpl implements IMesLineService {
mesLine.setUpdateBy(SecurityUtils.getUsername()); mesLine.setUpdateBy(SecurityUtils.getUsername());
List<String> processList = mesLine.getProcessList(); List<String> processList = mesLine.getProcessList();
List<BigDecimal> qualityList = mesLine.getQualityList(); List<BigDecimal> qualityList = mesLine.getQualityList();
int flag = 0;
if (!CollectionUtils.isEmpty(processList)) { if (!CollectionUtils.isEmpty(processList)) {
//删除旧的工艺项 //删除旧的工艺项
mesLineProcessService.deleteMesLineProcessByBelongTo(mesLine.getId()); mesLineProcessService.deleteMesLineProcessByBelongTo(mesLine.getId());
@ -126,16 +125,12 @@ public class MesLineServiceImpl implements IMesLineService {
mesLineProcess.setLineCode(lineCode); mesLineProcess.setLineCode(lineCode);
mesLineProcess.setLineName(lineName); mesLineProcess.setLineName(lineName);
mesLineProcess.setFactoryCode(factoryCode); mesLineProcess.setFactoryCode(factoryCode);
flag += mesLineProcessService.insertMesLineProcess(mesLineProcess); mesLineProcessService.insertMesLineProcess(mesLineProcess);
} }
}else {
return 0;
} }
if (flag > 0){
return mesLineMapper.updateMesLine(mesLine); return mesLineMapper.updateMesLine(mesLine);
}else {
return 0;
}
} }
/** /**
@ -166,4 +161,10 @@ public class MesLineServiceImpl implements IMesLineService {
public List<MesLine> selectLineBody(MesLine mesLine) { public List<MesLine> selectLineBody(MesLine mesLine) {
return mesLineMapper.selectLineBody(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 != ''"> <if test="factoryCode != null and factoryCode != ''">
and factory_code = #{factoryCode} and factory_code = #{factoryCode}
</if> </if>
and del_flag = '0' and del_flag = '0' order by create_time
</where> </where>
</select> </select>
@ -148,4 +148,9 @@
and equipment_name like concat('%', #{lineName}, '%') and equipment_name like concat('%', #{lineName}, '%')
</if> </if>
</select> </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> </mapper>

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

Loading…
Cancel
Save