Crunchy
2025-06-14 b2f31607cbe26d721cd7514b619162b3e355b1aa
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
package com.wms_admin.server.service.impl;
 
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.wms_admin.server.entity.OutProduct;
import com.wms_admin.server.entity.Product;
import com.wms_admin.server.mapper.OutProductMapper;
import com.wms_admin.server.mapper.ProductMapper;
import com.wms_admin.server.service.OutProductService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
 
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
 
/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 江苏鵷雏网络科技有限公司
 * @since 2023-05-24
 */
@Service
public class OutProductServiceImpl extends ServiceImpl<OutProductMapper, OutProduct> implements OutProductService {
 
    @Resource
    private OutProductMapper mapper;
 
    @Resource
    private ProductMapper addMapper;
 
    /**
     * 分页查询出库历史数据
     * @param startTime 开始时间
     * @param endTime 结束时间
     * @param productModel 型号
     * @param page 从多少页开始查询,一共查询多少页数据
     * @return
     */
    @Override
    public IPage<OutProduct> SelectOutProductPage(String startTime, String endTime, String productModel, Page page) {
        return mapper.SelectOutProductPage(startTime, endTime, productModel, page);
    }
 
    @Override
    public void ListAddOutProduct(Integer orderInformationId, String listCode, String outPerson) {
        LambdaQueryWrapper<Product> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(Product::getId, listCode);
        Product product = addMapper.selectOne(wrapper);
        if (!ObjectUtils.isEmpty(product)){
            OutProduct outProduct = new OutProduct()
                    .setId(listCode)
                    .setOutPerson(outPerson)
                    .setAddTime(product.getCreateTime())
                    .setUnit(product.getUnit())
                    .setOutboundQuantity(product.getIncomingQuantity())
                    .setProductNameId(product.getProductNameId())
                    .setProductModelId(product.getProductModelId())
                    .setOrderInformationId(orderInformationId);
            // 插入出库表格
            mapper.insert(outProduct);
            // 删除入库表中的信息
            addMapper.deleteById(listCode);
        }
    }
 
    @Override
    public List<OutProduct> ExcelDerive(String startTime, String endTime, String productModel) {
        return mapper.SelectOutProductPage(startTime, endTime, productModel);
    }
}