addLocationApi.java
2.35 KB
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
package com.huaheng.api.general.Controller;
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.general.location.domain.Location;
import com.huaheng.pc.general.location.service.ILocationService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 选择性批量新增库位,可选批量新增库位起始点
*/
@RestController
@RequestMapping("/api/location")
public class addLocationApi {
@Autowired
private ILocationService locationService;
/**
* 选择性批量新增保存库位
*/
@Log(title = "接口-新增库位", operating = "新增库位", action = BusinessType.INSERT)
@PostMapping("/adds")
@ResponseBody
public AjaxResult addlocations(@RequestBody Location lastLocation , Location lone) {
int startrow = lone.getRow();
int startline = lone.getLine();
int startlayer = lone.getLayer();
int startgrid = lone.getGrid();
int row = lastLocation.getRow().intValue();
int line = lastLocation.getLine().intValue();
int layer = lastLocation.getLayer().intValue();
int grid = lastLocation.getGrid().intValue();
for (int i=startrow; i<=row; i++) {
for (int j=startline; j<=line; j++) {
for (int k=startlayer; k<=layer; k++) {
for (int m=startgrid; m<=grid; m++) {
//Integer roadway = (j / 2) + 1;
Location location = new Location();
location.setRow(i);
location.setLine(j);
location.setLayer(k);
location.setGrid(m);
location.setZoneId(lastLocation.getZoneId());
location.setZoneCode(lastLocation.getZoneCode());
location.setType(lastLocation.getType());
location.setRoadway(lastLocation.getRoadway());
location.setEnable(lastLocation.getEnable());
locationService.insertLocation(location);
}
}
}
}
return AjaxResult.success("");
}
}