zhangfeng
2022-11-25 f600f38c6c23a282b61ed4db1b2da094d695276f
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
package com.gkhy.safePlatform.equipment.controller;
 
import com.alibaba.fastjson.JSONObject;
import com.gkhy.safePlatform.commons.enums.ResultCodes;
import com.gkhy.safePlatform.commons.query.PageQuery;
import com.gkhy.safePlatform.commons.vo.ResultVO;
import com.gkhy.safePlatform.commons.vo.SearchResultVO;
import com.gkhy.safePlatform.equipment.model.dto.req.*;
import com.gkhy.safePlatform.equipment.model.dto.resp.SafeMaterialDetailDto;
import com.gkhy.safePlatform.equipment.service.SafeMaterialDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.List;
 
@RestController
@RequestMapping(value = "/equipment/smDetail")
public class SafeMaterialDetailController {
    @Autowired
    private SafeMaterialDetailService safeMaterialDetailService;
    /**
     * 新增入库
     * @param authentication
     * @return
     */
    @PostMapping(value = "/save")
    public ResultVO save(Authentication authentication,@Validated @RequestBody SafeMaterialDetailAddReq req){
        return safeMaterialDetailService.save(req);
    }
    /**
     * 批量入库
     */
    @PostMapping(value = "/saveBatch")
    public ResultVO saveBatch(Authentication authentication,@Validated @RequestBody SafeMaterialDetailAddReq req){
        return safeMaterialDetailService.saveBatch(req);
    }
    /**
     * 编辑
     */
    @PostMapping(value = "/update")
    public ResultVO update(Authentication authentication,@Validated @RequestBody SafeMaterialDetailReq req){
        return safeMaterialDetailService.update(req);
    }
    /**
     * 单独出入库
     * @param authentication
     * @return
     */
    @PostMapping(value = "/single/delivery0rReceipt")
    public ResultVO singleDdelivery0rReceipt(Authentication authentication, @Validated @RequestBody SafeMaterialDetailReq req){
        return safeMaterialDetailService.singleDdelivery0rReceipt(req);
    }
 
    /**
     * 单独出库
     * @param authentication
     * @return
     */
    @PostMapping(value = "/single/delivery")
    public ResultVO singleDelivery(Authentication authentication, @Validated @RequestBody SafeMaterialDetailReq req){
        return safeMaterialDetailService.singleDelivery(req);
    }
 
    /**
     * 单独入库
     * @param authentication
     * @return
     */
    @PostMapping(value = "/single/receipt")
    public ResultVO singleReceipt(Authentication authentication,@RequestBody JSONObject jsonObject){
        Long id = jsonObject.getLong("id");
        return safeMaterialDetailService.singleReceipt(id);
    }
    /**
     * 批量出库 - 根据ids
     * @param authentication
     * @return
     */
    @PostMapping(value = "/batch/delivery/ids")
    public ResultVO deliveryBatchByIds(Authentication authentication, @Validated @RequestBody MterialDeliveryReq req){
 
        return safeMaterialDetailService.deliveryBatchByIds(req);
    }
    /**
     * 批量出库
     * @param authentication
     * @return
     */
    @PostMapping(value = "/batch/delivery/random")
    public ResultVO deliveryBatchRandom(Authentication authentication,@Validated @RequestBody MterialRandomDeliveryReq req){
        return safeMaterialDetailService.deliveryBatchRandom(req);
    }
 
    /**
     * 批量重新入库
     */
    @PostMapping(value = "/batch/receipt")
    public ResultVO receiptBatch(Authentication authentication ,@Validated @RequestBody ParamForm paramForm){
        return safeMaterialDetailService.receiptBatch(paramForm);
    }
    /**
     * 删除-单条
     * @param authentication
     * @return
     */
    @PostMapping(value = "/delete")
    public ResultVO delete(Authentication authentication, @RequestBody JSONObject jsonObject){
        Long id = jsonObject.getLong("id");
        return safeMaterialDetailService.delete(id);
    }
 
    /**
     * 批量删除
     * @param authentication
     * @return
     */
    @PostMapping(value = "/deleteBatch")
    public ResultVO deleteBatch(Authentication authentication,@Validated @RequestBody ParamForm paramForm){
        return safeMaterialDetailService.deleteBatch(paramForm);
    }
 
 
    /**
     * 分页查询
     * @param authentication
     * @return
     */
    @PostMapping(value = "/page/list")
    public SearchResultVO<List<SafeMaterialDetailDto>> listByPage(Authentication authentication, @RequestBody PageQuery<SafeMatetrialDetailQuery> pageQuery){
        return safeMaterialDetailService.listByPage(pageQuery);
    }
 
    /**
     * 查询单条数据
     * @param authentication
     * @return
     */
    @PostMapping(value = "/queryById")
    public ResultVO queryById(Authentication authentication,@RequestBody JSONObject jsonObject){
        Long id = jsonObject.getLong("id");
        return safeMaterialDetailService.queryById(id);
    }
    /**
     * 特殊作业批量出库接口
     * @param authentication
     * @return
     */
    @PostMapping(value = "/deliveryBatchSpw")
    public ResultVO deliveryBatchSpw(Authentication authentication, @Validated @RequestBody MaterialSpwReq req){
        safeMaterialDetailService.deliveryBatchSpw(req);
        return new ResultVO<>(ResultCodes.OK);
    }
 /*   *//**
     * 根据rfid获去数据
     * @param authentication
     * @return
     *//*
    @PostMapping(value = "/rfid/list")
    public ResultVO getListByRfid(Authentication authentication, @RequestBody String[] rfids){
        return new ResultVO(ResultCodes.OK,safeMaterialDetailService.getListByRfids(rfids));
    }*/
}