| | |
| | | package org.jeecg.modules.pms.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.jeecg.modules.mes.entity.MesProductionOrder; |
| | | import org.jeecg.modules.pms.entity.PmsMaterialProcess; |
| | | import org.jeecg.modules.pms.mapper.PmsMaterialProcessMapper; |
| | | import org.jeecg.modules.pms.service.IPmsMaterialProcessService; |
| | | import org.jeecg.modules.sap.dto.OrderProcessDTO; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @Description: 物料工序 |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-07-01 |
| | | * @Date: 2025-07-01 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Service |
| | |
| | | } |
| | | return super.getBaseMapper().getpmsMaterialProcessListData(pageData, paramMap); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean saveOrUpdateOrderProcess(Map<String, MesProductionOrder> orderMap, List<OrderProcessDTO> orderProcessDTOList) { |
| | | for (Map.Entry<String, MesProductionOrder> entry : orderMap.entrySet()) { |
| | | MesProductionOrder order = entry.getValue(); |
| | | //删除原有的数据 |
| | | this.removeByOrderId(order.getId()); |
| | | //重新新增工序信息 |
| | | List<OrderProcessDTO> collect = orderProcessDTOList.stream().filter(orderProcessDTO -> entry.getKey().equals(orderProcessDTO.getAUFNR())).collect(Collectors.toList()); |
| | | if (CollectionUtil.isNotEmpty(collect)) { |
| | | List<PmsMaterialProcess> list = collect.stream().map(orderBomDTO -> new PmsMaterialProcess(order.getId(), order.getMaterialName(), orderBomDTO)).collect(Collectors.toList()); |
| | | super.saveBatch(list); |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void removeByOrderId(String orderId) { |
| | | LambdaQueryWrapper<PmsMaterialProcess> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(PmsMaterialProcess::getOrderId, orderId); |
| | | super.remove(queryWrapper); |
| | | } |
| | | } |