Commit 04d072940106e9a3758da840e9f441ab32744ecf
Merge branch 'develop4' of http://www.huahengrobot.com:90/wms/wms4 into develop4
Showing
11 changed files
with
138 additions
and
120 deletions
ant-design-vue-jeecg/src/views/system/UserList.vue
@@ -22,8 +22,6 @@ | @@ -22,8 +22,6 @@ | ||
22 | </a-select> | 22 | </a-select> |
23 | </a-form-item> | 23 | </a-form-item> |
24 | </a-col> | 24 | </a-col> |
25 | - | ||
26 | - | ||
27 | <template v-if="toggleSearchStatus"> | 25 | <template v-if="toggleSearchStatus"> |
28 | <a-col :md="6" :sm="8"> | 26 | <a-col :md="6" :sm="8"> |
29 | <a-form-item label="真实名字"> | 27 | <a-form-item label="真实名字"> |
@@ -58,7 +56,6 @@ | @@ -58,7 +56,6 @@ | ||
58 | </a> | 56 | </a> |
59 | </span> | 57 | </span> |
60 | </a-col> | 58 | </a-col> |
61 | - | ||
62 | </a-row> | 59 | </a-row> |
63 | </a-form> | 60 | </a-form> |
64 | </div> | 61 | </div> |
@@ -106,6 +103,7 @@ | @@ -106,6 +103,7 @@ | ||
106 | </div> | 103 | </div> |
107 | 104 | ||
108 | <a-table | 105 | <a-table |
106 | + :scroll="{x: 1200}" | ||
109 | ref="table" | 107 | ref="table" |
110 | bordered | 108 | bordered |
111 | size="middle" | 109 | size="middle" |
@@ -117,7 +115,7 @@ | @@ -117,7 +115,7 @@ | ||
117 | :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" | 115 | :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" |
118 | @change="handleTableChange"> | 116 | @change="handleTableChange"> |
119 | 117 | ||
120 | - <template slot="avatarslot" slot-scope="text, record, index"> | 118 | + <template slot="avatarslot" slot-scope="text, record"> |
121 | <div class="anty-img-wrap"> | 119 | <div class="anty-img-wrap"> |
122 | <a-avatar shape="square" :src="getAvatarView(record.avatar)" icon="user"/> | 120 | <a-avatar shape="square" :src="getAvatarView(record.avatar)" icon="user"/> |
123 | </div> | 121 | </div> |
@@ -240,7 +238,7 @@ export default { | @@ -240,7 +238,7 @@ export default { | ||
240 | { | 238 | { |
241 | title: '头像', | 239 | title: '头像', |
242 | align: "center", | 240 | align: "center", |
243 | - width: 120, | 241 | + width: 100, |
244 | dataIndex: 'avatar', | 242 | dataIndex: 'avatar', |
245 | scopedSlots: {customRender: "avatarslot"} | 243 | scopedSlots: {customRender: "avatarslot"} |
246 | }, | 244 | }, |
@@ -273,7 +271,6 @@ export default { | @@ -273,7 +271,6 @@ export default { | ||
273 | { | 271 | { |
274 | title: '负责部门', | 272 | title: '负责部门', |
275 | align: "center", | 273 | align: "center", |
276 | - width: 180, | ||
277 | dataIndex: 'departIds_dictText' | 274 | dataIndex: 'departIds_dictText' |
278 | }, | 275 | }, |
279 | { | 276 | { |
@@ -285,9 +282,10 @@ export default { | @@ -285,9 +282,10 @@ export default { | ||
285 | { | 282 | { |
286 | title: '操作', | 283 | title: '操作', |
287 | dataIndex: 'action', | 284 | dataIndex: 'action', |
285 | + fixed: 'right', | ||
288 | scopedSlots: {customRender: 'action'}, | 286 | scopedSlots: {customRender: 'action'}, |
289 | align: "center", | 287 | align: "center", |
290 | - width: 170 | 288 | + width: 150 |
291 | } | 289 | } |
292 | 290 | ||
293 | ], | 291 | ], |
huaheng-wms-core/src/main/java/org/jeecg/JeecgSystemApplication.java
1 | package org.jeecg; | 1 | package org.jeecg; |
2 | 2 | ||
3 | +import java.net.Inet4Address; | ||
4 | +import java.net.Inet6Address; | ||
3 | import java.net.InetAddress; | 5 | import java.net.InetAddress; |
4 | import java.net.NetworkInterface; | 6 | import java.net.NetworkInterface; |
7 | +import java.net.SocketException; | ||
5 | import java.net.UnknownHostException; | 8 | import java.net.UnknownHostException; |
6 | import java.util.Enumeration; | 9 | import java.util.Enumeration; |
7 | 10 | ||
11 | +import javax.transaction.SystemException; | ||
12 | + | ||
8 | import org.jeecg.common.util.oConvertUtils; | 13 | import org.jeecg.common.util.oConvertUtils; |
9 | import org.springframework.boot.SpringApplication; | 14 | import org.springframework.boot.SpringApplication; |
10 | //import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | 15 | //import org.springframework.boot.autoconfigure.EnableAutoConfiguration; |
@@ -32,7 +37,7 @@ public class JeecgSystemApplication extends SpringBootServletInitializer { | @@ -32,7 +37,7 @@ public class JeecgSystemApplication extends SpringBootServletInitializer { | ||
32 | return application.sources(JeecgSystemApplication.class); | 37 | return application.sources(JeecgSystemApplication.class); |
33 | } | 38 | } |
34 | 39 | ||
35 | - public static void main(String[] args) throws UnknownHostException { | 40 | + public static void main(String[] args) throws SystemException, UnknownHostException { |
36 | ConfigurableApplicationContext application = SpringApplication.run(JeecgSystemApplication.class, args); | 41 | ConfigurableApplicationContext application = SpringApplication.run(JeecgSystemApplication.class, args); |
37 | Environment env = application.getEnvironment(); | 42 | Environment env = application.getEnvironment(); |
38 | String ip = getLocalHostExactAddress().getHostAddress(); | 43 | String ip = getLocalHostExactAddress().getHostAddress(); |
@@ -46,40 +51,29 @@ public class JeecgSystemApplication extends SpringBootServletInitializer { | @@ -46,40 +51,29 @@ public class JeecgSystemApplication extends SpringBootServletInitializer { | ||
46 | + "WEB External: \thttp://" + ip + ":" + port + path + "/index.html\n\t" | 51 | + "WEB External: \thttp://" + ip + ":" + port + path + "/index.html\n\t" |
47 | + "API External: \thttp://" + ip + ":" + port + path + "/\n\n\t" | 52 | + "API External: \thttp://" + ip + ":" + port + path + "/\n\n\t" |
48 | + "Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n\n\t" | 53 | + "Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n\n\t" |
49 | - + "The following profiles are active: " + profiles + "\n" | 54 | + + "The following profiles are active: [" + profiles + "]\n" |
50 | + "----------------------------------------------------------"); | 55 | + "----------------------------------------------------------"); |
51 | } | 56 | } |
52 | - | 57 | + |
53 | public static InetAddress getLocalHostExactAddress() { | 58 | public static InetAddress getLocalHostExactAddress() { |
54 | try { | 59 | try { |
55 | - InetAddress candidateAddress = null; | 60 | + InetAddress inetAddress = null; |
56 | 61 | ||
57 | Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); | 62 | Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); |
58 | while (networkInterfaces.hasMoreElements()) { | 63 | while (networkInterfaces.hasMoreElements()) { |
59 | - NetworkInterface iface = networkInterfaces.nextElement(); | ||
60 | - // 该网卡接口下的ip会有多个,也需要一个个的遍历,找到自己所需要的 | ||
61 | - for (Enumeration<InetAddress> inetAddrs = iface.getInetAddresses(); inetAddrs.hasMoreElements();) { | ||
62 | - InetAddress inetAddr = inetAddrs.nextElement(); | ||
63 | - // 排除loopback回环类型地址(不管是IPv4还是IPv6 只要是回环地址都会返回true) | ||
64 | - if (!inetAddr.isLoopbackAddress()) { | ||
65 | - if (inetAddr.isSiteLocalAddress()) { | ||
66 | - // 如果是site-local地址,就是它了 就是我们要找的 | ||
67 | - // ~~~~~~~~~~~~~绝大部分情况下都会在此处返回你的ip地址值~~~~~~~~~~~~~ | ||
68 | - return inetAddr; | ||
69 | - } | ||
70 | - | ||
71 | - // 若不是site-local地址 那就记录下该地址当作候选 | ||
72 | - if (candidateAddress == null) { | ||
73 | - candidateAddress = inetAddr; | ||
74 | - } | ||
75 | - | 64 | + NetworkInterface netInterface = networkInterfaces.nextElement(); |
65 | + // System.out.println(netInterface.getName()); | ||
66 | + Enumeration<InetAddress> addresses = netInterface.getInetAddresses(); | ||
67 | + while (addresses.hasMoreElements()) { | ||
68 | + InetAddress ipTmp = addresses.nextElement(); | ||
69 | + if (ipTmp != null && ipTmp instanceof Inet4Address && ipTmp.isSiteLocalAddress() && !ipTmp.isLoopbackAddress() | ||
70 | + && ipTmp.getHostAddress().indexOf(":") == -1) { | ||
71 | + inetAddress = ipTmp; | ||
76 | } | 72 | } |
77 | } | 73 | } |
78 | } | 74 | } |
79 | - | ||
80 | - // 如果出去loopback回环地之外无其它地址了,那就回退到原始方案吧 | ||
81 | - return candidateAddress == null ? InetAddress.getLocalHost() : candidateAddress; | ||
82 | - } catch (Exception e) { | 75 | + return inetAddress == null ? InetAddress.getLocalHost() : inetAddress; |
76 | + } catch (SocketException | UnknownHostException e) { | ||
83 | e.printStackTrace(); | 77 | e.printStackTrace(); |
84 | } | 78 | } |
85 | return null; | 79 | return null; |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/mapper/xml/LocationMapper.xml
@@ -3,24 +3,30 @@ | @@ -3,24 +3,30 @@ | ||
3 | <mapper namespace="org.jeecg.modules.wms.config.location.mapper.LocationMapper"> | 3 | <mapper namespace="org.jeecg.modules.wms.config.location.mapper.LocationMapper"> |
4 | 4 | ||
5 | <select id="getAllLocation" resultType="org.jeecg.modules.wms.config.location.entity.Location"> | 5 | <select id="getAllLocation" resultType="org.jeecg.modules.wms.config.location.entity.Location"> |
6 | - select max(row) as row,max(icolumn) as icolumn,max(layer) as layer,max(grid) as grid from location where warehouse_code=#{warehouseCode} AND location_type_code=#{type} | 6 | + SELECT max(row) as row, |
7 | + max(icolumn) as icolumn, | ||
8 | + max(layer) as layer, | ||
9 | + max(grid) as grid | ||
10 | + FROM location | ||
11 | + WHERE warehouse_code = #{warehouseCode} | ||
12 | + AND location_type_code = #{type} | ||
7 | </select> | 13 | </select> |
14 | + | ||
8 | <select id="getFirstRowOfZone" resultType="java.lang.Integer"> | 15 | <select id="getFirstRowOfZone" resultType="java.lang.Integer"> |
9 | - select min(row) from location where warehouse_code=#{warehouseCode} and location_type_code = #{locationType} | 16 | + select min(row) from location where warehouse_code=#{warehouseCode} and location_type_code = #{locationType} |
10 | </select> | 17 | </select> |
18 | + | ||
11 | <select id="listEmptyContainerInLocation" parameterType="org.jeecg.modules.wms.config.location.entity.Location" | 19 | <select id="listEmptyContainerInLocation" parameterType="org.jeecg.modules.wms.config.location.entity.Location" |
12 | - resultType="org.jeecg.modules.wms.config.location.entity.Location"> | ||
13 | - SELECT * | ||
14 | - FROM location t | 20 | + resultType="org.jeecg.modules.wms.config.location.entity.Location"> |
21 | + SELECT * | ||
22 | + FROM location t | ||
15 | <where> | 23 | <where> |
16 | AND t.warehouse_code = #{location.warehouseCode} | 24 | AND t.warehouse_code = #{location.warehouseCode} |
17 | - AND t.status='empty' | ||
18 | - AND t.container_code !='' | 25 | + AND t.status = 'empty' |
26 | + AND t.container_code != '' | ||
19 | AND t.container_code is not NULL | 27 | AND t.container_code is not NULL |
20 | - AND t.container_code NOT in (SELECT h.container_code from task_header h WHERE status < 100 AND | ||
21 | - warehouse_code=#{location.warehouseCode}) | ||
22 | - and t.`code` in(select cc.location_code from container cc where cc.`status`='empty' and cc.warehouse_code | ||
23 | - =#{location.warehouseCode}) | 28 | + AND t.container_code NOT IN (SELECT h.container_code from task_header h WHERE status < 100 AND warehouse_code = #{location.warehouseCode}) |
29 | + AND t.`code` IN (SELECT cc.location_code FROM container cc WHERE cc.`status`='empty' AND cc.warehouse_code = #{location.warehouseCode}) | ||
24 | <if test="location.zoneCode != null and location.zoneCode !=''"> | 30 | <if test="location.zoneCode != null and location.zoneCode !=''"> |
25 | and t.zone_code = #{location.zoneCode} | 31 | and t.zone_code = #{location.zoneCode} |
26 | </if> | 32 | </if> |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/controller/HuahengBaseController.java
@@ -4,14 +4,10 @@ import java.util.concurrent.TimeUnit; | @@ -4,14 +4,10 @@ import java.util.concurrent.TimeUnit; | ||
4 | 4 | ||
5 | import javax.annotation.Nonnull; | 5 | import javax.annotation.Nonnull; |
6 | 6 | ||
7 | -import org.apache.poi.ss.formula.functions.T; | ||
8 | import org.jeecg.common.api.vo.Result; | 7 | import org.jeecg.common.api.vo.Result; |
9 | -import org.jeecg.common.system.base.controller.JeecgController; | ||
10 | import org.jeecg.utils.RedissonDistributedLocker; | 8 | import org.jeecg.utils.RedissonDistributedLocker; |
11 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
12 | 10 | ||
13 | -import com.baomidou.mybatisplus.extension.service.IService; | ||
14 | - | ||
15 | import cn.hutool.core.date.SystemClock; | 11 | import cn.hutool.core.date.SystemClock; |
16 | import cn.hutool.core.util.StrUtil; | 12 | import cn.hutool.core.util.StrUtil; |
17 | import lombok.extern.slf4j.Slf4j; | 13 | import lombok.extern.slf4j.Slf4j; |
@@ -26,7 +22,7 @@ public class HuahengBaseController { | @@ -26,7 +22,7 @@ public class HuahengBaseController { | ||
26 | private RedissonDistributedLocker redissonDistributedLocker; | 22 | private RedissonDistributedLocker redissonDistributedLocker; |
27 | 23 | ||
28 | public interface MultiProcessListener { | 24 | public interface MultiProcessListener { |
29 | - Result<?> doProcess(); | 25 | + Result<?> doProcess() throws Exception; |
30 | } | 26 | } |
31 | 27 | ||
32 | /** 等待时间 */ | 28 | /** 等待时间 */ |
@@ -69,17 +65,20 @@ public class HuahengBaseController { | @@ -69,17 +65,20 @@ public class HuahengBaseController { | ||
69 | final boolean tryLock = redissonDistributedLocker.tryLock(fullLockKey, TimeUnit.SECONDS, WAIT_TIME, LEASE_TIME); | 65 | final boolean tryLock = redissonDistributedLocker.tryLock(fullLockKey, TimeUnit.SECONDS, WAIT_TIME, LEASE_TIME); |
70 | final long endTime = SystemClock.now(); | 66 | final long endTime = SystemClock.now(); |
71 | if (!tryLock) { | 67 | if (!tryLock) { |
72 | - log.error("[{}]获取分布式锁失败,lockKey = {},耗时 {}ms", taskName, fullLockKey, endTime - startTime); | ||
73 | - throw new RuntimeException(StrUtil.format("[{}]获取分布式锁失败,lockKey = {},等待时间超出10秒", taskName, fullLockKey)); | 68 | + log.error("[{}] 获取分布式锁失败 lockKey = {},等待锁耗时:{}ms", taskName, fullLockKey, endTime - startTime); |
69 | + throw new RuntimeException(StrUtil.format("[{}] 获取分布式锁失败 lockKey = {},等待时间超出10秒", taskName, fullLockKey)); | ||
74 | } | 70 | } |
75 | // 注意:一定是获取锁成功后,才进行try{}finally{释放锁} | 71 | // 注意:一定是获取锁成功后,才进行try{}finally{释放锁} |
76 | try { | 72 | try { |
77 | - log.info("[{}]获取分布式锁成功,lockKey = {},耗时 {}ms", taskName, fullLockKey, endTime - startTime); | 73 | + log.info("[{}] 开始分布式事务 lockKey = {},获取锁耗时: {}ms", taskName, fullLockKey, endTime - startTime); |
78 | result = multiProcessListener.doProcess(); | 74 | result = multiProcessListener.doProcess(); |
79 | } catch (Exception e) { | 75 | } catch (Exception e) { |
80 | - throw new RuntimeException(StrUtil.format("[{}]执行分布式事务失败,lockKey = {}", taskName, fullLockKey), e); | 76 | + final long finishTime = SystemClock.now(); |
77 | + throw new RuntimeException(StrUtil.format("[{}] 执行分布式事务失败 lockKey = {},事务耗时:{}ms", taskName, fullLockKey, finishTime - endTime), e); | ||
81 | } finally { | 78 | } finally { |
82 | redissonDistributedLocker.unlock(fullLockKey); | 79 | redissonDistributedLocker.unlock(fullLockKey); |
80 | + final long finishTime = SystemClock.now(); | ||
81 | + log.info("[{}] 结束分布式事务 lockKey = {},事务耗时:{}ms", taskName, fullLockKey, finishTime - endTime); | ||
83 | } | 82 | } |
84 | 83 | ||
85 | return result; | 84 | return result; |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/controller/TestController.java
1 | package org.jeecg.modules.wms.framework.controller; | 1 | package org.jeecg.modules.wms.framework.controller; |
2 | 2 | ||
3 | +import java.security.NoSuchAlgorithmException; | ||
4 | +import java.security.SecureRandom; | ||
5 | +import java.util.Date; | ||
3 | import java.util.Map; | 6 | import java.util.Map; |
4 | -import java.util.concurrent.ConcurrentHashMap; | ||
5 | 7 | ||
6 | import javax.servlet.http.HttpServletRequest; | 8 | import javax.servlet.http.HttpServletRequest; |
7 | 9 | ||
8 | import org.jeecg.common.api.vo.Result; | 10 | import org.jeecg.common.api.vo.Result; |
9 | import org.jeecg.common.aspect.annotation.AutoLog; | 11 | import org.jeecg.common.aspect.annotation.AutoLog; |
10 | -import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; | 12 | +import org.jeecg.modules.system.entity.SysDataLog; |
13 | +import org.jeecg.modules.system.service.ISysDataLogService; | ||
11 | import org.jeecg.utils.HuahengRedisUtil; | 14 | import org.jeecg.utils.HuahengRedisUtil; |
12 | import org.springframework.beans.factory.annotation.Autowired; | 15 | import org.springframework.beans.factory.annotation.Autowired; |
16 | +import org.springframework.transaction.annotation.Transactional; | ||
13 | import org.springframework.web.bind.annotation.PostMapping; | 17 | import org.springframework.web.bind.annotation.PostMapping; |
14 | import org.springframework.web.bind.annotation.RequestBody; | 18 | import org.springframework.web.bind.annotation.RequestBody; |
15 | import org.springframework.web.bind.annotation.RequestMapping; | 19 | import org.springframework.web.bind.annotation.RequestMapping; |
@@ -17,7 +21,8 @@ import org.springframework.web.bind.annotation.ResponseBody; | @@ -17,7 +21,8 @@ import org.springframework.web.bind.annotation.ResponseBody; | ||
17 | import org.springframework.web.bind.annotation.RestController; | 21 | import org.springframework.web.bind.annotation.RestController; |
18 | 22 | ||
19 | import com.alibaba.fastjson.JSON; | 23 | import com.alibaba.fastjson.JSON; |
20 | -import com.alibaba.fastjson.TypeReference; | 24 | +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
25 | +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | ||
21 | 26 | ||
22 | import lombok.extern.slf4j.Slf4j; | 27 | import lombok.extern.slf4j.Slf4j; |
23 | 28 | ||
@@ -34,43 +39,51 @@ public class TestController extends HuahengBaseController { | @@ -34,43 +39,51 @@ public class TestController extends HuahengBaseController { | ||
34 | @Autowired | 39 | @Autowired |
35 | private HuahengRedisUtil redisUtil; | 40 | private HuahengRedisUtil redisUtil; |
36 | 41 | ||
42 | + @Autowired | ||
43 | + private ISysDataLogService sysDataLogService; | ||
44 | + | ||
37 | @AutoLog(value = "TestController-testRedis") | 45 | @AutoLog(value = "TestController-testRedis") |
38 | @ResponseBody | 46 | @ResponseBody |
39 | @PostMapping(value = "/testRedis") | 47 | @PostMapping(value = "/testRedis") |
40 | - public Result<?> testRedis(@RequestBody Map<String, String> paramMap, HttpServletRequest request) throws InterruptedException { | ||
41 | - | ||
42 | -// log.info(JSON.toJSONString(paramMap)); | ||
43 | - String key = "testKey"; | ||
44 | - Map<String, ReceiptHeader> receiptHeaderMap = new ConcurrentHashMap<String, ReceiptHeader>(); | ||
45 | - ReceiptHeader value = new ReceiptHeader(); | ||
46 | - value.setCode("001"); | ||
47 | - receiptHeaderMap.put("receiptHeader1", value); | ||
48 | - redisUtil.set(key, receiptHeaderMap); | ||
49 | -// Map<String, ReceiptHeader> result = redisUtil.get(key, new TypeReference<Map<String, ReceiptHeader>>() {}); | ||
50 | -// log.info("redisUtil.get -> " + JSON.toJSONString(result)); | 48 | + public Result<?> testRedis(@RequestBody Map<String, String> paramMap, HttpServletRequest request) { |
49 | + | ||
50 | +// log.info("testRedis in paramMap:{}", JSON.toJSONString(paramMap)); | ||
51 | +// String key = "testKey"; | ||
52 | +// Map<String, ReceiptHeader> receiptHeaderMap = new ConcurrentHashMap<String, ReceiptHeader>(); | ||
53 | +// ReceiptHeader receiptHeader = new ReceiptHeader(); | ||
54 | +// receiptHeader.setCode("001"); | ||
55 | +// receiptHeaderMap.put("receiptHeaderKey", receiptHeader); | ||
56 | +// Map<String, ReceiptHeader> value = redisUtil.getAndSet(key, receiptHeaderMap, new TypeReference<Map<String, ReceiptHeader>>() {}, 10); | ||
51 | // Long rxpireTime = redisUtil.getExpire(key); | 57 | // Long rxpireTime = redisUtil.getExpire(key); |
52 | -// log.info("rxpireTime -> " + rxpireTime); | ||
53 | -// redisUtil.expire(key, 100); | 58 | +// log.info("redisUtil.getAndSet {} -> {} rxpireTime -> {}", key, JSON.toJSONString(value), rxpireTime); |
59 | +// | ||
60 | +// Thread.sleep(2000l); | ||
61 | +// receiptHeaderMap = redisUtil.get(key, new TypeReference<Map<String, ReceiptHeader>>() {}); | ||
54 | // rxpireTime = redisUtil.getExpire(key); | 62 | // rxpireTime = redisUtil.getExpire(key); |
55 | -// log.info("rxpireTime -> " + rxpireTime); | ||
56 | -// value.setCode("2222222222222222"); | ||
57 | - redisUtil.delete(key); | ||
58 | - Map<String, ReceiptHeader> result = redisUtil.getAndSet(key, receiptHeaderMap, new TypeReference<Map<String, ReceiptHeader>>() {}, 10); | ||
59 | - Long rxpireTime = redisUtil.getExpire(key); | ||
60 | - log.info("redisUtil.get -> {} rxpireTime -> {}", JSON.toJSONString(result), rxpireTime); | ||
61 | - | ||
62 | - Thread.sleep(2000l); | ||
63 | - result = redisUtil.get(key, new TypeReference<Map<String, ReceiptHeader>>() {}); | ||
64 | - rxpireTime = redisUtil.getExpire(key); | ||
65 | - log.info("redisUtil.get sleep 2s -> {} rxpireTime -> {}", JSON.toJSONString(result), rxpireTime); | ||
66 | - | ||
67 | - Long count = redisUtil.decr("countKey", 10); | ||
68 | - rxpireTime = redisUtil.getExpire("countKey"); | ||
69 | - log.info("countKey decr count -> {} rxpireTime -> {}", count, rxpireTime); | ||
70 | - count = redisUtil.decr("countKey", 100); | ||
71 | - rxpireTime = redisUtil.getExpire("countKey"); | ||
72 | - log.info("countKey decr count -> {} rxpireTime -> {}", count, rxpireTime); | ||
73 | - | 63 | +// log.info("redisUtil.get {} sleep 2s -> {} rxpireTime -> {}", key, JSON.toJSONString(value), rxpireTime); |
64 | + | ||
65 | + Result result = handleMultiProcess("testRedis", paramMap.get("username"), new MultiProcessListener() { | ||
66 | + | ||
67 | + @Override | ||
68 | + @Transactional(timeout = 10) | ||
69 | + public Result<?> doProcess() throws Exception { | ||
70 | + LambdaUpdateWrapper<SysDataLog> updateWrapper = new UpdateWrapper().lambda(); | ||
71 | + updateWrapper.set(SysDataLog::getUpdateTime, new Date()); | ||
72 | + updateWrapper.eq(SysDataLog::getId, 10); | ||
73 | + Thread.sleep(1000); | ||
74 | + sysDataLogService.update(updateWrapper); | ||
75 | + return new Result<>(); | ||
76 | + } | ||
77 | + | ||
78 | + }); | ||
79 | + | ||
80 | +// Long count = redisUtil.decr("countKey", 10); | ||
81 | +// rxpireTime = redisUtil.getExpire("countKey"); | ||
82 | +// log.info("countKey decr count -> {} rxpireTime -> {}", count, rxpireTime); | ||
83 | +// count = redisUtil.decr("countKey", 100); | ||
84 | +// rxpireTime = redisUtil.getExpire("countKey"); | ||
85 | +// log.info("countKey decr count -> {} rxpireTime -> {}", count, rxpireTime); | ||
86 | + | ||
74 | // Thread.sleep(2000l); | 87 | // Thread.sleep(2000l); |
75 | // count = redisUtil.get("countKey", Long.class); | 88 | // count = redisUtil.get("countKey", Long.class); |
76 | // rxpireTime = redisUtil.getExpire("countKey"); | 89 | // rxpireTime = redisUtil.getExpire("countKey"); |
@@ -95,8 +108,11 @@ public class TestController extends HuahengBaseController { | @@ -95,8 +108,11 @@ public class TestController extends HuahengBaseController { | ||
95 | // rxpireTime = redisUtil.getExpire("countKey"); | 108 | // rxpireTime = redisUtil.getExpire("countKey"); |
96 | // log.info("countKey sleep 10s get -> {} rxpireTime -> {}", count, rxpireTime); | 109 | // log.info("countKey sleep 10s get -> {} rxpireTime -> {}", count, rxpireTime); |
97 | // log.info("countKey hasKey -> {}",redisUtil.hasKey("countKey")); | 110 | // log.info("countKey hasKey -> {}",redisUtil.hasKey("countKey")); |
98 | - | ||
99 | 111 | ||
100 | - return Result.OK(count); | 112 | + return result; |
113 | + } | ||
114 | + | ||
115 | + private int generateInt(int min, int max) throws NoSuchAlgorithmException { | ||
116 | + return (int)(min + SecureRandom.getInstanceStrong().nextDouble() * (max - min + 1)); | ||
101 | } | 117 | } |
102 | } | 118 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/home/service/impl/HomePageViewServiceImpl.java
@@ -4,6 +4,7 @@ import cn.hutool.core.util.ArrayUtil; | @@ -4,6 +4,7 @@ import cn.hutool.core.util.ArrayUtil; | ||
4 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 4 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
5 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 5 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
6 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | 6 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
7 | +import com.baomidou.mybatisplus.extension.service.IService; | ||
7 | import com.github.abel533.echarts.Option; | 8 | import com.github.abel533.echarts.Option; |
8 | import com.github.abel533.echarts.axis.Axis; | 9 | import com.github.abel533.echarts.axis.Axis; |
9 | import com.github.abel533.echarts.axis.CategoryAxis; | 10 | import com.github.abel533.echarts.axis.CategoryAxis; |
@@ -145,20 +146,16 @@ public class HomePageViewServiceImpl implements HomePageViewService { | @@ -145,20 +146,16 @@ public class HomePageViewServiceImpl implements HomePageViewService { | ||
145 | 146 | ||
146 | @Override | 147 | @Override |
147 | public Result<String> inventoryUtilization() { | 148 | public Result<String> inventoryUtilization() { |
148 | - // 查询所有容器 select限制字段速度更快 | ||
149 | - LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
150 | - locationLambdaQueryWrapper.select(Location::getContainerCode); | ||
151 | - List<Location> locations = locationServiceImpl.list(locationLambdaQueryWrapper); | ||
152 | - | ||
153 | // 先存储总数 | 149 | // 先存储总数 |
154 | - int inStock = locations.size(); | ||
155 | - | ||
156 | - // 总库位删除为空的数量长度 == 有货数量 | ||
157 | - locations.removeIf(location -> StringUtils.isEmpty(location.getContainerCode())); | ||
158 | - | ||
159 | - // 总数-有货数量 == 无货数量 | ||
160 | - inStock = inStock - locations.size(); | ||
161 | - | 150 | + Integer allStock = locationServiceImpl.count(); |
151 | + | ||
152 | + // 有货数量 = 总库位删除为空的数量长度 | ||
153 | + LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
154 | + locationLambdaQueryWrapper.isNotNull(Location::getContainerCode).ne(Location::getContainerCode, ""); | ||
155 | + int locationStock = locationServiceImpl.count(locationLambdaQueryWrapper); | ||
156 | + | ||
157 | + // 无货数量 = 总数 - 有货数量 | ||
158 | + Integer inStock = allStock - locationStock; | ||
162 | Option option = new Option(); | 159 | Option option = new Option(); |
163 | // option.title("库存状态分布").title().x("center"); | 160 | // option.title("库存状态分布").title().x("center"); |
164 | option.tooltip(Trigger.item).tooltip().formatter("{a} <br/>{b} : {c} ({d}%)"); | 161 | option.tooltip(Trigger.item).tooltip().formatter("{a} <br/>{b} : {c} ({d}%)"); |
@@ -187,7 +184,7 @@ public class HomePageViewServiceImpl implements HomePageViewService { | @@ -187,7 +184,7 @@ public class HomePageViewServiceImpl implements HomePageViewService { | ||
187 | pie.itemStyle().emphasis().setShadowColor("rgba(0, 0, 0, 0.4)"); | 184 | pie.itemStyle().emphasis().setShadowColor("rgba(0, 0, 0, 0.4)"); |
188 | 185 | ||
189 | option.legend().data().add("有货"); | 186 | option.legend().data().add("有货"); |
190 | - pie.data().add(new ChartData("有货", Convert.toDouble(locations.size()))); | 187 | + pie.data().add(new ChartData("有货", Convert.toDouble(locationStock))); |
191 | 188 | ||
192 | option.legend().data().add("无货"); | 189 | option.legend().data().add("无货"); |
193 | pie.data().add(new ChartData("无货", Convert.toDouble(inStock))); | 190 | pie.data().add(new ChartData("无货", Convert.toDouble(inStock))); |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
@@ -1076,6 +1076,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1076,6 +1076,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1076 | */ | 1076 | */ |
1077 | @Transactional(rollbackFor = Exception.class) | 1077 | @Transactional(rollbackFor = Exception.class) |
1078 | public Result completeReceiptTask(TaskHeader taskHeader) { | 1078 | public Result completeReceiptTask(TaskHeader taskHeader) { |
1079 | + if (taskHeader == null) { | ||
1080 | + return Result.error("任务未找到,执行中止"); | ||
1081 | + } | ||
1079 | String warehouseCode = taskHeader.getWarehouseCode(); | 1082 | String warehouseCode = taskHeader.getWarehouseCode(); |
1080 | String fromLocationCode = taskHeader.getFromLocationCode(); | 1083 | String fromLocationCode = taskHeader.getFromLocationCode(); |
1081 | String toLocationCode = taskHeader.getToLocationCode(); | 1084 | String toLocationCode = taskHeader.getToLocationCode(); |
@@ -1084,9 +1087,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1084,9 +1087,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1084 | int taskType = taskHeader.getTaskType(); | 1087 | int taskType = taskHeader.getTaskType(); |
1085 | List<TaskDetail> taskDetailList = taskDetailService.getTaskDetailListByTaskId(taskHeader.getId()); | 1088 | List<TaskDetail> taskDetailList = taskDetailService.getTaskDetailListByTaskId(taskHeader.getId()); |
1086 | boolean success = false; | 1089 | boolean success = false; |
1087 | - if (taskHeader == null) { | ||
1088 | - return Result.error("任务未找到,执行中止"); | ||
1089 | - } | ||
1090 | if (taskHeader.getStatus().equals(QuantityConstant.TASK_STATUS_COMPLETED)) { | 1090 | if (taskHeader.getStatus().equals(QuantityConstant.TASK_STATUS_COMPLETED)) { |
1091 | return Result.ok("任务(" + taskHeader.getId() + ")任务已经是完成的!"); | 1091 | return Result.ok("任务(" + taskHeader.getId() + ")任务已经是完成的!"); |
1092 | } | 1092 | } |
@@ -1234,6 +1234,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1234,6 +1234,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1234 | */ | 1234 | */ |
1235 | @Transactional(rollbackFor = Exception.class) | 1235 | @Transactional(rollbackFor = Exception.class) |
1236 | public Result completeShipmentTask(TaskHeader taskHeader) { | 1236 | public Result completeShipmentTask(TaskHeader taskHeader) { |
1237 | + if (taskHeader == null) { | ||
1238 | + return Result.error("完成出库任务未找到,执行中止"); | ||
1239 | + } | ||
1237 | String warehouseCode = taskHeader.getWarehouseCode(); | 1240 | String warehouseCode = taskHeader.getWarehouseCode(); |
1238 | String fromLocationCode = taskHeader.getFromLocationCode(); | 1241 | String fromLocationCode = taskHeader.getFromLocationCode(); |
1239 | String toLocationCode = taskHeader.getToLocationCode(); | 1242 | String toLocationCode = taskHeader.getToLocationCode(); |
@@ -1242,9 +1245,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1242,9 +1245,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1242 | int taskType = taskHeader.getTaskType(); | 1245 | int taskType = taskHeader.getTaskType(); |
1243 | List<TaskDetail> taskDetailList = taskDetailService.getTaskDetailListByTaskId(taskHeader.getId()); | 1246 | List<TaskDetail> taskDetailList = taskDetailService.getTaskDetailListByTaskId(taskHeader.getId()); |
1244 | boolean success = false; | 1247 | boolean success = false; |
1245 | - if (taskHeader == null) { | ||
1246 | - return Result.error("完成出库任务未找到,执行中止"); | ||
1247 | - } | ||
1248 | if (taskHeader.getStatus().equals(QuantityConstant.TASK_STATUS_COMPLETED)) { | 1248 | if (taskHeader.getStatus().equals(QuantityConstant.TASK_STATUS_COMPLETED)) { |
1249 | return Result.ok("完成出库任务,(" + taskHeader.getId() + ")任务已经是完成的!"); | 1249 | return Result.ok("完成出库任务,(" + taskHeader.getId() + ")任务已经是完成的!"); |
1250 | } | 1250 | } |
huaheng-wms-core/src/main/resources/application-dev.yml
@@ -47,7 +47,7 @@ spring: | @@ -47,7 +47,7 @@ spring: | ||
47 | org: | 47 | org: |
48 | quartz: | 48 | quartz: |
49 | scheduler: | 49 | scheduler: |
50 | - instanceName: Scheduler_Dev | 50 | + instanceName: dev |
51 | instanceId: AUTO | 51 | instanceId: AUTO |
52 | jobStore: | 52 | jobStore: |
53 | class: org.quartz.impl.jdbcjobstore.JobStoreTX | 53 | class: org.quartz.impl.jdbcjobstore.JobStoreTX |
@@ -167,10 +167,12 @@ mybatis-plus: | @@ -167,10 +167,12 @@ mybatis-plus: | ||
167 | # 默认数据库表下划线命名 | 167 | # 默认数据库表下划线命名 |
168 | table-underline: true | 168 | table-underline: true |
169 | configuration: | 169 | configuration: |
170 | + map-underscore-to-camel-case: true | ||
171 | + auto-mapping-behavior: full | ||
170 | # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用 | 172 | # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用 |
171 | - log-impl: org.apache.ibatis.logging.stdout.StdOutImpl | 173 | + # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
172 | # 返回类型为Map,显示null对应的字段 | 174 | # 返回类型为Map,显示null对应的字段 |
173 | - call-setters-on-nulls: false | 175 | + call-setters-on-nulls: true |
174 | #jeecg专用配置 | 176 | #jeecg专用配置 |
175 | minidao: | 177 | minidao: |
176 | base-package: org.jeecg.modules.jmreport.* | 178 | base-package: org.jeecg.modules.jmreport.* |
@@ -271,8 +273,8 @@ cas: | @@ -271,8 +273,8 @@ cas: | ||
271 | #Mybatis输出sql日志 | 273 | #Mybatis输出sql日志 |
272 | logging: | 274 | logging: |
273 | level: | 275 | level: |
274 | - org.jeecg.modules.base.mapper: debug | ||
275 | org.jeecg.modules.wms: debug | 276 | org.jeecg.modules.wms: debug |
277 | + org.springframework: info | ||
276 | #swagger | 278 | #swagger |
277 | knife4j: | 279 | knife4j: |
278 | #开启增强配置 | 280 | #开启增强配置 |
huaheng-wms-core/src/main/resources/application-prod.yml
@@ -47,7 +47,7 @@ spring: | @@ -47,7 +47,7 @@ spring: | ||
47 | org: | 47 | org: |
48 | quartz: | 48 | quartz: |
49 | scheduler: | 49 | scheduler: |
50 | - instanceName: Scheduler_Prod | 50 | + instanceName: prod |
51 | instanceId: AUTO | 51 | instanceId: AUTO |
52 | jobStore: | 52 | jobStore: |
53 | class: org.quartz.impl.jdbcjobstore.JobStoreTX | 53 | class: org.quartz.impl.jdbcjobstore.JobStoreTX |
@@ -167,6 +167,8 @@ mybatis-plus: | @@ -167,6 +167,8 @@ mybatis-plus: | ||
167 | # 默认数据库表下划线命名 | 167 | # 默认数据库表下划线命名 |
168 | table-underline: true | 168 | table-underline: true |
169 | configuration: | 169 | configuration: |
170 | + map-underscore-to-camel-case: true | ||
171 | + auto-mapping-behavior: full | ||
170 | # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用 | 172 | # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用 |
171 | #log-impl: org.apache.ibatis.logging.stdout.StdOutImpl | 173 | #log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
172 | # 返回类型为Map,显示null对应的字段 | 174 | # 返回类型为Map,显示null对应的字段 |
@@ -260,7 +262,8 @@ cas: | @@ -260,7 +262,8 @@ cas: | ||
260 | #Mybatis输出sql日志 | 262 | #Mybatis输出sql日志 |
261 | logging: | 263 | logging: |
262 | level: | 264 | level: |
263 | - org.jeecg.modules.system.mapper: info | 265 | + org.jeecg.modules.wms: info |
266 | + org.springframework: info | ||
264 | #swagger | 267 | #swagger |
265 | knife4j: | 268 | knife4j: |
266 | #开启增强配置 | 269 | #开启增强配置 |
huaheng-wms-core/src/main/resources/application-test.yml
@@ -47,7 +47,7 @@ spring: | @@ -47,7 +47,7 @@ spring: | ||
47 | org: | 47 | org: |
48 | quartz: | 48 | quartz: |
49 | scheduler: | 49 | scheduler: |
50 | - instanceName: Scheduler_Test | 50 | + instanceName: test |
51 | instanceId: AUTO | 51 | instanceId: AUTO |
52 | jobStore: | 52 | jobStore: |
53 | class: org.quartz.impl.jdbcjobstore.JobStoreTX | 53 | class: org.quartz.impl.jdbcjobstore.JobStoreTX |
@@ -167,10 +167,12 @@ mybatis-plus: | @@ -167,10 +167,12 @@ mybatis-plus: | ||
167 | # 默认数据库表下划线命名 | 167 | # 默认数据库表下划线命名 |
168 | table-underline: true | 168 | table-underline: true |
169 | configuration: | 169 | configuration: |
170 | + map-underscore-to-camel-case: true | ||
171 | + auto-mapping-behavior: full | ||
170 | # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用 | 172 | # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用 |
171 | - log-impl: org.apache.ibatis.logging.stdout.StdOutImpl | 173 | + # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
172 | # 返回类型为Map,显示null对应的字段 | 174 | # 返回类型为Map,显示null对应的字段 |
173 | - call-setters-on-nulls: false | 175 | + call-setters-on-nulls: true |
174 | #jeecg专用配置 | 176 | #jeecg专用配置 |
175 | minidao: | 177 | minidao: |
176 | base-package: org.jeecg.modules.jmreport.* | 178 | base-package: org.jeecg.modules.jmreport.* |
@@ -272,7 +274,8 @@ cas: | @@ -272,7 +274,8 @@ cas: | ||
272 | #Mybatis输出sql日志 | 274 | #Mybatis输出sql日志 |
273 | logging: | 275 | logging: |
274 | level: | 276 | level: |
275 | - org.jeecg.modules.base.mapper: info | 277 | + org.jeecg.modules.wms: debug |
278 | + org.springframework: info | ||
276 | #swagger | 279 | #swagger |
277 | knife4j: | 280 | knife4j: |
278 | #开启增强配置 | 281 | #开启增强配置 |
huaheng-wms-core/src/main/resources/logback-spring.xml
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> | 15 | <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
16 | <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L | 16 | <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L |
17 | - %msg%n</pattern> --> | 17 | - %msg%n</pattern> --> |
18 | - <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan(%logger{50}:%L) - %msg%n</pattern> | 18 | + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n</pattern> |
19 | </encoder> | 19 | </encoder> |
20 | </appender> | 20 | </appender> |
21 | 21 |