Commit 9c61472d7d5e2e1529b226208bce2118a5290b54

Authored by 游杰
1 parent 21702b0f

优化库位生成,库位分配

src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationServiceImpl.java
... ... @@ -36,7 +36,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
36 36 private TaskHeaderService taskHeaderService;
37 37  
38 38 @Override
39   - public String allocation(String locationRule, String roadWay, String warehouseCode, String containerCode) {
  39 + public String allocation(String locationRule, String area, String warehouseCode, String containerCode) {
40 40 if (StringUtils.isEmpty(locationRule)) {
41 41 return null;
42 42 }
... ... @@ -60,9 +60,9 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
60 60 }
61 61 switch (locationRule) {
62 62 case Constants.DOUBLE_RK:
63   - return doubleRk(roadWay, warehouseCode, locationTypeList);
  63 + return doubleRk(area, warehouseCode, locationTypeList);
64 64 case Constants.SINGER_RK:
65   - return singleRk(roadWay, warehouseCode, locationTypeList);
  65 + return singleRk(area, warehouseCode, locationTypeList);
66 66 }
67 67 return null;
68 68 }
... ... @@ -70,9 +70,9 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
70 70 /*
71 71 * 双伸位库位入库分配库位
72 72 */
73   - private String doubleRk(String roadWay, String warehouseCode, List<LocationType> locationTypeList) {
  73 + private String doubleRk(String area, String warehouseCode, List<LocationType> locationTypeList) {
74 74 LambdaQueryWrapper<Location> locationLambda = Wrappers.lambdaQuery();
75   - locationLambda.eq(Location::getRoadway, roadWay).
  75 + locationLambda.eq(Location::getArea, area).
76 76 eq(Location::getWarehouseCode, warehouseCode)
77 77 .eq(Location::getStatus, "empty")
78 78 .eq(Location::getRowFlag, 1)
... ... @@ -89,7 +89,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
89 89 locationList.removeAll(removeLocaationList);
90 90 if (locationList == null || locationList.size() == 0) {
91 91 locationLambda = Wrappers.lambdaQuery();
92   - locationLambda.eq(Location::getRoadway, roadWay).
  92 + locationLambda.eq(Location::getArea, area).
93 93 eq(Location::getWarehouseCode, warehouseCode)
94 94 .eq(Location::getStatus, "empty")
95 95 .eq(Location::getRowFlag, 0)
... ... @@ -105,27 +105,27 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
105 105 }
106 106 locationList.removeAll(removeLocaationList);
107 107 }
108   - String locationCode = filter(locationList, locationTypeList, roadWay);
  108 + String locationCode = filter(locationList, locationTypeList, area);
109 109 return locationCode;
110 110 }
111 111  
112 112 /*
113 113 * 单伸位库位入库分配库位
114 114 */
115   - private String singleRk(String roadWay, String warehouseCode, List<LocationType> locationTypeList) {
  115 + private String singleRk(String area, String warehouseCode, List<LocationType> locationTypeList) {
116 116 LambdaQueryWrapper<Location> locationLambda = Wrappers.lambdaQuery();
117   - locationLambda.eq(Location::getRoadway, roadWay).
  117 + locationLambda.eq(Location::getArea, area).
118 118 eq(Location::getWarehouseCode, warehouseCode)
119 119 .eq(Location::getStatus, "empty")
120 120 .eq(Location::getContainerCode, "");
121 121 List<Location> locationList = locationService.list(locationLambda);
122   - String locationCode = filter(locationList, locationTypeList, roadWay);
  122 + String locationCode = filter(locationList, locationTypeList, area);
123 123 return locationCode;
124 124 }
125 125  
126   - private String filter(List<Location> locationList, List<LocationType> locationTypeList, String roadway) {
  126 + private String filter(List<Location> locationList, List<LocationType> locationTypeList, String area) {
127 127 List<String> codeList = locationTypeList.stream().map(t -> t.getCode()).collect(Collectors.toList());
128   - List<Location> newLocation = locationList.stream().filter(t -> codeList.contains(t.getLocationType()) && t.getRoadway().equals(roadway)).collect(Collectors.toList());
  128 + List<Location> newLocation = locationList.stream().filter(t -> codeList.contains(t.getLocationType()) && t.getArea().equals(area)).collect(Collectors.toList());
129 129 if (newLocation.isEmpty()) {
130 130 return null;
131 131 } else {
... ...
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java
... ... @@ -102,7 +102,7 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService
102 102 return AjaxResult.error("任务号为空");
103 103 }
104 104 if (StringUtils.isEmpty(wcsTask.getDestination())) {
105   - return AjaxResult.error("目的为空");
  105 + return AjaxResult.error("目的区域为空");
106 106 }
107 107 if (StringUtils.isNull(wcsTask.getLength())) {
108 108 return AjaxResult.error("长为空");
... ...
src/main/java/com/huaheng/mobile/receipt/MobileBatchReceiptController.java
... ... @@ -584,10 +584,10 @@ public class MobileBatchReceiptController {
584 584 taskHeader.setCreatedBy(ShiroUtils.getLoginName());
585 585 taskHeader.setLastUpdatedBy(ShiroUtils.getLoginName());
586 586 taskHeader.setLastUpdated(new Date());
587   - if(taskHeaderService.save(taskHeader)){
  587 + if (taskHeaderService.save(taskHeader)){
588 588 //锁定库位状态
589 589 locationService.updateStatus(loc.getCode(),"lock");
590   - }else{
  590 + } else {
591 591 throw new ServiceException("补充入库主表生成失败!");
592 592 }
593 593  
... ...
src/main/java/com/huaheng/pc/config/location/controller/LocationController.java
... ... @@ -172,12 +172,12 @@ public class LocationController extends BaseController {
172 172 @Log(title = "配置-库存资料-库位管理", operating = "新增库位", action = BusinessType.INSERT)
173 173 @PostMapping("/addBatchSave")
174 174 @ResponseBody
175   - public AjaxResult addBatchSave(String firstRow, String lastRow, String firstColumn, String lastColumn, String firstLayer, String lastLayer,
176   - String firstGrid, String lastGrid, String roadWay, String status, String zoneCode, String locationType) {
  175 + public AjaxResult addBatchSave(String prefix, String firstRow, String lastRow, String firstColumn, String lastColumn, String firstLayer, String lastLayer,
  176 + String firstGrid, String lastGrid, String roadway, String area, String status, String zoneCode, String locationType) {
177 177  
178   - return toAjax(locationService.addBatchSave(Integer.parseInt(firstRow), Integer.parseInt(lastRow),
  178 + return toAjax(locationService.addBatchSave(prefix, Integer.parseInt(firstRow), Integer.parseInt(lastRow),
179 179 Integer.parseInt(firstColumn), Integer.parseInt(lastColumn), Integer.parseInt(firstLayer), Integer.parseInt(lastLayer),
180   - Integer.parseInt(firstGrid), Integer.parseInt(lastGrid), roadWay, status, zoneCode, locationType));
  180 + Integer.parseInt(firstGrid), Integer.parseInt(lastGrid), roadway, area, status, zoneCode, locationType));
181 181 }
182 182  
183 183 /**
... ...
src/main/java/com/huaheng/pc/config/location/domain/Location.java
... ... @@ -86,6 +86,12 @@ public class Location implements Serializable {
86 86 private String roadway;
87 87  
88 88 /**
  89 + * 区域
  90 + */
  91 + @TableField(value = "area")
  92 + private String area;
  93 +
  94 + /**
89 95 * 名称
90 96 */
91 97 @TableField(value = "name")
... ...
src/main/java/com/huaheng/pc/config/location/service/LocationService.java
... ... @@ -29,8 +29,8 @@ public interface LocationService extends IService&lt;Location&gt;{
29 29 * @param
30 30 * @return boolean
31 31 */
32   - boolean addBatchSave(Integer firstRow, Integer lastRow, Integer firstColumn, Integer lastColumn, Integer firstLayer,
33   - Integer lastLayer, Integer firstGrid, Integer lastGrid, String roadWay, String status, String zoneCode, String locationType);
  32 + boolean addBatchSave(String prefix, Integer firstRow, Integer lastRow, Integer firstColumn, Integer lastColumn, Integer firstLayer,
  33 + Integer lastLayer, Integer firstGrid, Integer lastGrid, String roadWay, String area, String status, String zoneCode, String locationType);
34 34  
35 35  
36 36 /**
... ...
src/main/java/com/huaheng/pc/config/location/service/LocationServiceImpl.java
... ... @@ -54,13 +54,12 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
54 54 //TODO:胡海-- 库位编码长度应该是弹性的,即我们的库位是由4个维度组成的,正常情况下 平库(行列) 立体仓库(行列层) AGV料架库(行列层格)
55 55 // 这里可以判断下 然后决定库位编码长度。
56 56 //创建库位编码code
57   - String prefix = location.getLocationType().substring(1);
58   - String code = MessageFormat.format("{0}{1}-{2}-{3}-{4}",
  57 + String prefix = location.getLocationType();
  58 + String code = MessageFormat.format("{0}{1}_{2}_{3}",
59 59 prefix,
60 60 String.format("%02d", location.getIRow()),
61 61 String.format("%02d", location.getIColumn()),
62   - String.format("%02d", location.getILayer()),
63   - String.format("%02d", location.getIGrid()));
  62 + String.format("%02d", location.getILayer()));
64 63  
65 64 //判断code是否重复
66 65 LambdaQueryWrapper<Location> lam = Wrappers.lambdaQuery();
... ... @@ -196,8 +195,8 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
196 195 }
197 196  
198 197 @Override
199   - public boolean addBatchSave(Integer firstRow, Integer lastRow, Integer firstColumn, Integer lastColumn, Integer firstLayer, Integer lastLayer,
200   - Integer firstGrid, Integer lastGrid, String roadWay, String status, String zoneCode, String locationType) {
  198 + public boolean addBatchSave(String prefix, Integer firstRow, Integer lastRow, Integer firstColumn, Integer lastColumn, Integer firstLayer, Integer lastLayer,
  199 + Integer firstGrid, Integer lastGrid, String roadWay, String area, String status, String zoneCode, String locationType) {
201 200 LambdaQueryWrapper<LocationType> typeLambda = Wrappers.lambdaQuery();
202 201 typeLambda.eq(LocationType::getCode, locationType)
203 202 .select(LocationType::getCode);
... ... @@ -232,6 +231,7 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
232 231 param.setILayer(k);
233 232 param.setIGrid(m);
234 233 param.setRoadway(roadWay);
  234 + param.setArea(area);
235 235 param.setZoneCode(zoneCode);
236 236 param.setLocationType(locationType);
237 237 param.setStatus(status);
... ... @@ -239,7 +239,7 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
239 239 param.setCreatedBy(ShiroUtils.getLoginName());
240 240 param.setLastUpdatedBy(ShiroUtils.getLoginName());
241 241 String code = MessageFormat.format("{0}{1}_{2}_{3}",
242   - locationType,
  242 + prefix,
243 243 String.format("%02d", i),
244 244 String.format("%02d", j),
245 245 String.format("%02d", k));
... ...
src/main/java/com/huaheng/pc/config/station/controller/stationController.java
... ... @@ -137,6 +137,7 @@ public class stationController extends BaseController {
137 137 @ResponseBody
138 138 public Map<String, Object> getData() {
139 139 LambdaQueryWrapper<Station> queryWrapper = Wrappers.lambdaQuery();
  140 + queryWrapper.ne(Station::getType, 1);
140 141 List<Station> stationList = stationService.list(queryWrapper);
141 142  
142 143 List<Map<String, Object>> list = new ArrayList<>();
... ...
src/main/java/com/huaheng/pc/config/station/domain/Station.java
... ... @@ -52,6 +52,13 @@ public class Station implements Serializable {
52 52 private Integer status;
53 53  
54 54 /**
  55 + * 区域
  56 + */
  57 + @TableField(value = "area")
  58 + @ApiModelProperty(value="区域")
  59 + private Integer area;
  60 +
  61 + /**
55 62 * 仓库编码
56 63 */
57 64 @TableField(value = "warehouseCode")
... ...
src/main/java/com/huaheng/pc/system/user/controller/UserController.java
... ... @@ -159,6 +159,10 @@ public class UserController extends BaseController
159 159 {
160 160 return error("不允许修改超级管理员用户");
161 161 }
  162 + List<Integer> roleList = user.getRoleIds();
  163 + if(roleList != null && roleList.size() > 1) {
  164 + return error("一个用户不允许有多个角色");
  165 + }
162 166 AjaxResult ajaxResult = toAjax(userService.updateUser(user));
163 167  
164 168 if (ShiroUtils.getLoginName().equals(user.getUserName())) {
... ...
src/main/resources/mybatis/config/LocationMapper.xml
... ... @@ -58,6 +58,7 @@
58 58 iLayer,
59 59 iGrid,
60 60 roadway,
  61 + area,
61 62 createdBy,
62 63 lastUpdatedBy,
63 64 status
... ... @@ -73,6 +74,7 @@
73 74 #{item.iLayer},
74 75 #{item.iGrid},
75 76 #{item.roadway},
  77 + #{item.area},
76 78 #{item.createdBy},
77 79 #{item.lastUpdatedBy},
78 80 #{item.status}
... ... @@ -92,6 +94,7 @@
92 94 iGrid,
93 95 rowFlag,
94 96 roadway,
  97 + area,
95 98 createdBy,
96 99 lastUpdatedBy,
97 100 status
... ... @@ -108,6 +111,7 @@
108 111 #{item.iGrid},
109 112 #{item.rowFlag},
110 113 #{item.roadway},
  114 + #{item.area},
111 115 #{item.createdBy},
112 116 #{item.lastUpdatedBy},
113 117 #{item.status}
... ...
src/main/resources/templates/config/location/add.html
... ... @@ -29,6 +29,26 @@
29 29 <input id="iGrid" name="iGrid" class="form-control" type="text">
30 30 </div>
31 31 </div>
  32 + <div class="form-group">
  33 + <label class="col-sm-3 control-label">内外侧:</label>
  34 + <div class="col-sm-8">
  35 + <select id="rowFlag" name="rowFlag" class="form-control" th:with="rowFlag=${@dict.getType('rowFlag')}">
  36 + <option th:each="item : ${rowFlag}" th:text="${item['dictLabel']}" th:value="${item['dictValue']}"></option>
  37 + </select>
  38 + </div>
  39 + </div>
  40 + <div class="form-group">
  41 + <label class="col-sm-3 control-label">巷道:</label>
  42 + <div class="col-sm-8">
  43 + <input id="roadway" name="roadway" class="form-control" type="text">
  44 + </div>
  45 + </div>
  46 + <div class="form-group">
  47 + <label class="col-sm-3 control-label">区域:</label>
  48 + <div class="col-sm-8">
  49 + <input id="area" name="area" class="form-control" type="text">
  50 + </div>
  51 + </div>
32 52 <div class="form-group">
33 53 <label class="col-sm-3 control-label">库位类型:</label>
34 54 <div class="col-sm-8">
... ... @@ -78,7 +98,19 @@
78 98 required:true,
79 99 digits:true
80 100 },
81   - iGrid:{
  101 + rowFlag:{
  102 + required:true,
  103 + digits:true
  104 + },
  105 + iGrid:{
  106 + required:true,
  107 + digits:true
  108 + },
  109 + roadway:{
  110 + required:true,
  111 + digits:true
  112 + },
  113 + area:{
82 114 required:true,
83 115 digits:true
84 116 }
... ... @@ -93,6 +125,9 @@
93 125 "iColumn": $("input[name='iColumn']").val(),
94 126 "iLayer": $("input[name='iLayer']").val(),
95 127 "iGrid": $("input[name='iGrid']").val(),
  128 + "rowFlag" : $("#rowFlag option:selected").val(),
  129 + "roadway": $("input[name='roadway']").val(),
  130 + "area": $("input[name='area']").val(),
96 131 "locationType": $("#locationType option:selected").val(),
97 132 "zoneCode": $("#zoneCode option:selected").attr("code"),
98 133 "status" : $("#status option:selected").val(),
... ...
src/main/resources/templates/config/location/addBatch.html
... ... @@ -6,6 +6,12 @@
6 6 <div class="wrapper wrapper-content animated fadeInRight ibox-content">
7 7 <form class="form-horizontal m" id="form-location-add">
8 8 <div class="form-group">
  9 + <label class="col-sm-3 control-label">编码前缀:</label>
  10 + <div class="col-sm-8">
  11 + <input id="prefix" name="prefix" class="form-control" type="text">
  12 + </div>
  13 + </div>
  14 + <div class="form-group">
9 15 <label class="col-sm-3 control-label">起始行:</label>
10 16 <div class="col-sm-8">
11 17 <input id="firstRow" name="firstRow" class="form-control" type="text">
... ... @@ -60,6 +66,12 @@
60 66 </div>
61 67 </div>
62 68 <div class="form-group">
  69 + <label class="col-sm-3 control-label">区域:</label>
  70 + <div class="col-sm-8">
  71 + <input id="area" name="area" class="form-control" type="text">
  72 + </div>
  73 + </div>
  74 + <div class="form-group">
63 75 <label class="col-sm-3 control-label">库位类型:</label>
64 76 <div class="col-sm-8">
65 77 <select id="locationType" name="locationType" class="form-control" th:with="locationType=${@locationType.getLocationPrefix()}">
... ... @@ -96,6 +108,9 @@
96 108 var prefix = ctx + "config/location"
97 109 $("#form-location-add").validate({
98 110 rules:{
  111 + prefix:{
  112 + required:true,
  113 + },
99 114 firstRow:{
100 115 required:true,
101 116 digits:true
... ... @@ -128,7 +143,15 @@
128 143 required:true,
129 144 digits:true
130 145 },
131   - zoneCode:{
  146 + zoneCode:{
  147 + required:true,
  148 + digits:true
  149 + },
  150 + roadway:{
  151 + required:true,
  152 + digits:true
  153 + },
  154 + area:{
132 155 required:true,
133 156 digits:true
134 157 },
... ... @@ -146,6 +169,7 @@
146 169 type : "POST",
147 170 url : prefix + "/addBatchSave",
148 171 data : {
  172 + "prefix": $("input[name='prefix']").val(),
149 173 "firstRow": $("input[name='firstRow']").val(),
150 174 "lastRow": $("input[name='lastRow']").val(),
151 175 "firstColumn": $("input[name='firstColumn']").val(),
... ... @@ -155,6 +179,7 @@
155 179 "firstGrid": $("input[name='firstGrid']").val(),
156 180 "lastGrid": $("input[name='lastGrid']").val(),
157 181 "roadway": $("input[name='roadway']").val(),
  182 + "area": $("input[name='area']").val(),
158 183 "locationType": $("#locationType option:selected").val(),
159 184 "zoneCode": $("#zone option:selected").attr("code"),
160 185 "status" : $("#status option:selected").val(),
... ...
src/main/resources/templates/config/location/location.html
... ... @@ -144,6 +144,14 @@
144 144 }
145 145 },
146 146 {
  147 + field : 'roadway',
  148 + title : '巷道'
  149 + },
  150 + {
  151 + field : 'area',
  152 + title : '区域'
  153 + },
  154 + {
147 155 field : 'name',
148 156 title : '名称'
149 157 },
... ...
src/main/resources/templates/config/station/add.html
... ... @@ -20,7 +20,15 @@
20 20 <div class="form-group">
21 21 <label class="col-sm-3 control-label">类型:</label>
22 22 <div class="col-sm-8">
23   - <input id="type" name="type" class="form-control" type="text" >
  23 + <select id="type" name="type" class="form-control" th:with="type=${@dict.getType('stationType')}">
  24 + <option th:each="item : ${type}" th:text="${item['dictLabel']}" th:value="${item['dictValue']}"></option>
  25 + </select>
  26 + </div>
  27 + </div>
  28 + <div class="form-group">
  29 + <label class="col-sm-3 control-label">区域:</label>
  30 + <div class="col-sm-8">
  31 + <input id="area" name="area" class="form-control" type="text" >
24 32 </div>
25 33 </div>
26 34 <div class="form-group">
... ... @@ -47,6 +55,9 @@
47 55 },
48 56 type:{
49 57 required: true
  58 + },
  59 + area:{
  60 + required: true
50 61 }
51 62 },
52 63 submitHandler: function(form) {
... ...
src/main/resources/templates/config/station/edit.html
... ... @@ -21,7 +21,15 @@
21 21 <div class="form-group">
22 22 <label class="col-sm-3 control-label">类型:</label>
23 23 <div class="col-sm-8">
24   - <input id="type" name="type" class="form-control" type="text" th:field="*{type}">
  24 + <select id="type" name="type" class="form-control" th:with="type=${@dict.getType('stationType')}">
  25 + <option th:each="item : ${type}" th:text="${item['dictLabel']}" th:value="${item['dictValue']}"></option>
  26 + </select>
  27 + </div>
  28 + </div>
  29 + <div class="form-group">
  30 + <label class="col-sm-3 control-label">区域:</label>
  31 + <div class="col-sm-8">
  32 + <input id="area" name="area" class="form-control" type="text" th:field="*{area}">
25 33 </div>
26 34 </div>
27 35 <div class="form-group">
... ...
src/main/resources/templates/config/station/station.html
... ... @@ -51,6 +51,7 @@
51 51 var removeFlag = [[${@permission.hasPermi('config:station:remove')}]];
52 52 var prefix = ctx + "config/station"
53 53 var datas = [[${@dict.getType('sys_normal_disable')}]];
  54 + var stationTypes = [[${@dict.getType('stationType')}]];
54 55 $(function() {
55 56 var options = {
56 57 url: prefix + "/list",
... ... @@ -82,7 +83,15 @@
82 83 },
83 84 {
84 85 field : 'type',
85   - title : '类型'
  86 + title : '类型' ,
  87 + align: 'center',
  88 + formatter: function(value, row, index) {
  89 + return $.table.selectDictLabel(stationTypes, value);
  90 + }
  91 + },
  92 + {
  93 + field : 'area',
  94 + title : '区域'
86 95 },
87 96 {
88 97 field : 'status',
... ...