|
|
|
@ -1,6 +1,8 @@
|
|
|
|
|
package org.dromara.mes.service.impl;
|
|
|
|
|
|
|
|
|
|
import org.dromara.common.constant.DatabaseConstants;
|
|
|
|
|
import org.dromara.common.core.exception.ServiceException;
|
|
|
|
|
import org.dromara.common.core.utils.DateUtils;
|
|
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
|
|
import org.dromara.common.core.utils.uuid.Seq;
|
|
|
|
@ -11,16 +13,19 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.github.yulichang.toolkit.JoinWrappers;
|
|
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.dromara.common.satoken.utils.LoginHelper;
|
|
|
|
|
import org.dromara.mes.domain.vo.MesProductPlanEditVo;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.dromara.mes.domain.bo.ProdPlanInfoBo;
|
|
|
|
|
import org.dromara.mes.domain.vo.ProdPlanInfoVo;
|
|
|
|
|
import org.dromara.mes.domain.ProdPlanInfo;
|
|
|
|
|
import org.dromara.mes.mapper.ProdPlanInfoMapper;
|
|
|
|
|
import org.dromara.mes.service.IProdPlanInfoService;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Collection;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生产工单信息Service业务层处理
|
|
|
|
@ -198,4 +203,53 @@ public class ProdPlanInfoServiceImpl implements IProdPlanInfoService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生产工单新增生产派工List
|
|
|
|
|
*
|
|
|
|
|
* @param mesProductPlanEditVo 生产派工VO对象
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public int orderAddMesProductPlanList(MesProductPlanEditVo mesProductPlanEditVo) {
|
|
|
|
|
List<ProdPlanInfoBo> prodPlanInfoList = new ArrayList<>();
|
|
|
|
|
/* Long userId = LoginHelper.getUserId(); // 获取当前用户ID
|
|
|
|
|
Long deptId = LoginHelper.getDeptId(); // 获取当前部门ID*/
|
|
|
|
|
|
|
|
|
|
List<ProdPlanInfoBo> mesProductPlanList = mesProductPlanEditVo.getMesProductPlanList();
|
|
|
|
|
if (!ObjectUtils.isEmpty(mesProductPlanList)) {
|
|
|
|
|
for (ProdPlanInfoBo mesProductPlanBo : mesProductPlanList) {
|
|
|
|
|
/* mesProductPlanBo.setCreateBy(userId);*/
|
|
|
|
|
// mesProductPlanBo.setCreateTime(DateUtils.getNowDate());
|
|
|
|
|
mesProductPlanBo.setPlanCode(Seq.getId(Seq.mesPlanCodeSeqType, Seq.mesPlanCodeCode));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
prodPlanInfoList.add(mesProductPlanBo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (prodPlanInfoList.isEmpty()) {
|
|
|
|
|
throw new ServiceException("无有效的派工数据提交");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int successCount = 0;
|
|
|
|
|
for (ProdPlanInfoBo mesProductPlanBo : prodPlanInfoList) {
|
|
|
|
|
String planCode = Seq.getId(Seq.mesPlanCodeSeqType, Seq.mesPlanCodeCode);
|
|
|
|
|
mesProductPlanBo.setPlanCode(planCode);
|
|
|
|
|
ProdPlanInfo add = MapstructUtils.convert(mesProductPlanBo, ProdPlanInfo.class);
|
|
|
|
|
validEntityBeforeSave(add);
|
|
|
|
|
//TODO:后期需调用insertByBo,会分表插入
|
|
|
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
|
|
|
if (flag) {
|
|
|
|
|
mesProductPlanBo.setPlanId(add.getPlanId());
|
|
|
|
|
successCount++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (successCount == 0) {
|
|
|
|
|
throw new ServiceException("派工数据保存失败");
|
|
|
|
|
}
|
|
|
|
|
return successCount;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|