diff --git a/op-modules/op-mes/src/main/java/com/op/mes/domain/ProWorkorderProcessDetail.java b/op-modules/op-mes/src/main/java/com/op/mes/domain/ProWorkorderProcessDetail.java index 88086a34..818ae405 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/domain/ProWorkorderProcessDetail.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/domain/ProWorkorderProcessDetail.java @@ -73,6 +73,49 @@ public class ProWorkorderProcessDetail extends BaseEntity { @Excel(name = "工艺编码") 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) { this.recordId = recordId; } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/mapper/ProOrderWorkorderMapper.java b/op-modules/op-mes/src/main/java/com/op/mes/mapper/ProOrderWorkorderMapper.java index 1132f41a..c16208ed 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/mapper/ProOrderWorkorderMapper.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/mapper/ProOrderWorkorderMapper.java @@ -96,5 +96,7 @@ public interface ProOrderWorkorderMapper { ProOrderWorkorder selectWorkOrderByCode(String workorderCode); /**下发生产订单**/ public int downProOrderWorkorderByWorkorderIds(String[] workorderIds); + + public List getWorkOrderByIds(String[] workorderIds); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/mapper/ProWorkorderProcessDetailMapper.java b/op-modules/op-mes/src/main/java/com/op/mes/mapper/ProWorkorderProcessDetailMapper.java index 86fd9308..a9608afa 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/mapper/ProWorkorderProcessDetailMapper.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/mapper/ProWorkorderProcessDetailMapper.java @@ -2,14 +2,17 @@ package com.op.mes.mapper; import java.util.List; +import com.op.mes.domain.ProOrderWorkorder; import com.op.mes.domain.ProWorkorderProcessDetail; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 生产工单制程明细Mapper接口 * * @author Open Platform * @date 2023-07-28 - */ + */@Mapper public interface ProWorkorderProcessDetailMapper { /** * 查询生产工单制程明细 @@ -58,4 +61,8 @@ public interface ProWorkorderProcessDetailMapper { * @return 结果 */ public int deleteProWorkorderProcessDetailByRecordIds(String[] recordIds); + + public void addWorkOrderDetails(@Param("processes") List processes); + + public List getWorkOrderDetailsByRouteCode(ProOrderWorkorder workorder); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/ProOrderWorkorderServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/ProOrderWorkorderServiceImpl.java index 539f9b7b..dcf39f66 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/ProOrderWorkorderServiceImpl.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/ProOrderWorkorderServiceImpl.java @@ -1,11 +1,15 @@ package com.op.mes.service.impl; 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.uuid.IdUtils; import com.op.mes.domain.ProOrderWorkorder; +import com.op.mes.domain.ProWorkorderProcessDetail; import com.op.mes.mapper.ProOrderMapper; import com.op.mes.mapper.ProOrderWorkorderBatchMapper; import com.op.mes.mapper.ProOrderWorkorderMapper; +import com.op.mes.mapper.ProWorkorderProcessDetailMapper; import com.op.mes.service.IProOrderWorkorderService; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -31,6 +35,8 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { private ProOrderWorkorderBatchMapper proOrderWorkorderBatchMapper; @Autowired private ProOrderMapper proOrderMapper; + @Autowired + private ProWorkorderProcessDetailMapper proWorkorderProcessDetailMapper; /** * 查询生产工单 * @@ -155,11 +161,25 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { @DS("#header.poolName") @Transactional(rollbackFor = Exception.class) public int downProOrderWorkorderByWorkorderIds(String[] workorderIds) { - //下达工单 - int m= proOrderWorkorderMapper.downProOrderWorkorderByWorkorderIds(workorderIds); //关联工艺 - //List workorders = proOrderWorkorderMapper.getWorkOrder - // - return m; + List workorders = proOrderWorkorderMapper.getWorkOrderByIds(workorderIds); + for(ProOrderWorkorder workorder:workorders){ + if(StringUtils.isNotBlank(workorder.getRouteCode())){ + List 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); } } diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/ProOrderWorkorderMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/ProOrderWorkorderMapper.xml index fb715f27..73f81018 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/ProOrderWorkorderMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/ProOrderWorkorderMapper.xml @@ -108,6 +108,13 @@ select workorder_id from pro_wet_material_plan_detail) and CONVERT(date, product_date) = #{productDate} + insert into pro_order_workorder diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/ProWorkorderProcessDetailMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/ProWorkorderProcessDetailMapper.xml index 0a13b039..b7188440 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/ProWorkorderProcessDetailMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/ProWorkorderProcessDetailMapper.xml @@ -25,10 +25,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + - 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 + insert into pro_workorder_process_detail @@ -79,6 +101,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" route_id, route_version, route_code, + next_process_id, + order_num, #{recordId}, @@ -101,8 +125,60 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{routeId}, #{routeVersion}, #{routeCode}, + #{nextProcessId}, + #{orderNum}, + + + insert into pro_workorder_process_detail + + record_id, + workorder_id, + process_id, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + prod_type, + factory_code, + machine_id, + machine_code, + route_id, + route_version, + route_code, + next_process_id, + order_num, + + + #{process.recordId}, + #{process.workorderId}, + #{process.processId}, + #{process.status}, + #{process.remark}, + #{process.attr1}, + #{process.attr2}, + #{process.attr3}, + #{process.attr4}, + #{process.createBy}, + #{process.createTime}, + #{process.prodType}, + #{process.factoryCode}, + #{process.machineId}, + #{process.machineCode}, + #{process.routeId}, + #{process.routeVersion}, + #{process.routeCode}, + #{process.nextProcessId}, + #{process.orderNum}, + + + + update pro_workorder_process_detail @@ -126,6 +202,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" route_id = #{routeId}, route_version = #{routeVersion}, route_code = #{routeCode}, + next_process_id=#{nextProcessId}, + order_num=#{orderNum}, where record_id = #{recordId}