sap同步工作中心

highway
zhaoxiaolin 1 year ago
parent c5866a95c6
commit 292742f42f

@ -271,15 +271,16 @@ public class SapWorkCenterServiceImpl implements SapWorkCenterService {
for(String exsitCode:exsitCodes){ for(String exsitCode:exsitCodes){
updates = dtos.stream().filter(dto -> dto.getArbpl().equals(exsitCode)).collect(Collectors.toList()); updates = dtos.stream().filter(dto -> dto.getArbpl().equals(exsitCode)).collect(Collectors.toList());
} }
if(CollectionUtils.isEmpty(updates)){ if(!CollectionUtils.isEmpty(updates)){
int m = sapBomMapper.updateFactoryBatchs(updates); int m = sapBomMapper.updateFactoryBatchs(updates);
System.out.println("工作中心更新成功条数:"+m); System.out.println("工作中心更新成功条数:"+m);
} }
List<SapWorkCenter> adds = new ArrayList<>(); List<SapWorkCenter> adds = new ArrayList<>();
for(String noExsitCode:noExsitCodes){ for(String noExsitCode:noExsitCodes){
adds = dtos.stream().filter(dto -> dto.getArbpl().equals(noExsitCode)).collect(Collectors.toList()); List<SapWorkCenter> adds0 = dtos.stream().filter(dto -> dto.getArbpl().equals(noExsitCode)).collect(Collectors.toList());
adds.addAll(adds0);
} }
if(CollectionUtils.isEmpty(adds)){ if(!CollectionUtils.isEmpty(adds)){
//工厂parentId //工厂parentId
String parentId = sapBomMapper.getParentId(adds.get(0).getWeeks()); String parentId = sapBomMapper.getParentId(adds.get(0).getWeeks());
adds.stream().forEach(e->{ adds.stream().forEach(e->{

@ -70,7 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="getExsitCodes" resultType="java.lang.String"> <select id="getExsitCodes" resultType="java.lang.String">
select factory_code from sys_factory where factory_code in select factory_code from sys_factory where factory_code in
<foreach collection="code" item="list" open="(" separator="," close=")"> <foreach collection="list" item="code" open="(" separator="," close=")">
#{code} #{code}
</foreach> </foreach>
</select> </select>
@ -227,30 +227,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateFactoryBatchs"> <update id="updateFactoryBatchs">
<foreach collection="list" item="item" separator=";"> <foreach collection="list" item="item" separator=";">
update sys_factory update sys_factory
set factory_name = #{item.factoryName} set factory_name = #{item.ktext}
where where
factoryCode = #{item.factoryCode} factory_code = #{item.arbpl}
</foreach> </foreach>
</update> </update>
<!--批量添加工厂建模表--> <!--批量添加工厂建模表-->
<insert id="addFactoryBatchs"> <insert id="addFactoryBatchs">
insert into sys_factory insert into sys_factory
<trim prefix="(" suffix=")" suffixOverrides=","> (parent_id,factory_name,factory_code,
<if test="item.parentId != null">parent_id,</if>
<if test="item.factoryName != null">factory_name,</if>
<if test="item.factoryCode != null">factory_code,</if>
create_by, create_by,
<if test="item.createTime != null">create_time,</if> create_time,
<if test="item.updateTime != null">update_time,</if> update_time)
</trim>
VALUES VALUES
<foreach collection="list" index="index" item="item" separator=","> <foreach collection="list" index="index" item="item" separator=",">
<if test="item.parentId != null">#{item.parentId},</if> (#{item.parentId},#{item.ktext},#{item.arbpl},
<if test="item.factoryName != null">#{item.factoryName},</if>
<if test="item.factoryCode != null">#{item.factoryCode},</if>
'job', 'job',
<if test="item.createTime != null">#{item.aedat_grnd},</if> #{item.aedat_grnd},
<if test="item.updateTime != null">#{item.aedat_grnd},</if> #{item.aedat_grnd})
</foreach> </foreach>
</insert> </insert>
<delete id="deleteBaseBomByFactoryCode" parameterType="String"> <delete id="deleteBaseBomByFactoryCode" parameterType="String">

Loading…
Cancel
Save