Commit 5b0d123281e8917dc17cbc6e0506ef2c075daf83
Merge branch 'develop' of http://172.16.29.40:8010/wms/wms2 into develop
Showing
10 changed files
with
90 additions
and
43 deletions
src/main/java/com/huaheng/pc/config/location/controller/LocationController.java
... | ... | @@ -72,9 +72,10 @@ public class LocationController extends BaseController { |
72 | 72 | .eq(StringUtils.isNotNull(location.getIColumn()), Location::getIColumn, location.getIColumn()) |
73 | 73 | .eq(StringUtils.isNotNull(location.getIGrid()), Location::getIGrid, location.getIGrid()) |
74 | 74 | .eq(StringUtils.isNotNull(location.getILayer()), Location::getILayer, location.getILayer()) |
75 | + .eq(StringUtils.isNotEmpty(location.getStatus()),Location::getStatus,location.getStatus()) | |
75 | 76 | .eq(StringUtils.isNotEmpty(location.getLocationType()), Location::getLocationType, location.getLocationType()) |
76 | 77 | .eq(Location::getDeleted,false) |
77 | - .orderByDesc(Location::getCreated); | |
78 | + .orderByDesc(Location::getId); | |
78 | 79 | |
79 | 80 | if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){ |
80 | 81 | /*使用分页查询*/ |
... | ... | @@ -104,8 +105,8 @@ public class LocationController extends BaseController { |
104 | 105 | @PostMapping("/add") |
105 | 106 | @ResponseBody |
106 | 107 | public AjaxResult addSave(Location location) { |
107 | - Boolean result = locationService.save(location); | |
108 | - return toAjax(result); | |
108 | + AjaxResult result = locationService.addsave(location); | |
109 | + return result; | |
109 | 110 | } |
110 | 111 | |
111 | 112 | |
... | ... |
src/main/java/com/huaheng/pc/config/location/service/LocationService.java
1 | 1 | package com.huaheng.pc.config.location.service; |
2 | 2 | |
3 | +import com.huaheng.framework.web.domain.AjaxResult; | |
3 | 4 | import com.huaheng.pc.config.location.domain.Location; |
4 | 5 | import com.baomidou.mybatisplus.extension.service.IService; |
5 | 6 | public interface LocationService extends IService<Location>{ |
6 | 7 | |
8 | + AjaxResult addsave(Location location); | |
9 | + | |
7 | 10 | boolean insertLocation(Location location); |
8 | 11 | |
9 | 12 | void updateStatus(String locationCode, String status); |
... | ... |
src/main/java/com/huaheng/pc/config/location/service/LocationServiceImpl.java
... | ... | @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
6 | 6 | import com.huaheng.common.exception.service.ServiceException; |
7 | 7 | import com.huaheng.common.utils.StringUtils; |
8 | 8 | import com.huaheng.common.utils.security.ShiroUtils; |
9 | +import com.huaheng.framework.web.domain.AjaxResult; | |
9 | 10 | import com.huaheng.pc.config.locationType.domain.LocationType; |
10 | 11 | import com.huaheng.pc.config.locationType.service.LocationTypeService; |
11 | 12 | import com.huaheng.pc.config.zone.domain.Zone; |
... | ... | @@ -33,6 +34,44 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i |
33 | 34 | @Resource |
34 | 35 | private LocationMapper locationMapper; |
35 | 36 | |
37 | + | |
38 | + //新增库位,需要建立code,并判断是否重复 | |
39 | + @Override | |
40 | + public AjaxResult addsave(Location location){ | |
41 | + | |
42 | + //库区与库位类型的匹配判断 | |
43 | + if(!location.getZoneCode().equals(location.getLocationType())){ | |
44 | + throw new ServiceException(location.getLocationType()+"的库位类型与"+location.getZoneCode()+"库区不匹配"); | |
45 | + } | |
46 | + | |
47 | + //创建库位编码code | |
48 | + String prefix = location.getLocationType().substring(1); | |
49 | + String code = MessageFormat.format("{0}{1}-{2}-{3}-{4}", | |
50 | + prefix, | |
51 | + String.format("%02d", location.getIRow()), | |
52 | + String.format("%02d", location.getIColumn()), | |
53 | + String.format("%02d", location.getILayer()), | |
54 | + String.format("%02d", location.getIGrid())); | |
55 | + | |
56 | + | |
57 | + //判断code是否重复 | |
58 | + LambdaQueryWrapper<Location> lam = Wrappers.lambdaQuery(); | |
59 | + lam.eq(Location::getWarehouseCode,ShiroUtils.getWarehouseCode()) | |
60 | + .eq(Location::getCode,code); | |
61 | + if(this.getOne(lam)!=null){ | |
62 | + return AjaxResult.error("该位置已有库位生成,请重新输入位置"); | |
63 | + } | |
64 | + | |
65 | + //插入数据库 | |
66 | + location.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
67 | + location.setCreatedBy(ShiroUtils.getLoginName()); | |
68 | + Boolean flag=this.save(location); | |
69 | + if(flag == false){ | |
70 | + return AjaxResult.error("新增库位失败,插入数据库时失败"); | |
71 | + } | |
72 | + return AjaxResult.success("新增库位成功"); | |
73 | + } | |
74 | + | |
36 | 75 | @Override |
37 | 76 | public boolean insertLocation(Location location) { |
38 | 77 | /* 判断库位类型编码是否存在*/ |
... | ... | @@ -54,6 +93,9 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i |
54 | 93 | throw new ServiceException("库区编码不存在"); |
55 | 94 | } |
56 | 95 | |
96 | + if(!location.getZoneCode().equals(location.getLocationType())){ | |
97 | + throw new ServiceException(location.getLocationType()+"的库位类型与"+location.getZoneCode()+"库区不匹配"); | |
98 | + } | |
57 | 99 | String prefix = location.getLocationType().substring(1); |
58 | 100 | List<Location> locations = new ArrayList<>(); |
59 | 101 | for (int i=1; i<=location.getIRow().intValue(); i++) { |
... | ... | @@ -78,18 +120,14 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i |
78 | 120 | String.format("%02d", j), |
79 | 121 | String.format("%02d", k), |
80 | 122 | String.format("%02d", m)); |
81 | - QueryWrapper<Location> queryWrapper = new QueryWrapper<>(); | |
82 | - List<Location> locationList = locationService.list(queryWrapper.eq("code", code)); | |
83 | - if (locationList.size() != 0){ | |
84 | - return true; | |
85 | - } else { | |
123 | + LambdaQueryWrapper<Location> queryWrapper = Wrappers.lambdaQuery(); | |
124 | + queryWrapper.eq(Location::getCode,code) | |
125 | + .eq(Location::getWarehouseCode,ShiroUtils.getWarehouseCode()); | |
126 | + List<Location> locationList = locationService.list(queryWrapper); | |
127 | + if (locationList.size() != 0) { | |
86 | 128 | param.setCode(code); |
87 | - location.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
88 | - location.setCreatedBy(ShiroUtils.getLoginName()); | |
89 | - location.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
129 | + locations.add(param); | |
90 | 130 | } |
91 | - param.setCode(code); | |
92 | - locations.add(param); | |
93 | 131 | } |
94 | 132 | } |
95 | 133 | } |
... | ... |
src/main/java/com/huaheng/pc/config/locationType/service/LocationTypeServiceImpl.java
... | ... | @@ -17,7 +17,6 @@ public class LocationTypeServiceImpl extends ServiceImpl<LocationTypeMapper, Loc |
17 | 17 | public List<Map<String, Object>> getLocationPrefix(){ |
18 | 18 | LambdaQueryWrapper<LocationType> lambdaQueryWrapper = Wrappers.lambdaQuery(); |
19 | 19 | lambdaQueryWrapper.eq(LocationType::getWarehouseCode, ShiroUtils.getWarehouseCode()) |
20 | - .eq(LocationType::getEnable, false) | |
21 | 20 | .eq(LocationType::getEnable, true); |
22 | 21 | return this.listMaps(lambdaQueryWrapper); |
23 | 22 | } |
... | ... |
src/main/java/com/huaheng/pc/config/materialUnit/controller/MaterialUnitController.java
... | ... | @@ -66,10 +66,11 @@ public class MaterialUnitController extends BaseController { |
66 | 66 | lambdaQueryWrapper.gt(StringUtils.isNotEmpty(createdBegin), MaterialUnit::getCreated, createdBegin) |
67 | 67 | .lt(StringUtils.isNotEmpty(createdEnd), MaterialUnit::getCreated, createdEnd) |
68 | 68 | .eq(StringUtils.isNotEmpty(materialUnit.getMaterialCode()), MaterialUnit::getMaterialCode, materialUnit.getMaterialCode()) |
69 | - .eq(StringUtils.isNotEmpty(materialUnit.getMaterialName()), MaterialUnit::getMaterialName, materialUnit.getMaterialName()) | |
69 | + .like(StringUtils.isNotEmpty(materialUnit.getMaterialName()), MaterialUnit::getMaterialName, materialUnit.getMaterialName()) | |
70 | 70 | .eq(StringUtils.isNotEmpty(materialUnit.getUnit()), MaterialUnit::getUnit, materialUnit.getUnit()) |
71 | 71 | .in(MaterialUnit::getCompanyCode, ShiroUtils.getCompanyCodeList()) |
72 | - .eq(MaterialUnit::getWarehouseCode, ShiroUtils.getWarehouseCode()); | |
72 | + .eq(MaterialUnit::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
73 | + .orderByDesc(MaterialUnit::getId); | |
73 | 74 | |
74 | 75 | if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){ |
75 | 76 | /*使用分页查询*/ |
... | ... |
src/main/resources/templates/config/location/addBatch.html
... | ... | @@ -66,22 +66,34 @@ |
66 | 66 | var prefix = ctx + "config/location" |
67 | 67 | $("#form-location-add").validate({ |
68 | 68 | rules:{ |
69 | - row:{ | |
69 | + iRow:{ | |
70 | 70 | required:true, |
71 | 71 | digits:true |
72 | 72 | }, |
73 | - line:{ | |
73 | + iColumn:{ | |
74 | 74 | required:true, |
75 | 75 | digits:true |
76 | 76 | }, |
77 | - layer:{ | |
77 | + iLayer:{ | |
78 | 78 | required:true, |
79 | 79 | digits:true |
80 | 80 | }, |
81 | - grid:{ | |
81 | + iGrid:{ | |
82 | 82 | required:true, |
83 | 83 | digits:true |
84 | - } | |
84 | + }, | |
85 | + zoneCode:{ | |
86 | + required:true, | |
87 | + digits:true | |
88 | + }, | |
89 | + locationType:{ | |
90 | + required:true, | |
91 | + digits:true | |
92 | + }, | |
93 | + status:{ | |
94 | + required:true, | |
95 | + digits:true | |
96 | + } | |
85 | 97 | }, |
86 | 98 | submitHandler: function(form) { |
87 | 99 | $.ajax({ |
... | ... | @@ -95,7 +107,7 @@ |
95 | 107 | "iGrid": $("input[name='iGrid']").val(), |
96 | 108 | "locationType": $("#locationType option:selected").val(), |
97 | 109 | "zoneCode": $("#zone option:selected").attr("code"), |
98 | - "enable" : $("input[name='enable']").is(':checked'), | |
110 | + "status" : $("input[name='status']").is(':checked'), | |
99 | 111 | }, |
100 | 112 | async : false, |
101 | 113 | error : function(request) { |
... | ... |
src/main/resources/templates/config/location/location.html
... | ... | @@ -25,25 +25,25 @@ |
25 | 25 | 库区编码:<input type="text" name="zoneCode"/> |
26 | 26 | </li> |
27 | 27 | <li> |
28 | - 行:<input type="text" name="row"/> | |
28 | + 行:<input type="text" name="iRow"/> | |
29 | 29 | </li> |
30 | 30 | <li> |
31 | - 列:<input type="text" name="line"/> | |
31 | + 列:<input type="text" name="iColumn"/> | |
32 | 32 | </li> |
33 | 33 | <li> |
34 | - 层:<input type="text" name="layer"/> | |
34 | + 层:<input type="text" name="iLayer"/> | |
35 | 35 | </li> |
36 | 36 | <li> |
37 | - 格:<input type="text" name="grid"/> | |
38 | - </li> | |
39 | - <li> | |
40 | - 巷道:<input type="text" name="roadway"/> | |
37 | + 格:<input type="text" name="iGrid"/> | |
41 | 38 | </li> |
42 | 39 | <!--<li>--> |
40 | + <!--巷道:<input type="text" name="roadway"/>--> | |
41 | + <!--</li>--> | |
42 | + <!--<li>--> | |
43 | 43 | <!--名称:<input type="text" name="name"/>--> |
44 | 44 | <!--</li>--> |
45 | 45 | <li> |
46 | - 库位类型:<select name="type" th:with="locationTypes = ${@locationType.getLocationPrefix()}"> | |
46 | + 库位类型:<select name="locationType" th:with="locationTypes = ${@locationType.getLocationPrefix()}"> | |
47 | 47 | <option value="">所有</option> |
48 | 48 | <option th:each="e : ${locationTypes}" th:text="${e['name']}" th:value="${e['code']}"></option> |
49 | 49 | </select> |
... | ... |
src/main/resources/templates/config/locationType/locationType.html
... | ... | @@ -10,7 +10,7 @@ |
10 | 10 | <div class="select-list"> |
11 | 11 | <ul> |
12 | 12 | <li> |
13 | - 编码:<input type="text" name="code"/> | |
13 | + 货位类型:<input type="text" name="code"/> | |
14 | 14 | </li> |
15 | 15 | <li> |
16 | 16 | 名称:<input type="text" name="name"/> |
... | ... | @@ -107,10 +107,6 @@ |
107 | 107 | title : '校验位' |
108 | 108 | }, |
109 | 109 | { |
110 | - field : 'checkDigit', | |
111 | - title : '校验位' | |
112 | - }, | |
113 | - { | |
114 | 110 | field : 'maxMaterials', |
115 | 111 | title : '最多混放物料数' |
116 | 112 | }, |
... | ... |
src/main/resources/templates/config/material/material.html
... | ... | @@ -29,9 +29,9 @@ |
29 | 29 | </li> |
30 | 30 | <li class="time"> |
31 | 31 | <label>创建时间: </label> |
32 | - <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[createdBegin]"/> | |
32 | + <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="createdBegin"/> | |
33 | 33 | <span>-</span> |
34 | - <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[createdEnd]"/> | |
34 | + <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="createdEnd"/> | |
35 | 35 | </li> |
36 | 36 | <li> |
37 | 37 | <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a> |
... | ... | @@ -206,7 +206,7 @@ |
206 | 206 | align: 'center', |
207 | 207 | formatter: function(value, row, index) { |
208 | 208 | var actions = []; |
209 | - actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> '); | |
209 | + // actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> '); | |
210 | 210 | actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-trash-o"></i>删除</a>'); |
211 | 211 | return actions.join(''); |
212 | 212 | } |
... | ... |
src/main/resources/templates/config/zoneCapacity/zoneCapacity.html
... | ... | @@ -10,13 +10,10 @@ |
10 | 10 | <div class="select-list"> |
11 | 11 | <ul> |
12 | 12 | <li> |
13 | - 编码:<input type="text" name="code"/> | |
13 | + 商品编码:<input type="text" name="materialCode"/> | |
14 | 14 | </li> |
15 | 15 | <li> |
16 | - 名称:<input type="text" name="name"/> | |
17 | - </li> | |
18 | - <li> | |
19 | - 存货编码:<input type="text" name="materialId"/> | |
16 | + 商品名称:<input type="text" name="materialName"/> | |
20 | 17 | </li> |
21 | 18 | </li> |
22 | 19 | <li> |
... | ... |