This commit is contained in:
2025-07-10 14:18:36 +08:00
parent b8793b7621
commit 867677f465
7 changed files with 33 additions and 28 deletions

View File

@@ -187,7 +187,7 @@ public class IndustryStepController extends BaseController
public AjaxResult resource(IndustryMaterial industryMaterial){
return AjaxResult.success(industryStepService.createStep(industryMaterial));
}
}

View File

@@ -52,5 +52,10 @@ public class IndustryTechnology extends BaseEntity
/** 删除标志 */
private Long delFlag;
/** 直径 */
private Double diameter;
@Excel(name = "规格")
private String specification;
}

View File

@@ -100,7 +100,7 @@ public interface IIndustryMaterialService
* @param industryMaterial batchId state=1
* @return
*/
String resourceToWorkAndCreateStep(IndustryMaterial industryMaterial);
IndustryMaterialVo resourceToWorkAndCreateStep(IndustryMaterial industryMaterial);
/**
* 异常料切换

View File

@@ -646,7 +646,7 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
@Override
@Transactional
public String resourceToWorkAndCreateStep(IndustryMaterial industryMaterial) {
public IndustryMaterialVo resourceToWorkAndCreateStep(IndustryMaterial industryMaterial) {
IndustryMaterialVo industryMaterialVo = new IndustryMaterialVo();
industryMaterialVo.setBatchId(industryMaterial.getBatchId());
// 获得该批次的所有原料
@@ -658,7 +658,7 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
IndustryMaterialVo firstIndustryMaterial = industryMaterialVos.get(0);
for (IndustryMaterialVo materialVo : industryMaterialVos) {
if (!Objects.equals(firstIndustryMaterial.getTechnology(), materialVo.getTechnology())) {
return "0";
return null;
}
}
for (IndustryMaterialVo materialVo : industryMaterialVos) {
@@ -666,9 +666,9 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
updateIndustryMaterial(materialVo);
}
// 到了这里表示工艺都相同返回1
return firstIndustryMaterial.getTechnology();
return firstIndustryMaterial;
} else {
return "0";
return null;
}

View File

@@ -141,16 +141,12 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
@Override
public List<IndustryStepVo> selectIndustryStepListByProcess(IndustryStep industryStep) {
String materialId = industryStep.getMaterialId();
Long batchId = industryStep.getBatchId();
industryStep.setMaterialId(materialId);
industryStep.setBatchId(batchId);
List<IndustryStepVo> industryStepVos = industryStepMapper.selectIndustryStepList(industryStep);
if (industryStepVos.isEmpty()) {
// 表示该批次没有出现道次 直接return
industryStep = new IndustryStep();
industryStep.setMaterialId(materialId);
industryStep.setBatchId(batchId);
industryStep.setMaterialId(industryStep.getMaterialId());
industryStep.setBatchId(industryStep.getBatchId());
return industryStepMapper.selectIndustryStepList(industryStep);
}
int pos = 0;
@@ -257,14 +253,6 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
// nextStepFlag为切换道次的标志位当其为1时需要进行切换道次否则不用切换道次
return 0;
}
// s7PLC.writeBoolean("DB15.1.2", true);
// while (!s7PLC.readBoolean("DB15.1.2")) {
// Threads.sleep(500);
//
// }
// if (s7PLC.readBoolean("DB15.1.2")) {
Threads.sleep(5000);
// 更新该批次中的全部道次的 "操作中" 字段为0
IndustryStep step = new IndustryStep();
@@ -329,6 +317,7 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
IndustryStep industryStep = new IndustryStep();
industryStep.setDelFlag(1L);
industryStep.setState(0L);
industryStep.setBatchId(industryMaterial.getBatchId());
List<IndustryStepVo> industryStepVos = industryStepMapper.selectErrorIndustryStepList(industryStep);
IndustryStep smallStep = industryStepVos.get(0);
@@ -415,12 +404,14 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
@Override
public int createStep(IndustryMaterial industryMaterial) {
String success = industryMaterialService.resourceToWorkAndCreateStep(industryMaterial);
if (!Objects.equals(success, "0")) {
IndustryMaterialVo success = industryMaterialService.resourceToWorkAndCreateStep(industryMaterial);
if (Objects.nonNull(success)) {
// 进入这里说明工艺没问题接下里根据工艺表创建道次
// 判断当前是粗轧还是精轧
IndustryTechnology industryTechnology = new IndustryTechnology();
industryTechnology.setTechnologyId(success);
industryTechnology.setTechnologyId(success.getTechnology());
industryTechnology.setDiameter(success.getDiameter());
industryTechnology.setSpecification(success.getSpecification());
if (Objects.equals(mode, "0")) {
// 粗轧
industryTechnology.setState(0L);
@@ -431,7 +422,6 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
List<IndustryMaterialVo> industryMaterialVos = industryMaterialService.selectIndustryMaterialByBatchId(industryMaterial.getBatchId());
// 添加特判 当工艺表为空时通知前端无此工艺不可进入轧制页面
if (industryTechnologyVos.isEmpty()) {
// 把状态改回去
if (Objects.nonNull(industryMaterialVos.get(0))) {
for (IndustryMaterialVo materialVo : industryMaterialVos) {

View File

@@ -47,8 +47,8 @@
<where>
<if test="step != null ">and step = #{step}</if>
<if test="delFlag == null and delFlag ==''">and del_flag = 0</if>
<if test="delFlag != null and delFlag !=''">and del_flag = #{delFlag}</if>
<if test="delFlag == null">and del_flag = 0</if>
<if test="delFlag != null">and del_flag = #{delFlag}</if>
<if test="reduction != null ">and reduction = #{reduction}</if>
<if test="setValue != null ">and set_value = #{setValue}</if>
<if test="angle != null ">and angle = #{angle}</if>
@@ -64,7 +64,7 @@
<include refid="selectIndustryStepVo"/>
<where>
<if test="step != null ">and step = #{step}</if>
<if test="delFlag != null and delFlag !=''">and del_flag = #{delFlag}</if>
<if test="delFlag != null">and del_flag = #{delFlag}</if>
<if test="reduction != null ">and reduction = #{reduction}</if>
<if test="setValue != null ">and set_value = #{setValue}</if>
<if test="angle != null ">and angle = #{angle}</if>

View File

@@ -20,10 +20,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="diameter" column="diameter" />
<result property="specification" column="specification" />
</resultMap>
<sql id="selectIndustryTechnologyVo">
select id, technology_id, step, reduction, thickness_front, thickness_behind, angle, set_value, state, del_flag, remark, create_time, create_by, update_time, update_by from industry_technology
select id, technology_id, step, reduction, thickness_front, thickness_behind, angle, set_value, state, del_flag, remark, create_time, create_by, update_time, update_by,diameter,specification from industry_technology
</sql>
<select id="selectIndustryTechnologyList" parameterType="IndustryTechnology" resultMap="IndustryTechnologyResult">
@@ -37,6 +39,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="angle != null "> and angle = #{angle}</if>
<if test="setValue != null "> and set_value = #{setValue}</if>
<if test="state != null "> and state = #{state}</if>
<if test="diameter != null "> and diameter = #{diameter}</if>
<if test="specification != null "> and specification = #{specification}</if>
</where>
order by step
</select>
@@ -63,6 +67,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="diameter != null">diameter,</if>
<if test="specification != null">specification,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="technologyId != null">#{technologyId},</if>
@@ -79,6 +85,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="diameter != null">#{diameter},</if>
<if test="specification != null">#{specification},</if>
</trim>
</insert>
@@ -99,6 +107,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="diameter != null">diameter = #{diameter},</if>
<if test="specification != null">specification = #{specification},</if>
</trim>
where id = #{id}
</update>