【工作中心】虚拟工作中心对应关系

This commit is contained in:
10001392 2024-12-25 11:45:10 +08:00
parent b4adf9bc45
commit e13ec1cbda
4 changed files with 22 additions and 6 deletions

View File

@ -9,6 +9,7 @@ import com.nflg.product.technology.pojo.vo.ProcessWorkCenterVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 工艺管理-工作中心表数据库访问层
@ -35,5 +36,7 @@ public interface ProcessWorkCenterMapper extends BaseMapper<ProcessWorkCenterEnt
int insertOrUpdateBatch(@Param("entities") List<ProcessWorkCenterEntity> entities);
IPage<ProcessWorkCenterVO> selectPageByCondition(Page<ProcessWorkCenterEntity> page, @Param("query") ProcessWorkCenterQuery query);
List<Map<String, Object>> selectProcessWorkcenterMappingList();
}

View File

@ -84,18 +84,18 @@ public class ProcessWorkCenterVO implements Serializable {
private Date endTime;
//创建人
private String createBy;
private String createdBy;
//创建时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT-8")
private Date createTime;
private Date createdTime;
//更新人
private String updateBy;
private String updatedBy;
//更新时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT-8")
private Date updateTime;
private Date updatedTime;
// 虚拟工作中心
private String workingType;

View File

@ -117,12 +117,21 @@ public class ProcessWorkCenterService extends ServiceImpl<ProcessWorkCenterMappe
List<ProcessWorkCenterEntity> newList = new ArrayList<>();
// 数据库已有的SAP数据
List<ProcessWorkCenterEntity> existsList = new ArrayList<>();
// 对应关系
List<Map<String, Object>> mappingList = processWorkCenterMapper.selectProcessWorkcenterMappingList();
for (ProcessWorkCenterEntity sap : sapList) {
if (!workCenterSet.contains(sap.getFactory() + "_" + sap.getWorkCenter())) {
sap.setRowId(IdWorker.getId());
sap.setCreatedBy(SessionUtil.getUserName());
sap.setCreatedTime(new Date());
// TODO 自动关联虚拟工作中心
// 自动关联虚拟工作中心
if (CollUtil.isNotEmpty(mappingList)) {
List<Map<String, Object>> collect = mappingList.stream().filter(mapping -> mapping.get("factory").toString().equals(sap.getFactory())
&& mapping.get("work_center").toString().equals(sap.getWorkCenter())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(collect)) {
sap.setWorkingType(collect.get(0).get("working_type_code").toString());
}
}
newList.add(sap);
} else {
existsList.add(sap);

View File

@ -82,7 +82,7 @@
row_id, factory,work_center, `name`, type, `description`, header,
header_description, usefulness, usefulness_description, recoil, standard_code, standard_code_description,
standard_text_code, standard_text_code_description, processing_formula, processing_formula_description,
cost_controlling_area, cost_center, cost_center_description, start_time, end_time
cost_controlling_area, cost_center, cost_center_description, start_time, end_time, created_by, created_time, updated_by, updated_time, working_type
</sql>
<sql id="where_whr">
@ -111,5 +111,9 @@
from t_process_workcenter
<include refid="where_whr"/>
</select>
<select id="selectProcessWorkcenterMappingList" resultType="java.util.Map">
select * from t_process_workcenter_mapping
</select>
</mapper>