【工作中心】虚拟工作中心对应关系
This commit is contained in:
parent
b4adf9bc45
commit
e13ec1cbda
|
|
@ -9,6 +9,7 @@ import com.nflg.product.technology.pojo.vo.ProcessWorkCenterVO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
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);
|
int insertOrUpdateBatch(@Param("entities") List<ProcessWorkCenterEntity> entities);
|
||||||
|
|
||||||
IPage<ProcessWorkCenterVO> selectPageByCondition(Page<ProcessWorkCenterEntity> page, @Param("query") ProcessWorkCenterQuery query);
|
IPage<ProcessWorkCenterVO> selectPageByCondition(Page<ProcessWorkCenterEntity> page, @Param("query") ProcessWorkCenterQuery query);
|
||||||
|
|
||||||
|
List<Map<String, Object>> selectProcessWorkcenterMappingList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,18 +84,18 @@ public class ProcessWorkCenterVO implements Serializable {
|
||||||
private Date endTime;
|
private Date endTime;
|
||||||
|
|
||||||
//创建人
|
//创建人
|
||||||
private String createBy;
|
private String createdBy;
|
||||||
|
|
||||||
//创建时间
|
//创建时间
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT-8")
|
@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")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT-8")
|
||||||
private Date updateTime;
|
private Date updatedTime;
|
||||||
|
|
||||||
// 虚拟工作中心
|
// 虚拟工作中心
|
||||||
private String workingType;
|
private String workingType;
|
||||||
|
|
|
||||||
|
|
@ -117,12 +117,21 @@ public class ProcessWorkCenterService extends ServiceImpl<ProcessWorkCenterMappe
|
||||||
List<ProcessWorkCenterEntity> newList = new ArrayList<>();
|
List<ProcessWorkCenterEntity> newList = new ArrayList<>();
|
||||||
// 数据库已有的SAP数据
|
// 数据库已有的SAP数据
|
||||||
List<ProcessWorkCenterEntity> existsList = new ArrayList<>();
|
List<ProcessWorkCenterEntity> existsList = new ArrayList<>();
|
||||||
|
// 对应关系
|
||||||
|
List<Map<String, Object>> mappingList = processWorkCenterMapper.selectProcessWorkcenterMappingList();
|
||||||
for (ProcessWorkCenterEntity sap : sapList) {
|
for (ProcessWorkCenterEntity sap : sapList) {
|
||||||
if (!workCenterSet.contains(sap.getFactory() + "_" + sap.getWorkCenter())) {
|
if (!workCenterSet.contains(sap.getFactory() + "_" + sap.getWorkCenter())) {
|
||||||
sap.setRowId(IdWorker.getId());
|
sap.setRowId(IdWorker.getId());
|
||||||
sap.setCreatedBy(SessionUtil.getUserName());
|
sap.setCreatedBy(SessionUtil.getUserName());
|
||||||
sap.setCreatedTime(new Date());
|
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);
|
newList.add(sap);
|
||||||
} else {
|
} else {
|
||||||
existsList.add(sap);
|
existsList.add(sap);
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@
|
||||||
row_id, factory,work_center, `name`, type, `description`, header,
|
row_id, factory,work_center, `name`, type, `description`, header,
|
||||||
header_description, usefulness, usefulness_description, recoil, standard_code, standard_code_description,
|
header_description, usefulness, usefulness_description, recoil, standard_code, standard_code_description,
|
||||||
standard_text_code, standard_text_code_description, processing_formula, processing_formula_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>
|
||||||
|
|
||||||
<sql id="where_whr">
|
<sql id="where_whr">
|
||||||
|
|
@ -111,5 +111,9 @@
|
||||||
from t_process_workcenter
|
from t_process_workcenter
|
||||||
<include refid="where_whr"/>
|
<include refid="where_whr"/>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectProcessWorkcenterMappingList" resultType="java.util.Map">
|
||||||
|
select * from t_process_workcenter_mapping
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue