CZT
2023-10-30 b5a5795a5a64d9a5b78b338de74909e240fe73c3
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
package com.ld.igds.view;
 
import com.bstek.dorado.annotation.DataProvider;
import com.bstek.dorado.annotation.DataResolver;
import com.bstek.dorado.annotation.Expose;
import com.bstek.dorado.data.provider.Page;
import com.ld.igds.constant.DepotStatus;
import com.ld.igds.models.DepotStore;
import com.ld.igds.view.service.HDepotStoreService;
import org.springframework.stereotype.Component;
 
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
 
 
/**
 * @Desc: 粮库库存管理
 * @author: Andy
 * @update-time: 2022/11/17
 */
@Component
public class DepotStorePR {
 
    @Resource
    private HDepotStoreService depotStoreService;
 
    @Resource
    private DepotPR depotPR;
 
 
    /**
     * depotStorePR#pageList
     *
     * @Desc: 分页查询库存信息
     * @author: Andy
     * @update-time: 2022/11/17
     */
    @DataProvider
    public void pageList(Page<DepotStore> page, Map<String, Object> param) throws Exception {
        if (null == param) {
            param = new HashMap<>();
        }
        depotStoreService.listDepotStore(page, param);
    }
 
    /**
     * depotStorePR#saveDepotStore
     *
     * @param data
     */
    @DataResolver
    public String saveDepotStore(DepotStore data) throws Exception {
 
        //如果仓库状态=封仓/入库中/出库中
        if (DepotStatus.STATUS_2.getCode().equals(data.getDepotStatus()) ||
                DepotStatus.STATUS_3.getCode().equals(data.getDepotStatus()) ||
                DepotStatus.STATUS_4.getCode().equals(data.getDepotStatus()) ||
                DepotStatus.STATUS_31.getCode().equals(data.getDepotStatus()) ||
                DepotStatus.STATUS_32.getCode().equals(data.getDepotStatus()) ||
                DepotStatus.STATUS_33.getCode().equals(data.getDepotStatus()) ||
                DepotStatus.STATUS_34.getCode().equals(data.getDepotStatus())) {
 
            if (null == data.getFoodYear()) return "货位状态=封仓/入库中/出库中,收货年度不能为空";
 
            if (null == data.getCountry()) return "货位状态=封仓/入库中/出库中,国别不能为空";
 
            if (null == data.getFoodLocation()) return "货位状态=封仓/入库中/出库中,粮食产地不能为空";
 
            if (null == data.getFoodLocation()) return "货位状态=封仓/入库中/出库中,粮食产地不能为空";
 
            if (null == data.getStoreDate()) return "货位状态=封仓/入库中/出库中,入库时间不可为空";
        }
 
        //货位状态=封仓/出库中,必填
        if (DepotStatus.STATUS_3.getCode().equals(data.getDepotStatus()) ||
                DepotStatus.STATUS_4.getCode().equals(data.getDepotStatus()) ||
                DepotStatus.STATUS_31.getCode().equals(data.getDepotStatus()) ||
                DepotStatus.STATUS_32.getCode().equals(data.getDepotStatus()) ||
                DepotStatus.STATUS_33.getCode().equals(data.getDepotStatus()) ||
                DepotStatus.STATUS_34.getCode().equals(data.getDepotStatus())) {
 
            if (null == data.getFullDate()) return "货位状态=封仓/出库中,封仓时间不可为空";
        }
 
        //货位状态=空仓,必填。最后一车粮食出仓时间
        if (DepotStatus.STATUS_1.getCode().equals(data.getDepotStatus())) {
            if (null == data.getOutDate()) return "货位状态=空仓,出仓完成时间不可为空";
        }
 
        depotStoreService.saveDepotStore(data);
 
        //根据库存信息更新到仓库信息,仓库储粮信息以当前为准
        depotPR.updateByStore(data);
 
        //远程同步状态
        depotPR.pullDepotStatus(data.getCompanyId(), data.getDepotId(), data.getDepotStatus());
 
        return null;
    }
 
    /**
     * depotStorePR#delDepotStore
     *
     * @param data
     * @return
     */
    @Expose
    public String delDepotStore(DepotStore data) {
        return depotStoreService.delDepotStore(data);
    }
 
}