Commit ece6f81a0a76acc587e338d72865977865fc0fe2
1 parent
28c1afd5
增加用户和仓库的关系
Showing
9 changed files
with
178 additions
and
121 deletions
ant-design-vue-jeecg/src/api/api.js
... | ... | @@ -203,6 +203,10 @@ export const handleEmptyOut = (params) => postAction('/task/taskHeader/handleEmp |
203 | 203 | export const handlePickupError = (params) => postAction('/task/taskHeader/handlePickupError?id=' + params, params); |
204 | 204 | //修复重入数据 |
205 | 205 | export const handleDoubleIn = (params) => postAction('/task/taskHeader/handleDoubleIn?id=' + params, params); |
206 | +//查询用户角色 | |
207 | +export const queryWarehouse = (params) => getAction("/config/sysUserWarehouse/queryWarehouse", params); | |
208 | +//查询所有仓库 | |
209 | +export const getAllWarehouseList = (params) => getAction("/config/warehouse/getAllWarehouseList", params); | |
206 | 210 | // 中转HTTP请求 |
207 | 211 | export const transitRESTful = { |
208 | 212 | get: (url, parameter) => getAction(getTransitURL(url), parameter), |
... | ... |
ant-design-vue-jeecg/src/views/system/config/SysUserWarehouseList.vue
... | ... | @@ -4,6 +4,21 @@ |
4 | 4 | <div class="table-page-search-wrapper"> |
5 | 5 | <a-form layout="inline" @keyup.enter.native="searchQuery"> |
6 | 6 | <a-row :gutter="24"> |
7 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
8 | + <a-form-item label="用户名称"> | |
9 | + <a-input placeholder="请输入用户名称" v-model="queryParam.username"></a-input> | |
10 | + </a-form-item> | |
11 | + </a-col> | |
12 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
13 | + <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> | |
14 | + <a-button type="primary" @click="searchQuery" icon="search">查询</a-button> | |
15 | + <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> | |
16 | + <a @click="handleToggleSearch" style="margin-left: 8px"> | |
17 | + {{ toggleSearchStatus ? '收起' : '展开' }} | |
18 | + <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/> | |
19 | + </a> | |
20 | + </span> | |
21 | + </a-col> | |
7 | 22 | </a-row> |
8 | 23 | </a-form> |
9 | 24 | </div> |
... | ... |
ant-design-vue-jeecg/src/views/system/modules/UserModal.vue
... | ... | @@ -61,6 +61,15 @@ |
61 | 61 | </j-multi-select-tag> |
62 | 62 | </a-form-model-item> |
63 | 63 | |
64 | + <a-form-model-item label="仓库分配" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="!warehouseDisable"> | |
65 | + <j-multi-select-tag | |
66 | + :disabled="disableSubmit" | |
67 | + v-model="model.selectedWarehouse" | |
68 | + :options="warehouseOptions" | |
69 | + placeholder="请选择仓库"> | |
70 | + </j-multi-select-tag> | |
71 | + </a-form-model-item> | |
72 | + | |
64 | 73 | <!--部门分配--> |
65 | 74 | <a-form-model-item label="部门分配" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="!departDisabled"> |
66 | 75 | <j-select-depart v-model="model.selecteddeparts" :multi="true" @back="backDepartInfo" :backDepart="true" |
... | ... | @@ -144,7 +153,7 @@ import moment from 'moment' |
144 | 153 | import Vue from 'vue' |
145 | 154 | import {ACCESS_TOKEN} from "@/store/mutation-types" |
146 | 155 | import {getAction} from '@/api/manage' |
147 | -import {addUser, editUser, queryUserRole, queryall} from '@/api/api' | |
156 | +import {addUser, editUser, queryUserRole, queryall, queryWarehouse, getAllWarehouseList} from '@/api/api' | |
148 | 157 | import {disabledAuthFilter} from "@/utils/authFilter" |
149 | 158 | import {duplicateCheck} from '@/api/api' |
150 | 159 | |
... | ... | @@ -155,6 +164,7 @@ export default { |
155 | 164 | return { |
156 | 165 | departDisabled: false, //是否是我的部门调用该页面 |
157 | 166 | roleDisabled: false, //是否是角色维护调用该页面 |
167 | + warehouseDisable: false, //是否是角色维护调用该页面 | |
158 | 168 | modalWidth: 800, |
159 | 169 | drawerWidth: 700, |
160 | 170 | modaltoggleFlag: true, |
... | ... | @@ -200,6 +210,7 @@ export default { |
200 | 210 | queryTenantList: '/sys/tenant/queryList' |
201 | 211 | }, |
202 | 212 | tenantsOptions: [], |
213 | + warehouseOptions: [], | |
203 | 214 | rolesOptions: [], |
204 | 215 | nextDepartOptions: [], |
205 | 216 | } |
... | ... | @@ -208,6 +219,7 @@ export default { |
208 | 219 | const token = Vue.ls.get(ACCESS_TOKEN); |
209 | 220 | this.headers = {"X-Access-Token": token} |
210 | 221 | this.initRoleList() |
222 | + this.initWarehouseList() | |
211 | 223 | this.initTenantList() |
212 | 224 | }, |
213 | 225 | computed: { |
... | ... | @@ -226,7 +238,7 @@ export default { |
226 | 238 | //根据屏幕宽度自适应抽屉宽度 |
227 | 239 | this.resetScreenSize(); |
228 | 240 | that.userId = record.id; |
229 | - that.model = Object.assign({}, {selectedroles: '', selecteddeparts: ''}, record); | |
241 | + that.model = Object.assign({}, {selectedroles: '', selectedWarehouse: '',selecteddeparts: ''}, record); | |
230 | 242 | //身份为上级显示负责部门,否则不显示 |
231 | 243 | if (this.model.userIdentity == 2) { |
232 | 244 | this.departIdShow = true; |
... | ... | @@ -236,6 +248,7 @@ export default { |
236 | 248 | |
237 | 249 | if (record.hasOwnProperty("id")) { |
238 | 250 | that.getUserRoles(record.id); |
251 | + that.getWarehouse(record.id); | |
239 | 252 | that.getUserDeparts(record.id); |
240 | 253 | } |
241 | 254 | console.log('that.model=', that.model) |
... | ... | @@ -285,11 +298,22 @@ export default { |
285 | 298 | } |
286 | 299 | }); |
287 | 300 | }, |
288 | - getUserRoles(userid) { | |
289 | - queryUserRole({userid: userid}).then((res) => { | |
301 | + initWarehouseList() { | |
302 | + getAllWarehouseList().then((res) => { | |
303 | + if (res.success) { | |
304 | + this.warehouseOptions = res.result.map((item, index, arr) => { | |
305 | + let c = {label: item.name, value: item.code} | |
306 | + return c; | |
307 | + }) | |
308 | + console.log('this.warehouseOptions: ', this.warehouseOptions) | |
309 | + } | |
310 | + }); | |
311 | + }, | |
312 | + getWarehouse(userid) { | |
313 | + queryWarehouse({userid: userid}).then((res) => { | |
290 | 314 | if (res.success) { |
291 | - this.model.selectedroles = res.result.join(","); | |
292 | - console.log('that.model.selectedroles=', this.model.selectedroles) | |
315 | + this.model.selectedWarehouse = res.result.join(","); | |
316 | + console.log('that.model.selectedWarehouse=', this.model.selectedWarehouse) | |
293 | 317 | } |
294 | 318 | }); |
295 | 319 | }, |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/system/controller/SysUserController.java
1 | 1 | package org.jeecg.modules.system.controller; |
2 | 2 | |
3 | 3 | import java.io.IOException; |
4 | -import java.util.ArrayList; | |
5 | -import java.util.Arrays; | |
6 | -import java.util.Collection; | |
7 | -import java.util.Date; | |
8 | -import java.util.HashMap; | |
9 | -import java.util.List; | |
10 | -import java.util.Map; | |
11 | -import java.util.UUID; | |
4 | +import java.util.*; | |
12 | 5 | |
13 | 6 | import javax.annotation.Resource; |
14 | 7 | import javax.servlet.http.HttpServletRequest; |
... | ... | @@ -27,20 +20,10 @@ import org.jeecg.common.util.PasswordUtil; |
27 | 20 | import org.jeecg.common.util.RedisUtil; |
28 | 21 | import org.jeecg.common.util.oConvertUtils; |
29 | 22 | import org.jeecg.modules.base.service.BaseCommonService; |
30 | -import org.jeecg.modules.system.entity.SysDepart; | |
31 | -import org.jeecg.modules.system.entity.SysDepartRole; | |
32 | -import org.jeecg.modules.system.entity.SysDepartRoleUser; | |
33 | -import org.jeecg.modules.system.entity.SysUser; | |
34 | -import org.jeecg.modules.system.entity.SysUserDepart; | |
35 | -import org.jeecg.modules.system.entity.SysUserRole; | |
23 | +import org.jeecg.modules.system.entity.*; | |
36 | 24 | import org.jeecg.modules.system.model.DepartIdModel; |
37 | 25 | import org.jeecg.modules.system.model.SysUserSysDepartModel; |
38 | -import org.jeecg.modules.system.service.ISysDepartRoleService; | |
39 | -import org.jeecg.modules.system.service.ISysDepartRoleUserService; | |
40 | -import org.jeecg.modules.system.service.ISysDepartService; | |
41 | -import org.jeecg.modules.system.service.ISysUserDepartService; | |
42 | -import org.jeecg.modules.system.service.ISysUserRoleService; | |
43 | -import org.jeecg.modules.system.service.ISysUserService; | |
26 | +import org.jeecg.modules.system.service.*; | |
44 | 27 | import org.jeecg.modules.system.vo.SysDepartUsersVO; |
45 | 28 | import org.jeecg.modules.system.vo.SysUserRoleVO; |
46 | 29 | import org.jeecgframework.poi.excel.ExcelImportUtil; |
... | ... | @@ -51,13 +34,7 @@ import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
51 | 34 | import org.springframework.beans.factory.annotation.Autowired; |
52 | 35 | import org.springframework.beans.factory.annotation.Value; |
53 | 36 | import org.springframework.util.CollectionUtils; |
54 | -import org.springframework.web.bind.annotation.GetMapping; | |
55 | -import org.springframework.web.bind.annotation.PostMapping; | |
56 | -import org.springframework.web.bind.annotation.RequestBody; | |
57 | -import org.springframework.web.bind.annotation.RequestMapping; | |
58 | -import org.springframework.web.bind.annotation.RequestMethod; | |
59 | -import org.springframework.web.bind.annotation.RequestParam; | |
60 | -import org.springframework.web.bind.annotation.RestController; | |
37 | +import org.springframework.web.bind.annotation.*; | |
61 | 38 | import org.springframework.web.multipart.MultipartFile; |
62 | 39 | import org.springframework.web.multipart.MultipartHttpServletRequest; |
63 | 40 | import org.springframework.web.servlet.ModelAndView; |
... | ... | @@ -190,6 +167,7 @@ public class SysUserController { |
190 | 167 | public Result<SysUser> add(@RequestBody JSONObject jsonObject) { |
191 | 168 | Result<SysUser> result = new Result<SysUser>(); |
192 | 169 | String selectedRoles = jsonObject.getString("selectedroles"); |
170 | + String selectedWarehouse = jsonObject.getString("selectedWarehouse"); | |
193 | 171 | String selectedDeparts = jsonObject.getString("selecteddeparts"); |
194 | 172 | try { |
195 | 173 | SysUser user = JSON.parseObject(jsonObject.toJSONString(), SysUser.class); |
... | ... | @@ -201,7 +179,7 @@ public class SysUserController { |
201 | 179 | user.setStatus(1); |
202 | 180 | user.setDelFlag(CommonConstant.DEL_FLAG_0); |
203 | 181 | // 保存用户走一个service 保证事务 |
204 | - sysUserService.saveUser(user, selectedRoles, selectedDeparts); | |
182 | + sysUserService.saveUser(user, selectedRoles, selectedDeparts, selectedWarehouse); | |
205 | 183 | result.success("添加成功!"); |
206 | 184 | } catch (Exception e) { |
207 | 185 | log.error(e.getMessage(), e); |
... | ... | @@ -227,13 +205,14 @@ public class SysUserController { |
227 | 205 | // sysUser.getSalt()); |
228 | 206 | user.setPassword(sysUser.getPassword()); |
229 | 207 | String roles = jsonObject.getString("selectedroles"); |
208 | + String selectedWarehouse = jsonObject.getString("selectedWarehouse"); | |
230 | 209 | String departs = jsonObject.getString("selecteddeparts"); |
231 | 210 | if (oConvertUtils.isEmpty(departs)) { |
232 | 211 | // vue3.0前端只传递了departIds |
233 | 212 | departs = user.getDepartIds(); |
234 | 213 | } |
235 | 214 | // 修改用户走一个service 保证事务 |
236 | - sysUserService.editUser(user, roles, departs); | |
215 | + sysUserService.editUser(user, roles, departs, selectedWarehouse); | |
237 | 216 | result.success("修改成功!"); |
238 | 217 | } |
239 | 218 | } catch (Exception e) { |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/system/service/ISysUserService.java
1 | 1 | package org.jeecg.modules.system.service; |
2 | 2 | |
3 | -import com.alibaba.fastjson.JSONObject; | |
4 | -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
5 | -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
6 | -import com.baomidou.mybatisplus.core.metadata.IPage; | |
7 | -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
8 | -import com.baomidou.mybatisplus.extension.service.IService; | |
3 | +import java.util.Collection; | |
4 | +import java.util.List; | |
5 | +import java.util.Map; | |
6 | +import java.util.Set; | |
7 | + | |
9 | 8 | import org.jeecg.common.api.vo.Result; |
10 | 9 | import org.jeecg.common.system.vo.SysUserCacheInfo; |
11 | 10 | import org.jeecg.modules.system.entity.SysUser; |
12 | 11 | import org.jeecg.modules.system.model.SysUserSysDepartModel; |
13 | 12 | import org.springframework.transaction.annotation.Transactional; |
14 | 13 | |
15 | -import java.util.Collection; | |
16 | -import java.util.List; | |
17 | -import java.util.Map; | |
18 | -import java.util.Set; | |
14 | +import com.alibaba.fastjson.JSONObject; | |
15 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
16 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
17 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
18 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
19 | +import com.baomidou.mybatisplus.extension.service.IService; | |
19 | 20 | |
20 | 21 | /** |
21 | 22 | * <p> |
... | ... | @@ -230,7 +231,7 @@ public interface ISysUserService extends IService<SysUser> { |
230 | 231 | * @param selectedRoles 选择的角色id,多个以逗号隔开 |
231 | 232 | * @param selectedDeparts 选择的部门id,多个以逗号隔开 |
232 | 233 | */ |
233 | - void saveUser(SysUser user, String selectedRoles, String selectedDeparts); | |
234 | + void saveUser(SysUser user, String selectedRoles, String selectedDeparts, String selectedWarehouse); | |
234 | 235 | |
235 | 236 | /** |
236 | 237 | * 编辑用户 |
... | ... | @@ -238,7 +239,7 @@ public interface ISysUserService extends IService<SysUser> { |
238 | 239 | * @param roles 选择的角色id,多个以逗号隔开 |
239 | 240 | * @param departs 选择的部门id,多个以逗号隔开 |
240 | 241 | */ |
241 | - void editUser(SysUser user, String roles, String departs); | |
242 | + void editUser(SysUser user, String roles, String departs, String selectedWarehouse); | |
242 | 243 | |
243 | 244 | /** userId转为username */ |
244 | 245 | List<String> userIdToUsername(Collection<String> userIdList); |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java
1 | 1 | package org.jeecg.modules.system.service.impl; |
2 | 2 | |
3 | -import java.util.ArrayList; | |
4 | -import java.util.Arrays; | |
5 | -import java.util.Collection; | |
6 | -import java.util.HashMap; | |
7 | -import java.util.HashSet; | |
8 | -import java.util.List; | |
9 | -import java.util.Map; | |
10 | -import java.util.Set; | |
3 | +import java.util.*; | |
11 | 4 | import java.util.stream.Collectors; |
12 | 5 | |
13 | 6 | import javax.annotation.Resource; |
... | ... | @@ -21,36 +14,25 @@ import org.jeecg.common.system.vo.SysUserCacheInfo; |
21 | 14 | import org.jeecg.common.util.PasswordUtil; |
22 | 15 | import org.jeecg.common.util.oConvertUtils; |
23 | 16 | import org.jeecg.modules.base.service.BaseCommonService; |
24 | -import org.jeecg.modules.system.entity.SysDepart; | |
25 | -import org.jeecg.modules.system.entity.SysDepartRole; | |
26 | -import org.jeecg.modules.system.entity.SysDepartRoleUser; | |
27 | -import org.jeecg.modules.system.entity.SysPermission; | |
28 | -import org.jeecg.modules.system.entity.SysRole; | |
29 | -import org.jeecg.modules.system.entity.SysThirdAccount; | |
30 | -import org.jeecg.modules.system.entity.SysUser; | |
31 | -import org.jeecg.modules.system.entity.SysUserDepart; | |
32 | -import org.jeecg.modules.system.entity.SysUserRole; | |
33 | -import org.jeecg.modules.system.mapper.SysDepartMapper; | |
34 | -import org.jeecg.modules.system.mapper.SysDepartRoleMapper; | |
35 | -import org.jeecg.modules.system.mapper.SysDepartRoleUserMapper; | |
36 | -import org.jeecg.modules.system.mapper.SysPermissionMapper; | |
37 | -import org.jeecg.modules.system.mapper.SysRoleMapper; | |
38 | -import org.jeecg.modules.system.mapper.SysThirdAccountMapper; | |
39 | -import org.jeecg.modules.system.mapper.SysUserDepartMapper; | |
40 | -import org.jeecg.modules.system.mapper.SysUserMapper; | |
41 | -import org.jeecg.modules.system.mapper.SysUserRoleMapper; | |
17 | +import org.jeecg.modules.system.entity.*; | |
18 | +import org.jeecg.modules.system.mapper.*; | |
42 | 19 | import org.jeecg.modules.system.model.SysUserSysDepartModel; |
43 | 20 | import org.jeecg.modules.system.service.ISysUserService; |
44 | 21 | import org.jeecg.modules.system.vo.SysUserDepVo; |
22 | +import org.jeecg.modules.wms.config.sysUserWarehouse.entity.SysUserWarehouse; | |
23 | +import org.jeecg.modules.wms.config.sysUserWarehouse.service.ISysUserWarehouseService; | |
24 | +import org.jeecg.utils.StringUtils; | |
45 | 25 | import org.springframework.beans.factory.annotation.Autowired; |
46 | 26 | import org.springframework.cache.annotation.CacheEvict; |
47 | 27 | import org.springframework.stereotype.Service; |
48 | 28 | import org.springframework.transaction.annotation.Transactional; |
49 | 29 | |
50 | 30 | import com.alibaba.fastjson.JSONObject; |
31 | +import com.aliyun.oss.ServiceException; | |
51 | 32 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
52 | 33 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
53 | 34 | import com.baomidou.mybatisplus.core.metadata.IPage; |
35 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
54 | 36 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
55 | 37 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
56 | 38 | |
... | ... | @@ -75,6 +57,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl |
75 | 57 | private SysUserRoleMapper sysUserRoleMapper; |
76 | 58 | @Autowired |
77 | 59 | private SysUserDepartMapper sysUserDepartMapper; |
60 | + @Resource | |
61 | + private ISysUserService sysUserService; | |
62 | + @Resource | |
63 | + private ISysUserWarehouseService sysUserWarehouseService; | |
78 | 64 | @Autowired |
79 | 65 | private ISysBaseAPI sysBaseAPI; |
80 | 66 | @Autowired |
... | ... | @@ -479,7 +465,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl |
479 | 465 | |
480 | 466 | @Override |
481 | 467 | @Transactional(rollbackFor = Exception.class) |
482 | - public void saveUser(SysUser user, String selectedRoles, String selectedDeparts) { | |
468 | + public void saveUser(SysUser user, String selectedRoles, String selectedDeparts, String selectedWarehouse) { | |
483 | 469 | // step.1 保存用户 |
484 | 470 | this.save(user); |
485 | 471 | // step.2 保存角色 |
... | ... | @@ -498,12 +484,24 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl |
498 | 484 | sysUserDepartMapper.insert(userDeaprt); |
499 | 485 | } |
500 | 486 | } |
487 | + if (StringUtils.isNotEmpty(selectedWarehouse)) { | |
488 | + String[] arr = selectedWarehouse.split(","); | |
489 | + for (String warehouseCode : arr) { | |
490 | + SysUserWarehouse sysUserWarehouse = new SysUserWarehouse(); | |
491 | + sysUserWarehouse.setWarehousecode(warehouseCode); | |
492 | + sysUserWarehouse.setUserid(user.getId()); | |
493 | + sysUserWarehouse.setUsername(user.getUsername()); | |
494 | + if (!sysUserWarehouseService.save(sysUserWarehouse)) { | |
495 | + throw new ServiceException("保存失败"); | |
496 | + } | |
497 | + } | |
498 | + } | |
501 | 499 | } |
502 | 500 | |
503 | 501 | @Override |
504 | 502 | @Transactional(rollbackFor = Exception.class) |
505 | 503 | @CacheEvict(value = {CacheConstant.SYS_USERS_CACHE}, allEntries = true) |
506 | - public void editUser(SysUser user, String roles, String departs) { | |
504 | + public void editUser(SysUser user, String roles, String departs, String warehouses) { | |
507 | 505 | // step.1 修改用户基础信息 |
508 | 506 | this.updateById(user); |
509 | 507 | // step.2 修改角色 |
... | ... | @@ -556,6 +554,24 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl |
556 | 554 | userMapper.updateNullByEmptyString("email"); |
557 | 555 | userMapper.updateNullByEmptyString("phone"); |
558 | 556 | |
557 | + // step5 | |
558 | + LambdaQueryWrapper<SysUserWarehouse> sysUserWarehouseLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
559 | + sysUserWarehouseLambdaQueryWrapper.eq(SysUserWarehouse::getUserid, user.getId()); | |
560 | + if (!sysUserWarehouseService.remove(sysUserWarehouseLambdaQueryWrapper)) { | |
561 | + throw new ServiceException("删除用户和仓库关系失败"); | |
562 | + } | |
563 | + if (StringUtils.isNotEmpty(warehouses)) { | |
564 | + String[] strs = warehouses.split(","); | |
565 | + for (String warehouseCode : strs) { | |
566 | + SysUserWarehouse sysUserWarehouse = new SysUserWarehouse(); | |
567 | + sysUserWarehouse.setUserid(user.getId()); | |
568 | + sysUserWarehouse.setWarehousecode(warehouseCode); | |
569 | + sysUserWarehouse.setUsername(user.getRealname()); | |
570 | + if (!sysUserWarehouseService.save(sysUserWarehouse)) { | |
571 | + throw new ServiceException("保存用户和仓库关系失败"); | |
572 | + } | |
573 | + } | |
574 | + } | |
559 | 575 | } |
560 | 576 | |
561 | 577 | @Override |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/sysUserWarehouse/controller/SysUserWarehouseController.java
1 | 1 | package org.jeecg.modules.wms.config.sysUserWarehouse.controller; |
2 | 2 | |
3 | +import java.util.ArrayList; | |
3 | 4 | import java.util.Arrays; |
4 | 5 | import java.util.List; |
5 | -import java.util.Map; | |
6 | -import java.util.stream.Collectors; | |
7 | -import java.io.IOException; | |
8 | -import java.io.UnsupportedEncodingException; | |
9 | -import java.net.URLDecoder; | |
6 | + | |
7 | +import javax.annotation.Resource; | |
10 | 8 | import javax.servlet.http.HttpServletRequest; |
11 | 9 | import javax.servlet.http.HttpServletResponse; |
10 | + | |
12 | 11 | import org.jeecg.common.api.vo.Result; |
12 | +import org.jeecg.common.aspect.annotation.AutoLog; | |
13 | +import org.jeecg.common.system.base.controller.JeecgController; | |
13 | 14 | import org.jeecg.common.system.query.QueryGenerator; |
14 | -import org.jeecg.utils.HuahengJwtUtil; | |
15 | -import org.jeecg.common.util.oConvertUtils; | |
16 | - | |
17 | -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
18 | -import com.baomidou.mybatisplus.core.metadata.IPage; | |
19 | -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
20 | -import lombok.extern.slf4j.Slf4j; | |
21 | - | |
22 | 15 | import org.jeecg.modules.wms.config.sysUserWarehouse.entity.SysUserWarehouse; |
23 | 16 | import org.jeecg.modules.wms.config.sysUserWarehouse.service.ISysUserWarehouseService; |
24 | -import org.jeecgframework.poi.excel.ExcelImportUtil; | |
25 | -import org.jeecgframework.poi.excel.def.NormalExcelConstants; | |
26 | -import org.jeecgframework.poi.excel.entity.ExportParams; | |
27 | -import org.jeecgframework.poi.excel.entity.ImportParams; | |
28 | -import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | |
29 | -import org.jeecg.common.system.base.controller.JeecgController; | |
17 | +import org.jeecg.modules.wms.config.warehouse.entity.Warehouse; | |
18 | +import org.jeecg.modules.wms.config.warehouse.service.IWarehouseService; | |
30 | 19 | import org.springframework.beans.factory.annotation.Autowired; |
31 | 20 | import org.springframework.web.bind.annotation.*; |
32 | -import org.springframework.web.multipart.MultipartFile; | |
33 | -import org.springframework.web.multipart.MultipartHttpServletRequest; | |
34 | 21 | import org.springframework.web.servlet.ModelAndView; |
35 | -import com.alibaba.fastjson.JSON; | |
22 | + | |
23 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
24 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
25 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
26 | + | |
36 | 27 | import io.swagger.annotations.Api; |
37 | 28 | import io.swagger.annotations.ApiOperation; |
38 | -import org.jeecg.common.aspect.annotation.AutoLog; | |
29 | +import lombok.extern.slf4j.Slf4j; | |
39 | 30 | |
40 | 31 | /** |
41 | 32 | * @Description: 用户仓库关系表 |
... | ... | @@ -51,6 +42,9 @@ public class SysUserWarehouseController extends JeecgController<SysUserWarehouse |
51 | 42 | @Autowired |
52 | 43 | private ISysUserWarehouseService sysUserWarehouseService; |
53 | 44 | |
45 | + @Resource | |
46 | + private IWarehouseService warehouseService; | |
47 | + | |
54 | 48 | /** |
55 | 49 | * 分页列表查询 |
56 | 50 | * @param sysUserWarehouse |
... | ... | @@ -159,4 +153,25 @@ public class SysUserWarehouseController extends JeecgController<SysUserWarehouse |
159 | 153 | return super.importExcel(request, response, SysUserWarehouse.class); |
160 | 154 | } |
161 | 155 | |
156 | + @RequestMapping(value = "/queryWarehouse", method = RequestMethod.GET) | |
157 | + public Result<List<String>> queryWarehouse(@RequestParam(name = "userid", required = true) String userid) { | |
158 | + Result<List<String>> result = new Result<>(); | |
159 | + List<String> list = new ArrayList<String>(); | |
160 | + List<SysUserWarehouse> sysUserWarehouseList = | |
161 | + sysUserWarehouseService.list(new QueryWrapper<SysUserWarehouse>().lambda().eq(SysUserWarehouse::getUserid, userid)); | |
162 | + if (sysUserWarehouseList == null || sysUserWarehouseList.size() <= 0) { | |
163 | + result.error500("未找到用户相关仓库信息"); | |
164 | + } else { | |
165 | + for (SysUserWarehouse sysUserWarehouse : sysUserWarehouseList) { | |
166 | + Warehouse warehouse = warehouseService.getWarehouseByCode(sysUserWarehouse.getWarehousecode()); | |
167 | + if (warehouse != null) { | |
168 | + list.add(warehouse.getName()); | |
169 | + } | |
170 | + } | |
171 | + result.setSuccess(true); | |
172 | + result.setResult(list); | |
173 | + } | |
174 | + return result; | |
175 | + } | |
176 | + | |
162 | 177 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/warehouse/controller/WarehouseController.java
... | ... | @@ -2,41 +2,28 @@ package org.jeecg.modules.wms.config.warehouse.controller; |
2 | 2 | |
3 | 3 | import java.util.Arrays; |
4 | 4 | import java.util.List; |
5 | -import java.util.Map; | |
6 | -import java.util.stream.Collectors; | |
7 | -import java.io.IOException; | |
8 | -import java.io.UnsupportedEncodingException; | |
9 | -import java.net.URLDecoder; | |
5 | + | |
10 | 6 | import javax.servlet.http.HttpServletRequest; |
11 | 7 | import javax.servlet.http.HttpServletResponse; |
12 | 8 | |
13 | 9 | import org.apache.shiro.authz.annotation.RequiresPermissions; |
14 | 10 | import org.jeecg.common.api.vo.Result; |
11 | +import org.jeecg.common.aspect.annotation.AutoLog; | |
12 | +import org.jeecg.common.system.base.controller.JeecgController; | |
15 | 13 | import org.jeecg.common.system.query.QueryGenerator; |
16 | -import org.jeecg.common.util.oConvertUtils; | |
17 | - | |
18 | -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
19 | -import com.baomidou.mybatisplus.core.metadata.IPage; | |
20 | -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
21 | -import lombok.extern.slf4j.Slf4j; | |
22 | - | |
23 | 14 | import org.jeecg.modules.wms.config.warehouse.entity.Warehouse; |
24 | 15 | import org.jeecg.modules.wms.config.warehouse.service.IWarehouseService; |
25 | -import org.jeecgframework.poi.excel.ExcelImportUtil; | |
26 | -import org.jeecgframework.poi.excel.def.NormalExcelConstants; | |
27 | -import org.jeecgframework.poi.excel.entity.ExportParams; | |
28 | -import org.jeecgframework.poi.excel.entity.ImportParams; | |
29 | -import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | |
30 | -import org.jeecg.common.system.base.controller.JeecgController; | |
31 | 16 | import org.springframework.beans.factory.annotation.Autowired; |
32 | 17 | import org.springframework.web.bind.annotation.*; |
33 | -import org.springframework.web.multipart.MultipartFile; | |
34 | -import org.springframework.web.multipart.MultipartHttpServletRequest; | |
35 | 18 | import org.springframework.web.servlet.ModelAndView; |
36 | -import com.alibaba.fastjson.JSON; | |
19 | + | |
20 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
21 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
22 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
23 | + | |
37 | 24 | import io.swagger.annotations.Api; |
38 | 25 | import io.swagger.annotations.ApiOperation; |
39 | -import org.jeecg.common.aspect.annotation.AutoLog; | |
26 | +import lombok.extern.slf4j.Slf4j; | |
40 | 27 | |
41 | 28 | /** |
42 | 29 | * @Description: 仓库 |
... | ... | @@ -172,4 +159,12 @@ public class WarehouseController extends JeecgController<Warehouse, IWarehouseSe |
172 | 159 | return super.importExcel(request, response, Warehouse.class); |
173 | 160 | } |
174 | 161 | |
162 | + @RequestMapping(value = "/getAllWarehouseList", method = RequestMethod.GET) | |
163 | + public Result<List<Warehouse>> getAllWarehouseList() { | |
164 | + Result<List<Warehouse>> result = new Result<>(); | |
165 | + List<Warehouse> list = warehouseService.getAllWarehouseList(); | |
166 | + result.setResult(list); | |
167 | + result.setSuccess(true); | |
168 | + return result; | |
169 | + } | |
175 | 170 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
... | ... | @@ -1077,7 +1077,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1077 | 1077 | return Result.error("任务未找到,执行中止"); |
1078 | 1078 | } |
1079 | 1079 | String warehouseCode = taskHeader.getWarehouseCode(); |
1080 | -// String fromLocationCode = taskHeader.getFromLocationCode(); | |
1080 | + String fromLocationCode = taskHeader.getFromLocationCode(); | |
1081 | 1081 | String toLocationCode = taskHeader.getToLocationCode(); |
1082 | 1082 | String containerCode = taskHeader.getContainerCode(); |
1083 | 1083 | String zoneCode = taskHeader.getZoneCode(); |
... | ... | @@ -1195,6 +1195,14 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1195 | 1195 | throw new ServiceException("完成入库任务时,保存库存交易失败"); |
1196 | 1196 | } |
1197 | 1197 | |
1198 | + if (StringUtils.isEmpty(fromLocationCode)) { | |
1199 | + success = | |
1200 | + locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
1201 | + if (!success) { | |
1202 | + throw new ServiceException("完成入库任务时,更新源库位失败"); | |
1203 | + } | |
1204 | + } | |
1205 | + | |
1198 | 1206 | success = locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); |
1199 | 1207 | if (!success) { |
1200 | 1208 | throw new ServiceException("完成入库任务时,更新库位失败"); |
... | ... |