From 40ae72314a61144e9a74b80d1f15ed6e627a002c Mon Sep 17 00:00:00 2001 From: yanps Date: Wed, 8 May 2024 08:54:42 +0800 Subject: [PATCH 1/3] =?UTF-8?q?opt:=20=E8=AE=BE=E5=A4=87=E6=8A=A5=E8=AD=A6?= =?UTF-8?q?=E5=AD=97=E5=85=B8=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stacker/standard_stacker/StandardStackerDeviceDriver.java | 3 ++- .../src/main/java/org/nl/acs/history/ErrorUtil.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java index 5d43e1295..214dcc8bb 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java @@ -21,6 +21,7 @@ import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; +import org.nl.acs.history.ErrorUtil; import org.nl.acs.history.service.DeviceErrorLogService; import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl; import org.nl.acs.instruction.domain.Instruction; @@ -1085,7 +1086,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme jo.put("command", command); jo.put("action", action); jo.put("task", task); - jo.put("error", this.getError()); + jo.put("error", ErrorUtil.getDictDetail("ddj_error_type", String.valueOf(this.getError()))); jo.put("message", LangProcess.msg(message)); jo.put("prohibitInWarehouse", this.prohibitInWarehouse); jo.put("prohibitOutWarehouse", this.prohibitOutWarehouse); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/ErrorUtil.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/ErrorUtil.java index 3699e3e55..83be744c2 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/ErrorUtil.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/ErrorUtil.java @@ -66,7 +66,7 @@ public class ErrorUtil { List dictDtos = dictDetailService.queryAll(); for (int i = 0; i < dictDtos.size(); i++) { Dict dictDto = dictDtos.get(i); - dictMap.put(dictDto.getName(), getDict(dictDto.getName(), dictDetailService::getDictByName)); + dictMap.put(dictDto.getCode(), getDict(dictDto.getCode(), dictDetailService::getDictByName)); } } } From 9c3d8f33225c80c4d8b2465d13421fb45ebec461 Mon Sep 17 00:00:00 2001 From: yanps Date: Wed, 8 May 2024 15:13:22 +0800 Subject: [PATCH 2/3] =?UTF-8?q?opt:=20=E8=B4=B4=E6=A0=87=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nishedProductOutBindLableDeviceDriver.java | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java index 250c4a72b..ed7fafc21 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java @@ -291,6 +291,11 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr if (move > 0 && !requireSucess) { applyLaStrangulationAndLabeling(mode); } + case 17: + //申请调试贴标 + if(move > 0 && !requireSucess){ + applyLaStrangulationAndLabeling(mode); + } break; } } @@ -413,6 +418,8 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr String bindingTemplate = jo.get("bindingTemplate").toString(); String printDevice = jo.get("printDevice").toString(); String bundleTimes = jo.get("bundleTimes").toString(); + String case1 = jo.get("case").toString(); + String direction = jo.get("direction").toString(); List list = new ArrayList(); if (mode == 10 || mode == 16) { @@ -521,6 +528,41 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr map12.put("value", labelingTemplate); list.add(map12); } + + if(mode == 17){ + Map map = new HashMap(); + map.put("code", "to_length"); + map.put("value", length); + list.add(map); + Map map2 = new HashMap(); + map2.put("code", "to_weight"); + map2.put("value", weight); + list.add(map2); + Map map3 = new HashMap(); + map3.put("code", "to_height"); + map3.put("value", height); + list.add(map3); + Map map5 = new HashMap(); + map5.put("code", "to_command"); + map5.put("value", mode); + list.add(map5); + Map map11 = new HashMap(); + map11.put("code", "to_binding_times"); + map11.put("value", bundleTimes); + list.add(map11); + if(StrUtil.isNotEmpty(case1) && !" ".equals(case1)){ + Map map12 = new HashMap(); + map12.put("code", "to_binding_times"); + map12.put("value", bundleTimes); + list.add(map12); + } + if(StrUtil.isNotEmpty(direction) && !" ".equals(direction)){ + Map map13 = new HashMap(); + map13.put("code", "to_direction"); + map13.put("value", direction); + list.add(map13); + } + } try { this.writing(list); } catch (Exception e) { From a60a4229ff67f0e06e80caa8245d597cbcab2ae9 Mon Sep 17 00:00:00 2001 From: "ZHOUZ\\Noble'lift" <1014987728@qq.com> Date: Wed, 8 May 2024 17:05:39 +0800 Subject: [PATCH 3/3] =?UTF-8?q?rev:=E6=96=B0=E5=A2=9E=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=AC=A1=E6=95=B0=E9=99=90=E5=88=B6=EF=BC=8C=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E6=AD=A3=E5=88=99=E8=A1=A8=E8=BE=BE=E5=BC=8F=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=EF=BC=8C=E5=8F=91=E8=B4=A7=E5=8C=BAAGV=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E7=94=9F=E6=88=90=E6=B7=BB=E5=8A=A0=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../secutiry/impl/OnlineUserService.java | 54 +++++++++++++++++-- .../acs/service/impl/AcsToWmsServiceImpl.java | 17 ++++++ .../src/views/system/user/index.vue | 10 ++-- 3 files changed, 74 insertions(+), 7 deletions(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/system/service/secutiry/impl/OnlineUserService.java b/lms/nladmin-system/src/main/java/org/nl/system/service/secutiry/impl/OnlineUserService.java index 4cbf77257..b1c4ed29b 100644 --- a/lms/nladmin-system/src/main/java/org/nl/system/service/secutiry/impl/OnlineUserService.java +++ b/lms/nladmin-system/src/main/java/org/nl/system/service/secutiry/impl/OnlineUserService.java @@ -37,6 +37,7 @@ import org.nl.system.service.user.dto.UserDto; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.domain.Pageable; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @@ -44,6 +45,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.*; +import java.util.concurrent.TimeUnit; /** * @author Zheng Jie @@ -58,6 +60,8 @@ public class OnlineUserService { @Autowired private ISysRoleService roleService; private final RedisUtils redisUtils; + @Autowired + private RedisTemplate redisTemplate; @Value("${sa-token.cookie.domain}") private String domain; @@ -237,11 +241,53 @@ public class OnlineUserService { // if (StrUtil.isEmpty(authUser.getCode()) || !authUser.getCode().equalsIgnoreCase(code)) { // throw new BadRequestException("验证码错误"); // } - // 校验数据库 - // 根据用户名查询,在比对密码 SysUser userInfo = sysUserService.getOne(new QueryWrapper().eq("username", authUser.getUsername())); - if (userInfo == null || !userInfo.getPassword().equals(SaSecureUtil.md5BySalt(password, "salt"))) { // 这里需要密码加密 - throw new BadRequestException("账号或密码错误"); + + // 这里需要密码加密 + if (userInfo == null) { + throw new BadRequestException("当前用户不存在!"); + } + String userName = userInfo.getUsername(); + if (!userInfo.getPassword().equals(SaSecureUtil.md5BySalt(password, "salt"))) { + Boolean aBoolean = redisTemplate.hasKey("LoginName:" + userName); + if (aBoolean) { + String errorLoginCount = redisTemplate.opsForValue().get("LoginName:" + userName).toString(); + Integer newerrorLoginCount = Integer.parseInt(errorLoginCount); + //key为 LoginName: userName value是对应的错误登陆次数 + if (newerrorLoginCount.intValue() == 3) { + Long expire = redisTemplate.opsForValue().getOperations().getExpire("LoginName:" + userName); + if (expire.intValue() > 0) { + throw new BadRequestException("当前用户锁定中,请" + expire / 60 + "分钟后重试"); + } + } else { + redisTemplate.opsForValue().set("LoginName:" + userName, newerrorLoginCount + 1); + if (3 - newerrorLoginCount - 1 == 0) { + redisTemplate.opsForValue().getOperations().expire("LoginName:" + userName, 300, TimeUnit.SECONDS); + throw new BadRequestException("当前用户已锁定,请5分钟后重试"); + } + throw new BadRequestException("密码错误,还有" + (3 - newerrorLoginCount - 1) + "次机会"); + } + } else { + redisTemplate.opsForValue().set("LoginName:" + userName, "1"); + throw new BadRequestException("密码错误,还有" + 2 + "次机会"); + } + } + { + //密码正确,判断redis里面是否有值,有值就代表锁定中 + Boolean aBoolean = redisTemplate.hasKey("LoginName:" + userName); + if (aBoolean) { + String errorLoginCount = redisTemplate.opsForValue().get("LoginName:" + userName).toString(); + Integer newerrorLoginCount = Integer.parseInt(errorLoginCount); + if (newerrorLoginCount.intValue() == 3) { + Long expire = redisTemplate.opsForValue().getOperations().getExpire("LoginName:" + userName); + if (expire.intValue() > 0) { + throw new BadRequestException("当前用户锁定中,请" + expire / 60 + "分钟后重试"); + } + } else { + //直接删除key + redisTemplate.delete("LoginName:" + userName); + } + } } // 获取权限列表 - 登录查找权限 diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java index f4e103705..24799bd35 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java @@ -468,6 +468,23 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { throw new BadRequestException("未查询到该木箱对应的包装关系!"); } + //判断是否开启了系统参数生成AGV搬运任务 + String agv_transport = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("agv_transport").getValue(); + //如果未开启AGV搬运则不创建从1016到发货区的任务 + if (agv_transport.equals("0")){ + log.info("未开启AGV搬运系统参数,不生成AGV搬运["+vehicle_code+"]任务!"); + JSONArray sub_rows2 = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + vehicle_code + "'").getResultJSONArray(0); + for (int i = 0; i < sub_rows2.size(); i++) { + JSONObject sub_row = sub_rows2.getJSONObject(i); + if (StrUtil.isNotEmpty(sub_row.getString("need_delete")) && "1".equals(sub_row.getString("need_delete"))) { + WQLObject.getWQLObject("pdm_bi_subpackagerelation").delete(sub_row); + } + } + result.put("status", HttpStatus.OK.value()); + result.put("message", "下发成功!"); + return result; + } + // 校验木箱长度类型 double box_length = sub_jo.getDoubleValue("box_length"); String length_down_1 = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("box_length_down_1").getValue(); diff --git a/lms/nladmin-ui/src/views/system/user/index.vue b/lms/nladmin-ui/src/views/system/user/index.vue index f83118c5c..5390e52e0 100644 --- a/lms/nladmin-ui/src/views/system/user/index.vue +++ b/lms/nladmin-ui/src/views/system/user/index.vue @@ -377,6 +377,10 @@ export default { personName: [ { required: true, message: '请输入用户姓名', trigger: 'blur' }, { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' } + ], + password: [ + { required: true, message: '请输入用户密码', trigger: 'blur' }, + { pattern: /^(?=.*\d)(?=.*[A-z])[\da-zA-Z]{6,12}$/, message: '长度6位以上,数字+密码', trigger: 'blur' } ] }, syncDrawer: false, @@ -463,7 +467,7 @@ export default { }, // 新增前将多选的值设置为空 [CRUD.HOOK.beforeToAdd]() { - this.form.password = '123456' + // this.form.password = '123456' this.roleDatas = [] }, // 初始化编辑时候的角色与岗位 @@ -626,10 +630,10 @@ export default { cancelButtonText: '取消', type: 'warning' }).then(() => { - row.password = '123456' + row.password = 'HL123456' crudUser.edit(row).then(res => { this.crud.toQuery() - this.crud.notify('密码重置成功,密码:123456', CRUD.NOTIFICATION_TYPE.SUCCESS) + this.crud.notify('密码重置成功,密码:HL123456', CRUD.NOTIFICATION_TYPE.SUCCESS) }) }) },