hdy
2025-03-12 f0d048fa2cba4f52066e14d1d31e4f7a2c7a9530
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
package com.billion.main.bs.service.impl;
 
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.billion.common.exception.ServiceException;
import com.billion.common.utils.StringUtils;
import com.billion.common.utils.bean.BeanValidators;
import com.billion.main.bs.domain.BsBomChildInfo;
import com.billion.main.bs.mapper.BsBomChildInfoMapper;
import com.billion.main.bs.service.IBsBomChildInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import javax.validation.Validator;
import java.util.List;
 
/**
 * 基础BOM子信息Service业务层处理
 * 
 * @author HDY
 * @date 2024-11-25
 */
@Service
public class BsBomChildInfoServiceImpl extends ServiceImpl<BsBomChildInfoMapper, BsBomChildInfo> implements IBsBomChildInfoService
{
    @Autowired
    protected Validator validator;
 
    @Autowired
    private IBsBomChildInfoService bsBomChildInfoService;
 
    @Override
    public String importBomChild(List<BsBomChildInfo> bomChildList, Boolean isUpdateSupport, String operName)
    {
        if (StringUtils.isNull(bomChildList) || bomChildList.size() == 0)
        {
            throw new ServiceException("导入数据不能为空!");
        }
        StringBuilder successMsg = new StringBuilder();
        for (BsBomChildInfo list : bomChildList)
        {
            try
            {
                BeanValidators.validateWithException(validator, list);
                BsBomChildInfo bsBomChildInfo = new BsBomChildInfo();
                bsBomChildInfo.setProductCode(list.getProductCode());
                bsBomChildInfo.setProductName(list.getProductName());
                bsBomChildInfo.setLocationCode(list.getLocationCode());
                bsBomChildInfo.setLocationName(list.getLocationName());
                bsBomChildInfo.setMaterialCode(list.getMaterialCode());
                bsBomChildInfo.setMaterialName(list.getMaterialName());
                bsBomChildInfo.setCostQty(list.getCostQty());
                bsBomChildInfo.setBomCode(list.getBomCode());
                bsBomChildInfoService.insertBsBomChildInfo(bsBomChildInfo);
                successMsg.append( " 更新成功");
            }
            catch (Exception e)
            {
                String msg =  " 导入失败";
                log.error(msg, e);
            }
        }
        return successMsg.toString();
    }
 
 
 
    @Autowired
    private BsBomChildInfoMapper bsBomChildInfoMapper;
 
    /**
     * 查询基础BOM子信息
     * 
     * @param id 基础BOM子信息主键
     * @return 基础BOM子信息
     */
    @Override
    public BsBomChildInfo selectBsBomChildInfoById(Long id)
    {
        return bsBomChildInfoMapper.selectBsBomChildInfoById(id);
    }
 
    /**
     * 查询基础BOM子信息列表
     * 
     * @param bsBomChildInfo 基础BOM子信息
     * @return 基础BOM子信息
     */
    @Override
    public List<BsBomChildInfo> selectBsBomChildInfoList(BsBomChildInfo bsBomChildInfo)
    {
        return bsBomChildInfoMapper.selectBsBomChildInfoList(bsBomChildInfo);
    }
 
    /**
     * 新增基础BOM子信息
     * 
     * @param bsBomChildInfo 基础BOM子信息
     * @return 结果
     */
    @Override
    public int insertBsBomChildInfo(BsBomChildInfo bsBomChildInfo)
    {
        return bsBomChildInfoMapper.insertBsBomChildInfo(bsBomChildInfo);
    }
 
    /**
     * 修改基础BOM子信息
     * 
     * @param bsBomChildInfo 基础BOM子信息
     * @return 结果
     */
    @Override
    public int updateBsBomChildInfo(BsBomChildInfo bsBomChildInfo)
    {
        return bsBomChildInfoMapper.updateBsBomChildInfo(bsBomChildInfo);
    }
 
    /**
     * 批量删除基础BOM子信息
     * 
     * @param ids 需要删除的基础BOM子信息主键
     * @return 结果
     */
    @Override
    public int deleteBsBomChildInfoByIds(Long[] ids)
    {
        return bsBomChildInfoMapper.deleteBsBomChildInfoByIds(ids);
    }
 
    /**
     * 删除基础BOM子信息信息
     * 
     * @param id 基础BOM子信息主键
     * @return 结果
     */
    @Override
    public int deleteBsBomChildInfoById(Long id)
    {
        return bsBomChildInfoMapper.deleteBsBomChildInfoById(id);
    }
 
    @Override
    public void insertBatch(List<BsBomChildInfo> confList) {
 
    }
}