工单下发--工艺下发

highway
zhaoxiaolin 1 year ago
parent f44af65c4f
commit 93d42d6d2a

@ -73,6 +73,49 @@ public class ProWorkorderProcessDetail extends BaseEntity {
@Excel(name = "工艺编码") @Excel(name = "工艺编码")
private String routeCode; private String routeCode;
@Excel(name = "下一步工序id")
private String nextProcessId;
/** 序号 */
@Excel(name = "序号")
private Integer orderNum;
/** 工艺名称 */
private String routeName;
/** 工序名称 */
private String processName;
public String getRouteName() {
return routeName;
}
public void setRouteName(String routeName) {
this.routeName = routeName;
}
public String getProcessName() {
return processName;
}
public void setProcessName(String processName) {
this.processName = processName;
}
public String getNextProcessId() {
return nextProcessId;
}
public void setNextProcessId(String nextProcessId) {
this.nextProcessId = nextProcessId;
}
public Integer getOrderNum() {
return orderNum;
}
public void setOrderNum(Integer orderNum) {
this.orderNum = orderNum;
}
public void setRecordId(String recordId) { public void setRecordId(String recordId) {
this.recordId = recordId; this.recordId = recordId;
} }

@ -96,5 +96,7 @@ public interface ProOrderWorkorderMapper {
ProOrderWorkorder selectWorkOrderByCode(String workorderCode); ProOrderWorkorder selectWorkOrderByCode(String workorderCode);
/**下发生产订单**/ /**下发生产订单**/
public int downProOrderWorkorderByWorkorderIds(String[] workorderIds); public int downProOrderWorkorderByWorkorderIds(String[] workorderIds);
public List<ProOrderWorkorder> getWorkOrderByIds(String[] workorderIds);
} }

@ -2,14 +2,17 @@ package com.op.mes.mapper;
import java.util.List; import java.util.List;
import com.op.mes.domain.ProOrderWorkorder;
import com.op.mes.domain.ProWorkorderProcessDetail; import com.op.mes.domain.ProWorkorderProcessDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/** /**
* Mapper * Mapper
* *
* @author Open Platform * @author Open Platform
* @date 2023-07-28 * @date 2023-07-28
*/ */@Mapper
public interface ProWorkorderProcessDetailMapper { public interface ProWorkorderProcessDetailMapper {
/** /**
* *
@ -58,4 +61,8 @@ public interface ProWorkorderProcessDetailMapper {
* @return * @return
*/ */
public int deleteProWorkorderProcessDetailByRecordIds(String[] recordIds); public int deleteProWorkorderProcessDetailByRecordIds(String[] recordIds);
public void addWorkOrderDetails(@Param("processes") List<ProWorkorderProcessDetail> processes);
public List<ProWorkorderProcessDetail> getWorkOrderDetailsByRouteCode(ProOrderWorkorder workorder);
} }

@ -1,11 +1,15 @@
package com.op.mes.service.impl; package com.op.mes.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.context.SecurityContextHolder;
import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.mes.domain.ProOrderWorkorder; import com.op.mes.domain.ProOrderWorkorder;
import com.op.mes.domain.ProWorkorderProcessDetail;
import com.op.mes.mapper.ProOrderMapper; import com.op.mes.mapper.ProOrderMapper;
import com.op.mes.mapper.ProOrderWorkorderBatchMapper; import com.op.mes.mapper.ProOrderWorkorderBatchMapper;
import com.op.mes.mapper.ProOrderWorkorderMapper; import com.op.mes.mapper.ProOrderWorkorderMapper;
import com.op.mes.mapper.ProWorkorderProcessDetailMapper;
import com.op.mes.service.IProOrderWorkorderService; import com.op.mes.service.IProOrderWorkorderService;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -31,6 +35,8 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
private ProOrderWorkorderBatchMapper proOrderWorkorderBatchMapper; private ProOrderWorkorderBatchMapper proOrderWorkorderBatchMapper;
@Autowired @Autowired
private ProOrderMapper proOrderMapper; private ProOrderMapper proOrderMapper;
@Autowired
private ProWorkorderProcessDetailMapper proWorkorderProcessDetailMapper;
/** /**
* *
* *
@ -155,11 +161,25 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
@DS("#header.poolName") @DS("#header.poolName")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int downProOrderWorkorderByWorkorderIds(String[] workorderIds) { public int downProOrderWorkorderByWorkorderIds(String[] workorderIds) {
//下达工单
int m= proOrderWorkorderMapper.downProOrderWorkorderByWorkorderIds(workorderIds);
//关联工艺 //关联工艺
//List<ProOrderWorkorder> workorders = proOrderWorkorderMapper.getWorkOrder List<ProOrderWorkorder> workorders = proOrderWorkorderMapper.getWorkOrderByIds(workorderIds);
// for(ProOrderWorkorder workorder:workorders){
return m; if(StringUtils.isNotBlank(workorder.getRouteCode())){
List<ProWorkorderProcessDetail> workDetails = proWorkorderProcessDetailMapper.getWorkOrderDetailsByRouteCode(workorder);
if(!CollectionUtils.isEmpty(workDetails)){
workDetails.forEach(str->{
str.setRecordId(IdUtils.fastSimpleUUID());
str.setWorkorderId(workorder.getWorkorderId());
str.setStatus("s0");//未执行
str.setCreateBy(SecurityContextHolder.getUserName());
str.setCreateTime(DateUtils.getNowDate());
str.setFactoryCode(workorder.getFactoryCode());
});
proWorkorderProcessDetailMapper.addWorkOrderDetails(workDetails);
}
}
}
//下达工单
return proOrderWorkorderMapper.downProOrderWorkorderByWorkorderIds(workorderIds);
} }
} }

@ -108,6 +108,13 @@
select workorder_id select workorder_id
from pro_wet_material_plan_detail) and CONVERT(date, product_date) = #{productDate} from pro_wet_material_plan_detail) and CONVERT(date, product_date) = #{productDate}
</select> </select>
<select id="getWorkOrderByIds" resultMap="ProOrderWorkorderResult">
<include refid="selectProOrderWorkorderVo"/>
where workorder_code in
<foreach item="workorderCode" collection="array" open="(" separator="," close=")">
#{workorderCode}
</foreach>
</select>
<insert id="insertProOrderWorkorder" parameterType="ProOrderWorkorder"> <insert id="insertProOrderWorkorder" parameterType="ProOrderWorkorder">
insert into pro_order_workorder insert into pro_order_workorder

@ -25,10 +25,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="routeId" column="route_id" /> <result property="routeId" column="route_id" />
<result property="routeVersion" column="route_version" /> <result property="routeVersion" column="route_version" />
<result property="routeCode" column="route_code" /> <result property="routeCode" column="route_code" />
<result property="nextProcessId" column="next_process_id" />
<result property="orderNum" column="order_num" />
</resultMap> </resultMap>
<sql id="selectProWorkorderProcessDetailVo"> <sql id="selectProWorkorderProcessDetailVo">
select record_id, workorder_id, process_id, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, prod_type, factory_code, machine_id, machine_code, route_id, route_version, route_code from pro_workorder_process_detail select record_id, workorder_id, process_id, status, remark,
attr1, attr2, attr3, attr4, create_by, create_time,
update_by, update_time, prod_type, factory_code, machine_id,
machine_code, route_id, route_version, route_code ,
next_process_id,order_num
from pro_workorder_process_detail
</sql> </sql>
<select id="selectProWorkorderProcessDetailList" parameterType="ProWorkorderProcessDetail" resultMap="ProWorkorderProcessDetailResult"> <select id="selectProWorkorderProcessDetailList" parameterType="ProWorkorderProcessDetail" resultMap="ProWorkorderProcessDetailResult">
@ -55,6 +62,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectProWorkorderProcessDetailVo"/> <include refid="selectProWorkorderProcessDetailVo"/>
where record_id = #{recordId} where record_id = #{recordId}
</select> </select>
<select id="getWorkOrderDetailsByRouteCode" resultType="com.op.mes.domain.ProWorkorderProcessDetail">
select
r.route_id routeId,
r.route_code routeCode,
r.route_name routeName,
r.route_version routeVersion,
rp.process_id processId,
rp.next_process_id nextProcessId,
rp.process_name processName,
rp.order_num orderNum
from pro_route r
left join pro_route_process rp on r.route_id = rp.route_id
where r.route_code = #{routeCode}
order by rp.order_num
</select>
<insert id="insertProWorkorderProcessDetail" parameterType="ProWorkorderProcessDetail"> <insert id="insertProWorkorderProcessDetail" parameterType="ProWorkorderProcessDetail">
insert into pro_workorder_process_detail insert into pro_workorder_process_detail
@ -79,6 +101,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="routeId != null">route_id,</if> <if test="routeId != null">route_id,</if>
<if test="routeVersion != null">route_version,</if> <if test="routeVersion != null">route_version,</if>
<if test="routeCode != null">route_code,</if> <if test="routeCode != null">route_code,</if>
<if test="nextProcessId != null">next_process_id,</if>
<if test="orderNum != null">order_num,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="recordId != null">#{recordId},</if> <if test="recordId != null">#{recordId},</if>
@ -101,8 +125,60 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="routeId != null">#{routeId},</if> <if test="routeId != null">#{routeId},</if>
<if test="routeVersion != null">#{routeVersion},</if> <if test="routeVersion != null">#{routeVersion},</if>
<if test="routeCode != null">#{routeCode},</if> <if test="routeCode != null">#{routeCode},</if>
<if test="nextProcessId != null">#{nextProcessId},</if>
<if test="orderNum != null">#{orderNum},</if>
</trim> </trim>
</insert> </insert>
<insert id="addWorkOrderDetails">
<foreach collection="processes" item="process" index="index" separator=";">
insert into pro_workorder_process_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="process.recordId != null">record_id,</if>
<if test="process.workorderId != null">workorder_id,</if>
<if test="process.processId != null">process_id,</if>
<if test="process.status != null">status,</if>
<if test="process.remark != null">remark,</if>
<if test="process.attr1 != null">attr1,</if>
<if test="process.attr2 != null">attr2,</if>
<if test="process.attr3 != null">attr3,</if>
<if test="process.attr4 != null">attr4,</if>
<if test="process.createBy != null">create_by,</if>
<if test="process.createTime != null">create_time,</if>
<if test="process.prodType != null">prod_type,</if>
<if test="process.factoryCode != null">factory_code,</if>
<if test="process.machineId != null">machine_id,</if>
<if test="process.machineCode != null">machine_code,</if>
<if test="process.routeId != null">route_id,</if>
<if test="process.routeVersion != null">route_version,</if>
<if test="process.routeCode != null">route_code,</if>
<if test="process.nextProcessId != null">next_process_id,</if>
<if test="process.orderNum != null">order_num,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="process.recordId != null">#{process.recordId},</if>
<if test="process.workorderId != null">#{process.workorderId},</if>
<if test="process.processId != null">#{process.processId},</if>
<if test="process.status != null">#{process.status},</if>
<if test="process.remark != null">#{process.remark},</if>
<if test="process.attr1 != null">#{process.attr1},</if>
<if test="process.attr2 != null">#{process.attr2},</if>
<if test="process.attr3 != null">#{process.attr3},</if>
<if test="process.attr4 != null">#{process.attr4},</if>
<if test="process.createBy != null">#{process.createBy},</if>
<if test="process.createTime != null">#{process.createTime},</if>
<if test="process.prodType != null">#{process.prodType},</if>
<if test="process.factoryCode != null">#{process.factoryCode},</if>
<if test="process.machineId != null">#{process.machineId},</if>
<if test="process.machineCode != null">#{process.machineCode},</if>
<if test="process.routeId != null">#{process.routeId},</if>
<if test="process.routeVersion != null">#{process.routeVersion},</if>
<if test="process.routeCode != null">#{process.routeCode},</if>
<if test="process.nextProcessId != null">#{process.nextProcessId},</if>
<if test="process.orderNum != null">#{process.orderNum},</if>
</trim>
</foreach>
</insert>
<update id="updateProWorkorderProcessDetail" parameterType="ProWorkorderProcessDetail"> <update id="updateProWorkorderProcessDetail" parameterType="ProWorkorderProcessDetail">
update pro_workorder_process_detail update pro_workorder_process_detail
@ -126,6 +202,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="routeId != null">route_id = #{routeId},</if> <if test="routeId != null">route_id = #{routeId},</if>
<if test="routeVersion != null">route_version = #{routeVersion},</if> <if test="routeVersion != null">route_version = #{routeVersion},</if>
<if test="routeCode != null">route_code = #{routeCode},</if> <if test="routeCode != null">route_code = #{routeCode},</if>
<if test="nextProcessId != null">next_process_id=#{nextProcessId},</if>
<if test="orderNum != null">order_num=#{orderNum},</if>
</trim> </trim>
where record_id = #{recordId} where record_id = #{recordId}
</update> </update>

Loading…
Cancel
Save