Blame view

src/main/java/com/huaheng/pc/receipt/AgvReceiving/controller/AgvReceivingController.java 8.47 KB
周鸿 authored
1
2
3
4
5
6
7
8
9
10
11
12
13
14
package com.huaheng.pc.receipt.AgvReceiving.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.huaheng.api.acs.service.AcsService;
import com.huaheng.common.utils.Wrappers;
import com.huaheng.common.utils.security.ShiroUtils;
import com.huaheng.framework.aspectj.lang.annotation.Log;
import com.huaheng.framework.aspectj.lang.constant.BusinessType;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.pc.config.location.domain.Location;
import com.huaheng.pc.config.location.service.LocationService;
import com.huaheng.pc.config.points.domain.Points;
import com.huaheng.pc.config.points.service.PointsService;
周鸿 authored
15
import com.huaheng.pc.config.station.domain.AgvStation;
周鸿 authored
16
import com.huaheng.pc.config.station.domain.Station;
周鸿 authored
17
import com.huaheng.pc.config.station.service.AgvStationService;
周鸿 authored
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
import com.huaheng.pc.config.station.service.StationService;
import com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerView;
import com.huaheng.pc.receipt.receiptContainerHeader.service.ReceiptContainerHeaderAGVService;
import com.huaheng.pc.receipt.receiptDetail.service.ReceiptDetailService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/receipt/AgvReceiving")
public class AgvReceivingController {

    private String prefix = "receipt/AgvReceiving";

    @Autowired
    private ReceiptContainerHeaderAGVService receiptContainerHeaderAGVService;
    @Autowired
    private AcsService acsService;
    @Resource
    private PointsService pointsService;
    @Autowired
    private LocationService locationService;
    @Autowired
    private ReceiptDetailService receiptDetailService;
周鸿 authored
50
51
    /*@Autowired
    private StationService stationService;*/
周鸿 authored
52
    @Autowired
周鸿 authored
53
    private AgvStationService agvStationService;
周鸿 authored
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
168
169
170
171
172
173
174
175
176
177
178

    @RequiresPermissions("receipt:AgvReceiving:view")
    @GetMapping()
    public String locationStatus()
    {
        return prefix + "/AgvReceiving";
    }

    /**
     * 获取订单明细
     */
    @ResponseBody
    @PostMapping("/scanBill")
    @RequiresPermissions("receipt:AgvReceiving:list")
    @Log(title = "入库-入库单", operating ="PC端扫描收货单号", action = BusinessType.OTHER)
    public AjaxResult scanBill(String code)  {
        AjaxResult result = receiptContainerHeaderAGVService.scanAGVReceipt(code);
        return result;
    }

    /**
     * 获取收货信息
     */
    @ResponseBody
    @PostMapping("/getReceiptInfoByBill")
    @RequiresPermissions("receipt:AgvReceiving:select")
    @Log(title = "入库-入库单", operating ="获取收货信息", action = BusinessType.OTHER)
    public AjaxResult getReceiptInfoByBill(String code)  {
        AjaxResult result = receiptContainerHeaderAGVService.getAGVReceiptInfoByBill(code);
        return result;
    }

    /**
     * 收货
     */
    @ResponseBody
    @PostMapping("/addBill")
    @RequiresPermissions("receipt:AgvReceiving:add")
    @Log(title = "入库-入库单", operating ="PC端扫描收货单号", action = BusinessType.OTHER)
    public AjaxResult addBill(ReceiptContainerView record)  {
        AjaxResult result = receiptContainerHeaderAGVService.save(record);
        return result;
    }



    @GetMapping("/remove")
    public String locationStatu()
    {
        return prefix + "/remove";
    }

    /**
     * AGV 任务取消
     */
    @RequiresPermissions("receipt:AgvReceiving:remove")
    @Log(title = "AGV 任务取消", action = BusinessType.DELETE)
    @PostMapping("/TaskCancel")
    @ResponseBody
    public AjaxResult TaskCancel(String message)
    {
        return acsService.taskCancel(message);
    }


    @GetMapping("/edit")
    public String locationStat()
    {
        return prefix + "/edit";
    }

    /**
     * AGV 旋转方向
     */
    @RequiresPermissions("receipt:AgvReceiving:edit")
    @Log(title = "AGV 旋转方向", action = BusinessType.UPDATE)
    @PostMapping("/TurnOriention")
    @ResponseBody
    public AjaxResult TurnOriention(String carNo,String orientation)
    {
        return acsService.TurnOriention(carNo, orientation);
    }


    /**
     * 货架列表
     */
    @RequiresPermissions("receipt:AgvReceiving:goodsShelfNo")
    @Log(title = "AGV 货架", action = BusinessType.UPDATE)
    @PostMapping("/goodsShelfNo")
    @ResponseBody
    public List<Map<String, Object>> goodsShelfNo()
    {
        String warehouseCode= ShiroUtils.getWarehouseCode();
        return pointsService.selectShlfno(warehouseCode);
    }


    /**
     *  手动叫车
     */
    @RequiresPermissions("receipt:AgvReceiving:add")
    @Log(title = "AGV 任务下发", action = BusinessType.OTHER)
    @PostMapping("/ManualCalling")
    @ResponseBody
    public AjaxResult ManualCalling(String station,String shelfNo)
    {
        return acsService.ManualCalling(station,shelfNo);
    }



    @GetMapping("/AgvOperate")
    public String AgvOperate()
    {
        return prefix + "/AgvOperate";
    }


    @Log(title = "AGV 任务下发", action = BusinessType.OTHER)
    @PostMapping("/getStation")
    @ResponseBody
    public AjaxResult GetStation()
    {
        String warehouseCode=ShiroUtils.getWarehouseCode();
周鸿 authored
179
180
181
        LambdaQueryWrapper<AgvStation> lamb = Wrappers.lambdaQuery();
        lamb.eq(AgvStation::getWarehouseCode,warehouseCode);
        List<AgvStation> list=agvStationService.list(lamb);
周鸿 authored
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
        return AjaxResult.success(list);
    }

    /**
     *  1站台
     */
    @RequiresPermissions("receipt:AgvReceiving:add")
    @Log(title = "AGV 任务下发", action = BusinessType.OTHER)
    @PostMapping("/TaskAssigns")
    @ResponseBody
    public AjaxResult TaskAssignOne(Integer id ,String containerCode,String taskType,String row,String line,String station)
    {
        AjaxResult ajaxResult=new AjaxResult();
        if(taskType.equals("1")) {
//            ajaxResult=acsService.TaskAssigns(id, containerCode, station,row,line);
        }else if(taskType.equals("0")){
            ajaxResult=acsService.TaskModel(station,id);
        }
        return ajaxResult;
    }

//    /**
//     *  2站台
//     */
//    @RequiresPermissions("receipt:AgvReceiving:add")
//    @Log(title = "AGV 任务下发", action = BusinessType.OTHER)
//    @PostMapping("/TaskAssignsTwo")
//    @ResponseBody
//    public AjaxResult TaskAssignsTwo(String code,String containerCode,String taskType,String row,String line)
//    {
//        AjaxResult ajaxResult=new AjaxResult();
//        String station="ws02";
//        if(taskType.equals("1")) {
//            ajaxResult=acsService.TaskAssigns(code, containerCode,station,row,line);
//        }else if(taskType.equals("0")){
//            ajaxResult=acsService.Task(code,station);
//        }
//        return ajaxResult;
//    }

    /**
     *  x,Y
     */
    @RequiresPermissions("receipt:AgvReceiving:add")
    @Log(title = "AGV 回库", action = BusinessType.OTHER)
    @PostMapping("/address")
    @ResponseBody
    public AjaxResult<Location> Address()
    {
        Location location=new Location();
        location.setWarehouseCode(ShiroUtils.getWarehouseCode());
        location=locationService.selectAddress(location);
        return AjaxResult.success(location);
    }

    /**
     *  获得已出货架的位置
     */
    @RequiresPermissions("receipt:AgvReceiving:goodsShelfNo")
    @Log(title = "AGV 回库", action = BusinessType.OTHER)
    @PostMapping("/EmptyAddress")
    @ResponseBody
    public AjaxResult EmptyAddress()
    {
        List<Location> list=locationService.selectEmptyAddress();
        return AjaxResult.success(list);
    }


    /**
     * 获取当前货架要完成的单据
     *
     */
    @ResponseBody
    @PostMapping("/getGoodsShelfNo")
    @RequiresPermissions("receipt:AgvReceiving:list")
    @Log(title = "入库-入库单", operating ="货架显示单据", action = BusinessType.OTHER)
    public List<Map<String, Object>> GetGoodShelfNo(String code,String goodsShelfNo){
        List<Map<String, Object>> AjaxResult = receiptDetailService.selectList(code,goodsShelfNo);
        return  AjaxResult;
    }

    @GetMapping("/AGVconfirm")
    public String AGVconfirm()
    {
        return prefix + "/AGVconfirm";
    }
}