自动化立体仓库 - WMS系统
#
1
5 天以前 b4d9cf3a9974d9abac40ecd228820e5e854b080a
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
package com.zy.asrs.service.impl;
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.core.common.Cools;
import com.core.exception.CoolException;
import com.zy.asrs.entity.OrderDetlPakin;
import com.zy.asrs.mapper.OrderDetlMapper;
import com.zy.asrs.entity.OrderDetl;
import com.zy.asrs.service.OrderDetlPakinService;
import com.zy.asrs.service.OrderDetlService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
@Service("orderDetlService")
public class OrderDetlServiceImpl extends ServiceImpl<OrderDetlMapper, OrderDetl> implements OrderDetlService {
    @Autowired
    private OrderDetlService orderDetlService;
    @Override
    public List<OrderDetl> selectByOrderId(Long orderId) {
        return this.selectList(new EntityWrapper<OrderDetl>().eq("order_id", orderId));
    }
 
    @Override
    public Page<OrderDetl> getPakoutPage(Page<OrderDetl> page) {
        page.setRecords(baseMapper.getPakoutPage(page.getCondition()));
        page.setTotal(baseMapper.getPakoutPageCount(page.getCondition()));
        return page;
    }
 
    @Override
    public OrderDetl selectItem(Long orderId, String matnr, String batch, String brand, String standby1, String standby2, String standby3, String boxType1, String boxType2, String boxType3) {
        return this.baseMapper.selectItem(orderId, matnr, batch,brand,standby1,standby2,standby3,boxType1,boxType2,boxType3);
    }
 
    @Override
    public OrderDetl selectItem(String orderNo, String matnr, String batch, String brand, String standby1, String standby2, String standby3, String boxType1, String boxType2, String boxType3) {
        return this.baseMapper.selectItemByOrderNo(orderNo, matnr, batch,brand,standby1,standby2,standby3,boxType1,boxType2,boxType3);
    }
 
    @Override
    public OrderDetl findByLook(List<OrderDetl> orderDetls, Long orderId, String matnr, String batch, String brand, String standby1, String standby2, String standby3, String boxType1, String boxType2, String boxType3) {
        for (OrderDetl orderDetl : orderDetls) {
            if (orderDetl.getOrderId().equals(orderId) && orderDetl.getMatnr().equals(matnr)
                    && orderDetl.getBrand().equals(brand)
                    && orderDetl.getStandby1().equals(standby1)  && orderDetl.getStandby2().equals(standby2)  && orderDetl.getStandby3().equals(standby3)
                    && orderDetl.getBoxType1().equals(boxType1)  && orderDetl.getBoxType2().equals(boxType2)  && orderDetl.getBoxType3().equals(boxType3)
            ) {
                if (Cools.eq(batch, orderDetl.getBatch())) {
                    return orderDetl;
                }
            }
        }
        return null;
    }
 
    @Override
    public boolean increase(Long orderId, String matnr, String batch, String brand, String standby1, String standby2, String standby3, String boxType1, String boxType2, String boxType3, Double qty) {
        return this.baseMapper.increase(orderId, matnr, batch,brand,standby1,standby2,standby3,boxType1,boxType2,boxType3, qty) > 0;
    }
 
    @Override
    public boolean decrease(String orderNo, String matnr, String batch, String brand, String standby1, String standby2, String standby3, String boxType1, String boxType2, String boxType3, Double qty) {
        int decrease = this.baseMapper.decrease(orderNo, matnr, batch,brand,standby1,standby2,standby3,boxType1,boxType2,boxType3, qty);
        if (decrease == 0) {
            return this.baseMapper.decrease(orderNo, matnr, "",brand,standby1,standby2,standby3,boxType1,boxType2,boxType3, qty) > 0;
        } else {
            return true;
        }
    }
 
    @Override
    public boolean modifyStatus(Long orderId, Integer status) {
        return this.baseMapper.modifyStatus(orderId, status) > 0;
    }
 
    @Override
    public boolean addToLogTable(OrderDetl orderDetl) {
        return this.baseMapper.addToLogTable(orderDetl) > 0;
    }
 
    @Override
    public boolean increaseQtyByOrderNo(String orderNo, String matnr, String batch, String brand, String standby1, String standby2, String standby3, String boxType1, String boxType2, String boxType3, Double qty) {
        return this.baseMapper.increaseQtyByOrderNo(orderNo, matnr, batch,brand,standby1,standby2,standby3,boxType1,boxType2,boxType3, qty) > 0;
    }
 
    /**
     * 入出库任务生成时,更新单据表中作业数量
     * @param orderId
     * @param matnr
     * @param batch
     * @param workQty
     * @return
     */
    @Override
    public boolean increaseWorkQty(Long orderId, String matnr, String batch, String brand, String standby1, String standby2, String standby3, String boxType1, String boxType2, String boxType3, Double workQty) {
        return this.baseMapper.increaseWorkQty(orderId, matnr, batch,brand,standby1,standby2,standby3,boxType1,boxType2,boxType3, workQty) > 0;
    }
 
    @Override
    public List<OrderDetl> selectByOrderNo(String orderNo) {
        return this.baseMapper.selectByOrderNo(orderNo);
    }
    @Override
    public boolean morpt(String orderNo,String orderNo1){
        List<OrderDetl> list1 = orderDetlService.selectList(new EntityWrapper<OrderDetl>().eq("order_no",orderNo1));
        try{
            for (OrderDetl item : list1) {
                Double anfme = item.getAnfme();
                Double qty = item.getQty();
                String matnr = item.getMatnr();
                if(anfme.equals(qty)){
                    OrderDetl orderDetl = orderDetlService.selectOne(
                            new EntityWrapper<OrderDetl>().eq("matnr", matnr).eq("order_no", orderNo)
                    );
                    this.baseMapper.morpt(orderNo,matnr);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
            throw new CoolException("汇报单转换失败:" + e.getMessage());
        }
        return true;
    }
}