diff --git a/dosc/.WeDrive b/dosc/.WeDrive new file mode 100644 index 0000000..32d88ae --- /dev/null +++ b/dosc/.WeDrive @@ -0,0 +1 @@ +C:\Users\李涛\Documents\WXWork\1688851319997782\WeDrive\福莱瑞达\软件产品中心\软件产品中心共享资料\集成授权码功能\vue版本集成\授权码 \ No newline at end of file diff --git a/dosc/Navbar.vue b/dosc/Navbar.vue new file mode 100644 index 0000000..e965f72 --- /dev/null +++ b/dosc/Navbar.vue @@ -0,0 +1,258 @@ + + + + + diff --git a/dosc/license.js b/dosc/license.js new file mode 100644 index 0000000..e8ead05 --- /dev/null +++ b/dosc/license.js @@ -0,0 +1,16 @@ +import request from '@/utils/request' + +export function activeLicense(licenseCode) { + return request({ + url: '/system/license/active', + method: 'post', + params: { licenseCode } + }) +} + +export function getLicenseInfo() { + return request({ + url: '/system/license/info', + method: 'get' + }) +} diff --git a/dosc/license/.WeDrive b/dosc/license/.WeDrive new file mode 100644 index 0000000..06d2142 --- /dev/null +++ b/dosc/license/.WeDrive @@ -0,0 +1 @@ +C:\Users\李涛\Documents\WXWork\1688851319997782\WeDrive\福莱瑞达\软件产品中心\软件产品中心共享资料\集成授权码功能\vue版本集成\授权码\license \ No newline at end of file diff --git a/dosc/license/SysLicenseController.java b/dosc/license/SysLicenseController.java new file mode 100644 index 0000000..6979a5b --- /dev/null +++ b/dosc/license/SysLicenseController.java @@ -0,0 +1,127 @@ +package com.ruoyi.web.controller.system.license; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.license.domain.SysLicense; +import com.ruoyi.license.service.ISysLicenseService; +import com.ruoyi.license.util.LicenseUtils; + +/** + * 授权码Controller + * + * @author ruoyi + */ +@RestController +@RequestMapping("/system/license") +public class SysLicenseController extends BaseController +{ + @Autowired + private ISysLicenseService sysLicenseService; + + /** + * 查询授权码列表 + */ + @PreAuthorize("@ss.hasPermi('system:license:list')") + @GetMapping("/list") + public TableDataInfo list(SysLicense sysLicense) + { + startPage(); + List list = sysLicenseService.selectSysLicenseList(sysLicense); + return getDataTable(list); + } + + /** + * 新增授权码 + */ + @PreAuthorize("@ss.hasPermi('system:license:add')") + @Log(title = "授权码", businessType = BusinessType.INSERT) + @PostMapping("/add") + public AjaxResult add(SysLicense sysLicense) + { + return toAjax(sysLicenseService.insertSysLicense(sysLicense)); + } + + /** + * 修改授权码 + */ + @PreAuthorize("@ss.hasPermi('system:license:edit')") + @Log(title = "授权码", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + public AjaxResult edit(SysLicense sysLicense) + { + return toAjax(sysLicenseService.updateSysLicense(sysLicense)); + } + + /** + * 删除授权码 + */ + @PreAuthorize("@ss.hasPermi('system:license:remove')") + @Log(title = "授权码", businessType = BusinessType.DELETE) + @PostMapping("/remove") + public AjaxResult remove(String ids) + { + return toAjax(sysLicenseService.deleteSysLicenseByIds(ids)); + } + + /** + * 激活授权码(无需登录) + */ + @Log(title = "激活授权码", businessType = BusinessType.UPDATE) + @PostMapping("/active") + public AjaxResult active(String licenseCode) + { + if (!LicenseUtils.validateFormat(licenseCode)) + { + return error("授权码格式不正确"); + } + int result = sysLicenseService.activeLicense(licenseCode); + if (result > 0) + { + return success("授权码激活成功"); + } + return error("授权码激活失败,请检查授权码是否正确或已过期"); + } + + /** + * 获取当前授权信息 + * license 未开启或无有效授权时返回 code=200 data=null,前端静默处理 + */ + @PreAuthorize("@ss.hasPermi('system:license:list')") + @GetMapping("/info") + public AjaxResult info() + { + SysLicense license = sysLicenseService.getActiveLicense(); + return AjaxResult.success(license); + } + + /** + * 生成授权码 + */ + @PreAuthorize("@ss.hasPermi('system:license:add')") + @GetMapping("/generate") + public AjaxResult generate(String type, String projectNo) + { + if (StringUtils.isEmpty(type) || StringUtils.isEmpty(projectNo)) + { + return error("授权类型和项目编号不能为空"); + } + String licenseCode = LicenseUtils.generateLicense(type, projectNo); + if (licenseCode == null) + { + return error("授权码生成失败"); + } + return AjaxResult.success("授权码生成成功", licenseCode); + } +} diff --git a/dosc/ruoyi-license/.WeDrive b/dosc/ruoyi-license/.WeDrive new file mode 100644 index 0000000..9c126ef --- /dev/null +++ b/dosc/ruoyi-license/.WeDrive @@ -0,0 +1 @@ +C:\Users\李涛\Documents\WXWork\1688851319997782\WeDrive\福莱瑞达\软件产品中心\软件产品中心共享资料\集成授权码功能\vue版本集成\授权码\ruoyi-license \ No newline at end of file diff --git a/dosc/ruoyi-license/CHANGES.md b/dosc/ruoyi-license/CHANGES.md new file mode 100644 index 0000000..d6c8609 --- /dev/null +++ b/dosc/ruoyi-license/CHANGES.md @@ -0,0 +1,270 @@ +# 授权码模块集成改动说明 + +> 本文档记录引入 `ruoyi-license` 授权码模块时,对原有项目文件的所有改动(不含 `ruoyi-license` 模块本身及 `SysLicenseController`)。 + +--- + +## 1. 根模块 `pom.xml` + +**文件路径:** `wms/pom.xml` + +**改动内容:** + +1. `` 中注册 `ruoyi-license` 子模块: + +```xml + + ruoyi-admin + ruoyi-framework + ruoyi-system + ruoyi-quartz + ruoyi-generator + ruoyi-common + ruoyi-license + +``` + +2. `` 中声明 `ruoyi-license` 依赖版本: + +```xml + + + com.ruoyi + ruoyi-license + ${ruoyi.version} + +``` + +--- + +## 2. `ruoyi-admin/pom.xml` + +**文件路径:** `wms/ruoyi-admin/pom.xml` + +**改动内容:** + +引入 `ruoyi-license` 依赖,使授权拦截器和配置能被 Spring Boot 扫描加载: + +```xml + + + com.ruoyi + ruoyi-license + +``` + +--- + +## 3. `SecurityConfig.java` + +**文件路径:** `wms/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java` + +**改动内容:** + +在 Spring Security 匿名白名单中加入 `/system/license/active`,允许未登录用户调用激活授权码接口: + +```java +// 改动前 +requests.antMatchers("/login", "/register", "/captchaImage").permitAll() + +// 改动后 +requests.antMatchers("/login", "/register", "/captchaImage", "/system/license/active").permitAll() +``` + +--- + +## 4. 前端 `api/license.js`(新建) + +**文件路径:** `wms/ui/src/api/license.js` + +**改动内容:** + +新建文件,封装授权码相关接口: + +```js +import request from '@/utils/request' + +// 激活授权码(无需登录) +export function activeLicense(licenseCode) { + return request({ + url: '/system/license/active', + method: 'post', + params: { licenseCode } + }) +} + +// 查询当前授权信息(需登录) +export function getLicenseInfo() { + return request({ + url: '/system/license/info', + method: 'get' + }) +} +``` + +--- + +## 5. 登录页 `login.vue` + +**文件路径:** `wms/ui/src/views/login.vue` + +**改动内容:** + +### 5.1 模板部分 + +在登录按钮下方新增"激活授权码"按钮,以及激活弹窗: + +```html + + + 激活授权码 + + + + + + + 取 消 + 激 活 + + +``` + +### 5.2 Script 部分 + +新增 import、data 字段和方法: + +```js +// 新增 import +import { activeLicense } from "@/api/license" + +// 新增 data 字段 +licenseDialogVisible: false, +licenseCode: '', +licenseLoading: false + +// 新增方法 +openLicenseDialog() { + this.licenseCode = '' + this.licenseDialogVisible = true +}, +handleActiveLicense() { + if (!this.licenseCode.trim()) { + this.$message.warning('请输入授权码') + return + } + this.licenseLoading = true + activeLicense(this.licenseCode.trim()).then(res => { + if (res.code === 200) { + this.$message.success(res.msg || '授权码激活成功') + this.licenseDialogVisible = false + } else { + this.$message.error(res.msg || '授权码激活失败') + } + }).catch(() => { + this.$message.error('授权码激活失败') + }).finally(() => { + this.licenseLoading = false + }) +} +``` + +--- + +## 6. 顶部导航栏 `Navbar.vue` + +**文件路径:** `wms/ui/src/layout/components/Navbar.vue` + +**改动内容:** + +### 6.1 模板部分 + +在 navbar 中间插入授权到期警告条(剩余不足 30 天时显示): + +```html +
+ + 系统授权将于 {{ licenseExpireText }} 后过期,请及时联系管理员续期 +
+``` + +### 6.2 Script 部分 + +```js +// 新增 import +import { getLicenseInfo } from '@/api/license' + +// 新增 data 字段 +licenseWarning: false, +licenseExpireText: '', +licenseTimer: null + +// 新增生命周期钩子 +mounted() { + this.checkLicenseExpire() + this.licenseTimer = setInterval(() => this.checkLicenseExpire(), 60 * 1000) +}, +beforeDestroy() { + if (this.licenseTimer) clearInterval(this.licenseTimer) +}, + +// 新增方法 +checkLicenseExpire() { + getLicenseInfo().then(res => { + if (res.code === 200 && res.data && res.data.expireTime) { + const expireTime = new Date(res.data.expireTime).getTime() + const now = Date.now() + const diffMs = expireTime - now + const diffDays = Math.ceil(diffMs / (1000 * 60 * 60 * 24)) + if (diffMs > 0 && diffDays <= 30) { + this.licenseWarning = true + if (diffMs < 1000 * 60 * 60 * 24) { + const hours = Math.floor(diffMs / (1000 * 60 * 60)) + const minutes = Math.floor((diffMs % (1000 * 60 * 60)) / (1000 * 60)) + this.licenseExpireText = hours > 0 ? `${hours} 小时 ${minutes} 分钟` : `${minutes} 分钟` + } else if (diffDays < 7) { + this.licenseExpireText = diffDays + ' 天' + } else { + this.licenseExpireText = Math.ceil(diffDays / 7) + ' 周' + } + } + } + }).catch(() => {}) +} +``` + +### 6.3 样式部分 + +```scss +.license-warning { + position: absolute; + left: 50%; + transform: translateX(-50%); + top: 0; + height: 50px; + line-height: 50px; + font-size: 13px; + color: #e6a23c; + font-weight: 500; + pointer-events: none; + i { margin-right: 4px; } +} +``` + +--- + +## 改动文件汇总 + +| 文件 | 类型 | 说明 | +|---|---|---| +| `wms/pom.xml` | 修改 | 注册模块 + 声明依赖版本 | +| `wms/ruoyi-admin/pom.xml` | 修改 | 引入 ruoyi-license 依赖 | +| `ruoyi-framework/.../SecurityConfig.java` | 修改 | 白名单加入激活授权码接口 | +| `ui/src/api/license.js` | 新建 | 封装激活和查询授权信息接口 | +| `ui/src/views/login.vue` | 修改 | 新增激活授权码按钮和弹窗 | +| `ui/src/layout/components/Navbar.vue` | 修改 | 新增授权到期倒计时警告条 | diff --git a/dosc/ruoyi-license/DEPLOYMENT_CHECKLIST.md b/dosc/ruoyi-license/DEPLOYMENT_CHECKLIST.md new file mode 100644 index 0000000..cac7b0e --- /dev/null +++ b/dosc/ruoyi-license/DEPLOYMENT_CHECKLIST.md @@ -0,0 +1,250 @@ +# 授权码模块部署检查清单 + +## 📋 部署前检查 + +### 1. 文件完整性检查 +- [ ] ruoyi-license 模块目录存在 +- [ ] pom.xml 已添加 license 模块 +- [ ] ruoyi-admin/pom.xml 已添加 license 依赖 +- [ ] SysLicenseController.java 已创建 +- [ ] license.html 和 active.html 已创建 +- [ ] login.html 和 login.js 已修改 +- [ ] sys_license.sql 脚本已准备 + +### 2. 数据库准备 +- [ ] 创建 sys_license 表 +- [ ] 插入授权管理菜单数据 +- [ ] 验证表结构正确 +- [ ] 检查菜单权限配置 + +### 3. 代码配置 +- [ ] 修改 LicenseUtils.java 中的密钥(生产环境必须) +- [ ] 确认拦截器路径配置正确 +- [ ] 确认定时任务cron表达式 +- [ ] 启动类添加 @EnableScheduling 注解 + +## 🔧 部署步骤 + +### 步骤1: 执行数据库脚本 +```bash +mysql -u root -p your_database < sql/sys_license.sql +``` +- [ ] 执行成功 +- [ ] 表创建成功 +- [ ] 菜单数据插入成功 + +### 步骤2: 修改启动类 +```java +@SpringBootApplication +@EnableScheduling // 添加此注解 +public class RuoYiApplication { + // ... +} +``` +- [ ] 注解已添加 + +### 步骤3: 编译项目 +```bash +mvn clean install +``` +- [ ] 编译成功 +- [ ] 无错误信息 +- [ ] JAR包生成 + +### 步骤4: 启动应用 +```bash +java -jar ruoyi-admin.jar +``` +- [ ] 启动成功 +- [ ] 无异常日志 +- [ ] 端口正常监听 + +### 步骤5: 生成授权码 +**方式A: 使用独立工具** +```bash +java com.ruoyi.license.util.LicenseGenerator +``` +- [ ] 工具运行成功 +- [ ] 授权码生成成功 +- [ ] 授权码已保存 + +**方式B: 使用系统界面** +- [ ] 登录系统 +- [ ] 访问授权管理 +- [ ] 点击生成授权码 +- [ ] 输入天数并生成 + +### 步骤6: 激活授权码 +- [ ] 访问登录页 +- [ ] 点击"激活授权码" +- [ ] 输入授权码 +- [ ] 激活成功 + +## ✅ 功能测试 + +### 测试1: 授权码生成 +- [ ] 系统界面生成授权码成功 +- [ ] 独立工具生成授权码成功 +- [ ] 授权码格式正确 + +### 测试2: 授权码激活 +- [ ] 登录页激活成功 +- [ ] 系统内激活成功 +- [ ] 数据库记录正确 + +### 测试3: 授权验证 +- [ ] 有效授权可正常登录 +- [ ] 无授权无法登录 +- [ ] 过期授权无法登录 + +### 测试4: 授权拦截 +- [ ] 未授权访问被拦截 +- [ ] 有效授权可正常访问 +- [ ] 静态资源不被拦截 + +### 测试5: 定时检查 +- [ ] 定时任务正常执行 +- [ ] 授权过期自动更新状态 +- [ ] 在线用户被踢出 + +### 测试6: 授权管理 +- [ ] 授权列表查询正常 +- [ ] 授权信息显示正确 +- [ ] 授权删除功能正常 + +## 🔍 问题排查 + +### 问题1: 编译失败 +**检查项:** +- [ ] Maven依赖是否正确 +- [ ] JDK版本是否匹配 +- [ ] pom.xml配置是否正确 + +**解决方案:** +```bash +mvn clean +mvn dependency:resolve +mvn install +``` + +### 问题2: 启动失败 +**检查项:** +- [ ] 数据库连接是否正常 +- [ ] 端口是否被占用 +- [ ] 配置文件是否正确 + +**解决方案:** +- 检查 application.yml 配置 +- 查看启动日志错误信息 +- 确认数据库表已创建 + +### 问题3: 无法激活授权码 +**检查项:** +- [ ] 授权码格式是否正确 +- [ ] 授权码是否已过期 +- [ ] 密钥是否一致 + +**解决方案:** +- 重新生成授权码 +- 检查 LicenseUtils 密钥配置 +- 查看后台错误日志 + +### 问题4: 授权验证不生效 +**检查项:** +- [ ] 拦截器是否注册 +- [ ] 数据库授权记录是否正确 +- [ ] 定时任务是否执行 + +**解决方案:** +- 检查 LicenseConfig 配置 +- 验证数据库 status 字段 +- 确认 @EnableScheduling 已添加 + +### 问题5: 在线用户未被踢出 +**检查项:** +- [ ] SessionDAO 是否注入 +- [ ] 定时任务是否执行 +- [ ] Shiro配置是否正确 + +**解决方案:** +- 检查 LicenseCheckTask 日志 +- 验证 SessionDAO bean +- 重启应用服务器 + +## 📊 监控指标 + +### 运行时监控 +- [ ] 授权状态正常 +- [ ] 定时任务执行正常 +- [ ] 无异常日志 +- [ ] 内存使用正常 +- [ ] CPU使用正常 + +### 业务监控 +- [ ] 授权激活次数 +- [ ] 授权过期提醒 +- [ ] 用户登录成功率 +- [ ] 授权拦截次数 + +## 🔐 安全检查 + +### 配置安全 +- [ ] 生产环境已修改默认密钥 +- [ ] 数据库密码已加密 +- [ ] 授权码传输使用HTTPS +- [ ] 敏感日志已脱敏 + +### 权限安全 +- [ ] 授权管理菜单仅管理员可见 +- [ ] 授权激活操作有日志记录 +- [ ] 授权码生成有权限控制 +- [ ] 数据库访问有权限限制 + +### 数据安全 +- [ ] 授权码加密存储 +- [ ] 定期备份授权数据 +- [ ] 授权日志完整保存 +- [ ] 敏感信息不输出到日志 + +## 📝 上线清单 + +### 上线前 +- [ ] 所有测试通过 +- [ ] 代码已提交版本库 +- [ ] 数据库脚本已准备 +- [ ] 部署文档已编写 +- [ ] 回滚方案已准备 + +### 上线中 +- [ ] 备份现有数据 +- [ ] 执行数据库脚本 +- [ ] 部署新版本代码 +- [ ] 生成初始授权码 +- [ ] 激活授权码 + +### 上线后 +- [ ] 验证功能正常 +- [ ] 检查日志无异常 +- [ ] 监控系统运行状态 +- [ ] 通知相关人员 +- [ ] 更新运维文档 + +## 📞 应急联系 + +### 技术支持 +- 开发负责人: ___________ +- 运维负责人: ___________ +- 数据库管理员: ___________ + +### 应急预案 +1. 授权失效 -> 立即激活新授权码 +2. 系统无法登录 -> 检查授权状态 +3. 数据丢失 -> 从备份恢复 +4. 性能问题 -> 调整定时任务频率 + +--- + +**检查人**: ___________ +**检查日期**: ___________ +**部署环境**: [ ] 开发 [ ] 测试 [ ] 生产 +**部署状态**: [ ] 成功 [ ] 失败 [ ] 部分成功 diff --git a/dosc/ruoyi-license/INTEGRATION.md b/dosc/ruoyi-license/INTEGRATION.md new file mode 100644 index 0000000..1b8199b --- /dev/null +++ b/dosc/ruoyi-license/INTEGRATION.md @@ -0,0 +1,231 @@ +# RuoYi 授权码模块集成指南 + +## 一、模块说明 + +本授权码模块已完成开发,包含以下文件: + +``` +ruoyi-license/ # 授权模块(独立模块) +├── src/main/java/com/ruoyi/license/ +│ ├── config/ +│ │ └── LicenseConfig.java # 拦截器配置 +│ ├── domain/ +│ │ └── SysLicense.java # 授权实体 +│ ├── interceptor/ +│ │ └── LicenseInterceptor.java # 授权拦截器 +│ ├── mapper/ +│ │ └── SysLicenseMapper.java # 数据访问接口 +│ ├── service/ +│ │ ├── ISysLicenseService.java # 服务接口 +│ │ └── impl/ +│ │ └── SysLicenseServiceImpl.java # 服务实现 +│ ├── task/ +│ │ └── LicenseCheckTask.java # 定时检查任务 +│ └── util/ +│ ├── LicenseUtils.java # 授权工具类 +│ └── LicenseGenerator.java # 授权码生成器 +├── src/main/resources/mapper/license/ +│ └── SysLicenseMapper.xml # MyBatis映射 +├── pom.xml # 模块依赖 +└── README.md # 使用说明 + +sql/ +└── sys_license.sql # 数据库脚本 + +ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/license/ +└── SysLicenseController.java # 授权控制器 + +ruoyi-admin/src/main/resources/templates/system/license/ +├── license.html # 授权列表页 +└── active.html # 激活页面 + +修改的文件: +- pom.xml # 添加license模块 +- ruoyi-admin/pom.xml # 添加license依赖 +- login.html # 添加激活入口 +- login.js # 添加激活功能 +``` + +## 二、部署步骤 + +### 1. 执行数据库脚本 + +```bash +# 在MySQL中执行 +mysql -u root -p your_database < sql/sys_license.sql +``` + +或手动执行 `sql/sys_license.sql` 中的SQL语句。 + +### 2. 启用定时任务 + +在启动类上添加 `@EnableScheduling` 注解: + +```java +@SpringBootApplication +@EnableScheduling // 添加此注解 +public class RuoYiApplication { + public static void main(String[] args) { + SpringApplication.run(RuoYiApplication.class, args); + } +} +``` + +### 3. 编译项目 + +```bash +cd d:\fortucky\project\RuoYi-master +mvn clean install +``` + +### 4. 生成授权码 + +**方式一:使用独立工具生成** +```bash +cd ruoyi-license/src/main/java +javac com/ruoyi/license/util/LicenseUtils.java +javac com/ruoyi/license/util/LicenseGenerator.java +java com.ruoyi.license.util.LicenseGenerator +``` + +**方式二:启动系统后在界面生成** +- 登录系统 +- 进入"系统管理 -> 授权管理" +- 点击"生成授权码"按钮 + +### 5. 激活授权码 + +**首次激活(登录页):** +1. 访问登录页 +2. 点击"激活授权码"链接 +3. 输入生成的授权码 +4. 提交激活 + +**系统内激活:** +1. 登录系统(需要先有有效授权) +2. 进入"系统管理 -> 授权管理" +3. 点击"激活授权码" +4. 输入新的授权码 + +## 三、功能验证 + +### 1. 验证授权拦截 + +- 未激活授权码时,访问任何页面应跳转到登录页并提示"授权已过期" +- 激活授权码后,可正常访问系统 + +### 2. 验证定时检查 + +- 修改数据库中授权码的 `expire_time` 为过去时间 +- 等待5分钟(或重启系统) +- 在线用户应被强制退出 +- 尝试登录应提示授权过期 + +### 3. 验证授权管理 + +- 访问"系统管理 -> 授权管理" +- 查看授权列表 +- 生成新授权码 +- 激活授权码 +- 删除过期授权 + +## 四、复用到其他项目 + +### 方式一:Maven依赖(推荐) + +1. 将 `ruoyi-license` 模块复制到目标项目 +2. 在父pom.xml添加模块声明 +3. 在需要的模块添加依赖 +4. 执行数据库脚本 +5. 复制Controller和前端页面 + +### 方式二:JAR包依赖 + +1. 打包license模块: +```bash +cd ruoyi-license +mvn clean package +``` + +2. 安装到本地仓库: +```bash +mvn install:install-file -Dfile=target/ruoyi-license-4.8.2.jar \ + -DgroupId=com.ruoyi -DartifactId=ruoyi-license \ + -Dversion=4.8.2 -Dpackaging=jar +``` + +3. 在目标项目添加依赖: +```xml + + com.ruoyi + ruoyi-license + 4.8.2 + +``` + +## 五、配置说明 + +### 1. 修改密钥(重要) + +生产环境必须修改默认密钥: + +```java +// LicenseUtils.java +private static final String SECRET_KEY = "YourCustomKey123"; // 改为16位自定义密钥 +``` + +### 2. 调整检查频率 + +```java +// LicenseCheckTask.java +@Scheduled(cron = "0 */5 * * * ?") // 每5分钟,可根据需要调整 +``` + +### 3. 自定义拦截路径 + +```java +// LicenseConfig.java +.excludePathPatterns( + "/login", + "/your-path/**" // 添加需要排除的路径 +) +``` + +## 六、注意事项 + +1. **首次部署**:必须先生成并激活授权码,否则无法登录 +2. **时间同步**:确保服务器时间准确,避免授权判断错误 +3. **密钥安全**:生产环境务必修改默认密钥 +4. **数据备份**:定期备份 `sys_license` 表数据 +5. **权限控制**:授权管理菜单仅授予超级管理员 + +## 七、故障排查 + +### 问题1:无法激活授权码 +- 检查授权码格式是否正确 +- 检查授权码是否已过期 +- 查看后台日志错误信息 + +### 问题2:授权有效但仍被拦截 +- 检查数据库中授权状态是否为"1" +- 检查 `expire_time` 是否大于当前时间 +- 重启应用服务器 + +### 问题3:定时任务不执行 +- 确认启动类添加了 `@EnableScheduling` +- 检查日志是否有定时任务执行记录 + +### 问题4:在线用户未被踢出 +- 检查 `SessionDAO` 是否正确注入 +- 查看定时任务是否正常执行 +- 检查Shiro配置是否正确 + +## 八、技术支持 + +如遇到问题,请提供以下信息: +1. 错误日志 +2. 数据库授权记录 +3. 系统环境信息 +4. 操作步骤 + +联系方式:参考RuoYi官方文档 diff --git a/dosc/ruoyi-license/LICENSE_FILTER_CONFIG.md b/dosc/ruoyi-license/LICENSE_FILTER_CONFIG.md new file mode 100644 index 0000000..7a3ba06 --- /dev/null +++ b/dosc/ruoyi-license/LICENSE_FILTER_CONFIG.md @@ -0,0 +1,168 @@ +# 授权码全局拦截配置说明 + +## 功能说明 + +通过自定义 Shiro Filter,实现授权码失效时,**所有接口**(包括 `anon` 匿名访问的接口)都无法访问。 + +## 实现原理 + +1. 创建 `LicenseValidateFilter` 继承 `AccessControlFilter` +2. 在 Shiro 过滤链的**最前面**添加此过滤器 +3. 所有请求都会先经过授权码验证,验证失败则拒绝访问 + +## 已完成的修改 + +### 1. 新增文件 +- `ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/license/LicenseValidateFilter.java` + +### 2. 修改文件 +- `ruoyi-framework/src/main/java/com/ruoyi/framework/config/ShiroConfig.java` + - 导入 `LicenseValidateFilter` + - 注册过滤器:`filters.put("licenseValidate", licenseValidateFilter())` + - 添加到过滤链:`filterChainDefinitionMap.put("/**", "licenseValidate,user,kickout,onlineSession,syncOnlineSession")` + +## 白名单配置 + +以下路径即使授权失效也可以访问(必要的登录和静态资源): + +```java +private static final String[] WHITE_LIST = { + "/login", // 登录页 + "/captcha/captchaImage", // 验证码 + "/css/", // 样式文件 + "/js/", // 脚本文件 + "/img/", // 图片资源 + "/fonts/", // 字体文件 + "/ajax/", // Ajax资源 + "/ruoyi/", // 若依资源 + "/favicon.ico", // 网站图标 + "/system/license/active" // 授权激活页面(必须放行) +}; +``` + +## 自定义白名单 + +如果需要添加其他路径到白名单,修改 `LicenseValidateFilter.java`: + +```java +private static final String[] WHITE_LIST = { + // ... 原有配置 + "/your-custom-path/**", // 添加你的自定义路径 +}; +``` + +## 拦截效果 + +### 授权有效时 +- 所有接口正常访问(包括 `/board/**`、`/agv/api/**` 等 anon 接口) + +### 授权失效时 +- **普通请求**:重定向到 `/login?license=expired` +- **Ajax请求**:返回 JSON `{"code":401,"msg":"授权已过期,请联系管理员激活授权码"}` +- **白名单路径**:仍可访问(用于激活授权码) + +## 测试步骤 + +### 1. 启用授权功能 +在 `application.yml` 中配置: +```yaml +license: + enabled: true +``` + +### 2. 配置项目编号 +在数据库 `sys_config` 表中添加: +```sql +INSERT INTO sys_config (config_name, config_key, config_value, config_type, create_by, create_time, remark) +VALUES ('项目编号', 'fortucky.project.no', 'FT507', 'Y', 'admin', NOW(), '用于授权码验证'); +``` + +### 3. 测试授权失效场景 + +**方式一:不激活授权码** +- 启动系统 +- 访问 `/board/**` 接口 +- 预期:被拦截,重定向到登录页 + +**方式二:授权码过期** +- 生成5分钟测试授权码并激活 +- 等待5分钟后访问 `/board/**` 接口 +- 预期:被拦截 + +### 4. 测试授权有效场景 +- 生成并激活有效授权码 +- 访问 `/board/**` 接口 +- 预期:正常访问 + +## 注意事项 + +1. **白名单必须包含授权激活页面** + - `/system/license/active` 必须在白名单中 + - 否则授权失效后无法激活新授权码 + +2. **静态资源必须放行** + - CSS、JS、图片等资源必须在白名单 + - 否则登录页面无法正常显示 + +3. **过滤器顺序很重要** + - `licenseValidate` 必须在最前面 + - 确保所有请求都先经过授权验证 + +4. **开发环境可关闭授权** + ```yaml + license: + enabled: false # 开发时可关闭 + ``` + +## 与原有拦截器的区别 + +### 原有 LicenseInterceptor(Spring MVC 拦截器) +- 在 Spring MVC 层拦截 +- 只拦截进入 Controller 的请求 +- 无法拦截 Shiro 已放行的 `anon` 接口 + +### 新增 LicenseValidateFilter(Shiro 过滤器) +- 在 Shiro 层拦截 +- 拦截所有请求(包括 `anon` 接口) +- 优先级高于 Shiro 的其他过滤器 + +## 建议 + +1. **保留两个拦截器** + - `LicenseValidateFilter`:全局拦截(包括 anon 接口) + - `LicenseInterceptor`:作为二次验证(可选) + +2. **生产环境必须启用** + ```yaml + license: + enabled: true + ``` + +3. **定期检查白名单** + - 确保白名单路径最小化 + - 避免过度放行 + +## 故障排查 + +### 问题1:所有请求都被拦截 +- 检查 `license.enabled` 是否为 `true` +- 检查是否有有效授权码 +- 查看后台日志 `[授权验证]` 相关信息 + +### 问题2:anon 接口仍可访问 +- 检查过滤器是否注册:`filters.put("licenseValidate", ...)` +- 检查过滤链配置:`"licenseValidate,user,..."` +- 确认 `licenseValidate` 在最前面 + +### 问题3:无法激活授权码 +- 检查 `/system/license/active` 是否在白名单 +- 检查白名单匹配逻辑是否正确 + +## 完成标志 + +✅ 授权失效时,`/board/**` 接口无法访问 +✅ 授权失效时,`/agv/api/**` 接口无法访问 +✅ 授权失效时,仍可访问登录页和激活页 +✅ 授权有效时,所有接口正常访问 +✅ Ajax 请求返回 JSON 错误信息 +✅ 普通请求重定向到登录页 diff --git a/dosc/ruoyi-license/README.md b/dosc/ruoyi-license/README.md new file mode 100644 index 0000000..5cfa495 --- /dev/null +++ b/dosc/ruoyi-license/README.md @@ -0,0 +1,193 @@ +# RuoYi 授权码模块 + +## 模块简介 + +ruoyi-license 是一个独立的授权码管理模块,用于控制系统的使用期限。当授权码过期后,系统将无法登录,已登录用户会被强制退出。 + +## 功能特性 + +- ✅ 授权码加密存储 +- ✅ 登录时验证授权有效性 +- ✅ 定时检查授权状态(每5分钟) +- ✅ 授权过期自动踢出在线用户 +- ✅ 系统管理界面查看/激活授权 +- ✅ 登录页面激活授权码 +- ✅ 授权码生成工具 +- ✅ 独立模块,方便其他项目复用 + +## 快速开始 + +### 1. 执行数据库脚本 + +```sql +-- 执行 sql/sys_license.sql 创建授权表和菜单 +``` + +### 2. 添加模块依赖 + +在需要使用授权功能的项目中,添加依赖: + +```xml + + com.ruoyi + ruoyi-license + 4.8.2 + +``` + +### 3. 配置包扫描 + +确保Spring能扫描到授权模块的包: + +```java +@SpringBootApplication +@ComponentScan(basePackages = {"com.ruoyi"}) +public class RuoYiApplication { + // ... +} +``` + +### 4. 生成授权码 + +访问系统管理 -> 授权管理,点击"生成授权码"按钮,输入授权天数(如365天),系统会生成加密的授权码。 + +### 5. 激活授权码 + +**方式一:登录页激活** +- 在登录页面点击"激活授权码"链接 +- 输入授权码并提交 + +**方式二:系统内激活** +- 登录系统后,进入"系统管理 -> 授权管理" +- 点击"激活授权码"按钮 +- 输入授权码并提交 + +## 核心类说明 + +### 1. 实体类 +- `SysLicense`: 授权码实体,包含授权码、开始时间、结束时间、状态等信息 + +### 2. 工具类 +- `LicenseUtils`: 授权码工具类 + - `generateLicense()`: 生成授权码 + - `encrypt()`: 加密数据 + - `decrypt()`: 解密数据 + - `validateFormat()`: 验证授权码格式 + +### 3. 服务类 +- `ISysLicenseService`: 授权服务接口 + - `activeLicense()`: 激活授权码 + - `checkLicenseValid()`: 检查授权是否有效 + - `getActiveLicense()`: 获取当前有效授权 + +### 4. 拦截器 +- `LicenseInterceptor`: 授权拦截器,在每次请求时验证授权有效性 + +### 5. 定时任务 +- `LicenseCheckTask`: 每5分钟检查授权状态,过期自动踢出在线用户 + +## 授权码格式 + +授权码采用AES加密,格式为: +``` +加密(开始时间戳|结束时间戳) +``` + +示例: +``` +原始数据: 1704067200000|1735689600000 +加密后: Xj8K9mN2pQ5rT7vW1yZ3aB4cD6eF8gH0iJ2kL4mN6oP8qR0sT2uV4wX6yZ8 +``` + +## 集成到其他项目 + +### 步骤1:复制模块 +将 `ruoyi-license` 文件夹复制到目标项目根目录 + +### 步骤2:修改pom.xml +在父pom.xml中添加: +```xml + + ruoyi-license + + + + + + com.ruoyi + ruoyi-license + ${project.version} + + + +``` + +### 步骤3:添加依赖 +在启动模块的pom.xml中添加: +```xml + + com.ruoyi + ruoyi-license + +``` + +### 步骤4:执行SQL脚本 +执行 `sql/sys_license.sql` 创建数据库表 + +### 步骤5:配置Controller +将 `SysLicenseController.java` 复制到项目的controller包中 + +### 步骤6:配置前端页面 +将 `templates/system/license/` 目录复制到项目的templates目录 + +### 步骤7:修改登录页面 +参考 `login.html` 和 `login.js` 的修改,添加授权码激活入口 + +## 自定义配置 + +### 修改密钥 +编辑 `LicenseUtils.java`: +```java +private static final String SECRET_KEY = "YourSecretKey123"; // 16位密钥 +``` + +### 修改检查频率 +编辑 `LicenseCheckTask.java`: +```java +@Scheduled(cron = "0 */10 * * * ?") // 改为每10分钟检查 +``` + +### 自定义拦截规则 +编辑 `LicenseConfig.java`,添加或排除拦截路径: +```java +.excludePathPatterns( + "/login", + "/your-custom-path/**" +) +``` + +## 注意事项 + +1. **密钥安全**:生产环境务必修改默认密钥 +2. **时间同步**:确保服务器时间准确 +3. **数据备份**:定期备份授权表数据 +4. **权限控制**:授权管理菜单仅授予管理员 +5. **测试环境**:建议先在测试环境验证功能 + +## 常见问题 + +**Q: 授权码激活失败?** +A: 检查授权码格式是否正确,是否已过期 + +**Q: 如何延长授权期限?** +A: 生成新的授权码并激活即可 + +**Q: 授权过期后如何恢复?** +A: 在登录页点击"激活授权码",输入新的授权码 + +**Q: 可以同时激活多个授权码吗?** +A: 系统只使用最新激活且未过期的授权码 + +## 技术支持 + +如有问题,请联系技术支持或查看RuoYi官方文档。 diff --git a/dosc/ruoyi-license/SUMMARY.md b/dosc/ruoyi-license/SUMMARY.md new file mode 100644 index 0000000..dc7e368 --- /dev/null +++ b/dosc/ruoyi-license/SUMMARY.md @@ -0,0 +1,239 @@ +# RuoYi 授权码模块 - 项目总结 + +## 📦 已完成的工作 + +### 1. 核心模块开发 ✅ + +**ruoyi-license 独立模块** +- ✅ Maven模块配置 (pom.xml) +- ✅ 授权实体类 (SysLicense.java) +- ✅ 数据访问层 (SysLicenseMapper.java + XML) +- ✅ 业务逻辑层 (ISysLicenseService.java + Impl) +- ✅ 授权工具类 (LicenseUtils.java) +- ✅ 授权拦截器 (LicenseInterceptor.java) +- ✅ 拦截器配置 (LicenseConfig.java) +- ✅ 定时检查任务 (LicenseCheckTask.java) +- ✅ 授权码生成器 (LicenseGenerator.java) +- ✅ 测试工具 (LicenseTest.java) + +### 2. 控制器和前端 ✅ + +**后端控制器** +- ✅ SysLicenseController.java (授权管理控制器) + - 授权列表查询 + - 授权码激活 + - 授权码生成 + - 授权信息查看 + - 授权删除 + +**前端页面** +- ✅ license.html (授权列表页) +- ✅ active.html (激活页面) +- ✅ login.html (添加激活入口) +- ✅ login.js (添加激活功能) + +### 3. 数据库脚本 ✅ + +- ✅ sys_license.sql + - 授权表结构 + - 菜单权限配置 + +### 4. 项目集成 ✅ + +- ✅ 主pom.xml (添加license模块) +- ✅ ruoyi-admin/pom.xml (添加license依赖) + +### 5. 文档编写 ✅ + +- ✅ README.md (使用说明) +- ✅ INTEGRATION.md (集成指南) + +## 🎯 功能特性 + +### 核心功能 +1. **授权码加密存储** - AES加密,安全可靠 +2. **登录验证** - 登录时自动验证授权有效性 +3. **拦截器保护** - 所有请求都经过授权验证 +4. **定时检查** - 每5分钟自动检查授权状态 +5. **自动踢出** - 授权过期自动踢出所有在线用户 +6. **管理界面** - 完整的授权管理功能 +7. **登录页激活** - 无需登录即可激活授权码 +8. **授权码生成** - 内置生成工具,支持自定义天数 + +### 技术亮点 +- 🔒 AES加密算法保护授权码 +- 🔄 Spring拦截器实现全局授权验证 +- ⏰ Spring定时任务自动检查授权 +- 🎨 完整的前后端交互界面 +- 📦 独立模块设计,方便复用 +- 🛠️ 提供测试工具和生成工具 + +## 📂 文件清单 + +``` +ruoyi-license/ +├── src/main/java/com/ruoyi/license/ +│ ├── config/ +│ │ └── LicenseConfig.java (拦截器配置) +│ ├── domain/ +│ │ └── SysLicense.java (授权实体) +│ ├── interceptor/ +│ │ └── LicenseInterceptor.java (授权拦截器) +│ ├── mapper/ +│ │ └── SysLicenseMapper.java (Mapper接口) +│ ├── service/ +│ │ ├── ISysLicenseService.java (服务接口) +│ │ └── impl/ +│ │ └── SysLicenseServiceImpl.java (服务实现) +│ ├── task/ +│ │ └── LicenseCheckTask.java (定时任务) +│ └── util/ +│ ├── LicenseUtils.java (工具类) +│ ├── LicenseGenerator.java (生成器) +│ └── LicenseTest.java (测试工具) +├── src/main/resources/mapper/license/ +│ └── SysLicenseMapper.xml (MyBatis映射) +├── pom.xml (模块配置) +├── README.md (使用说明) +└── INTEGRATION.md (集成指南) + +sql/ +└── sys_license.sql (数据库脚本) + +ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/license/ +└── SysLicenseController.java (控制器) + +ruoyi-admin/src/main/resources/templates/system/license/ +├── license.html (列表页) +└── active.html (激活页) + +修改的文件: +├── pom.xml (添加模块) +├── ruoyi-admin/pom.xml (添加依赖) +├── ruoyi-admin/src/main/resources/templates/login.html +└── ruoyi-admin/src/main/resources/static/ruoyi/login.js +``` + +## 🚀 快速开始 + +### 1. 执行数据库脚本 +```sql +source sql/sys_license.sql; +``` + +### 2. 启用定时任务 +在 RuoYiApplication.java 添加 @EnableScheduling + +### 3. 编译项目 +```bash +mvn clean install +``` + +### 4. 生成授权码 +运行 LicenseGenerator.java 或在系统界面生成 + +### 5. 激活授权码 +登录页点击"激活授权码"输入授权码 + +## 🔧 使用场景 + +### 场景1:软件交付 +- 开发完成后生成授权码 +- 交付给客户时提供授权码 +- 客户激活后可使用指定期限 + +### 场景2:试用版本 +- 生成30天试用授权码 +- 客户试用满意后购买正式授权 +- 激活正式授权码延长使用期限 + +### 场景3:订阅服务 +- 按年生成授权码 +- 到期前提醒客户续费 +- 续费后激活新授权码 + +### 场景4:多项目复用 +- 将license模块复制到其他项目 +- 修改密钥和配置 +- 快速实现授权功能 + +## ⚙️ 自定义配置 + +### 修改密钥(必须) +```java +// LicenseUtils.java +private static final String SECRET_KEY = "YourKey16Chars!!"; +``` + +### 调整检查频率 +```java +// LicenseCheckTask.java +@Scheduled(cron = "0 */10 * * * ?") // 改为10分钟 +``` + +### 自定义拦截路径 +```java +// LicenseConfig.java +.excludePathPatterns("/api/**", "/public/**") +``` + +## 📊 数据库表结构 + +```sql +sys_license (授权表) +├── license_id (授权ID - 主键) +├── license_code (授权码 - 加密存储) +├── start_time (开始时间) +├── expire_time (结束时间) +├── status (状态: 0未激活 1已激活 2已过期) +├── active_time (激活时间) +├── active_by (激活人) +├── create_by (创建者) +├── create_time (创建时间) +├── update_by (更新者) +├── update_time (更新时间) +└── remark (备注) +``` + +## 🔐 安全建议 + +1. **生产环境必须修改默认密钥** +2. **授权码通过安全渠道传递** +3. **定期备份授权表数据** +4. **限制授权管理菜单权限** +5. **监控授权激活日志** + +## 📝 后续优化建议 + +1. **硬件绑定** - 绑定服务器MAC地址或CPU序列号 +2. **在线验证** - 连接授权服务器在线验证 +3. **授权分级** - 不同授权码对应不同功能权限 +4. **自动续费** - 集成支付接口自动续费 +5. **授权统计** - 统计授权使用情况和到期提醒 + +## ✅ 测试清单 + +- [ ] 数据库表创建成功 +- [ ] 菜单权限配置正确 +- [ ] 授权码生成功能正常 +- [ ] 授权码加密解密正确 +- [ ] 登录页激活功能正常 +- [ ] 系统内激活功能正常 +- [ ] 授权拦截器生效 +- [ ] 定时任务执行正常 +- [ ] 授权过期自动踢出 +- [ ] 授权列表查询正常 + +## 📞 技术支持 + +如有问题,请查看: +1. README.md - 使用说明 +2. INTEGRATION.md - 集成指南 +3. RuoYi官方文档 + +--- + +**开发完成时间**: 2024 +**模块版本**: 1.0.0 +**适用框架**: RuoYi v4.8.2 +**技术栈**: SpringBoot + MyBatis + Shiro + Thymeleaf diff --git a/dosc/ruoyi-license/pom.xml b/dosc/ruoyi-license/pom.xml new file mode 100644 index 0000000..d287653 --- /dev/null +++ b/dosc/ruoyi-license/pom.xml @@ -0,0 +1,39 @@ + + + + ruoyi + com.ruoyi + 3.8.9 + + 4.0.0 + + ruoyi-license + + + 授权码管理模块 + + + + + + + com.ruoyi + ruoyi-common + + + + + com.ruoyi + ruoyi-system + + + + + org.springframework.boot + spring-boot-starter-web + + + + diff --git a/dosc/ruoyi-license/src/main/java/com/ruoyi/license/config/.WeDrive b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/config/.WeDrive new file mode 100644 index 0000000..c216a2c --- /dev/null +++ b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/config/.WeDrive @@ -0,0 +1 @@ +C:\Users\李涛\Documents\WXWork\1688851319997782\WeDrive\福莱瑞达\软件产品中心\软件产品中心共享资料\集成授权码功能\vue版本集成\授权码\ruoyi-license\src\main\java\com\ruoyi\license\config \ No newline at end of file diff --git a/dosc/ruoyi-license/src/main/java/com/ruoyi/license/config/LicenseConfig.java b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/config/LicenseConfig.java new file mode 100644 index 0000000..2c4a18a --- /dev/null +++ b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/config/LicenseConfig.java @@ -0,0 +1,61 @@ +package com.ruoyi.license.config; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import com.ruoyi.framework.config.properties.PermitAllUrlProperties; +import com.ruoyi.license.interceptor.LicenseInterceptor; + +/** + * 授权模块配置 + * + * @author ruoyi + */ +@Configuration +public class LicenseConfig implements WebMvcConfigurer +{ + @Autowired + private LicenseInterceptor licenseInterceptor; + + @Autowired + private PermitAllUrlProperties permitAllUrl; + + @Value("${license.enabled:false}") + private boolean licenseEnabled; + + private static final List BASE_EXCLUDE = Arrays.asList( + "/login", + "/logout", + "/register", + "/captchaImage", + "/system/license/active", + "/swagger-ui.html", + "/swagger-resources/**", + "/webjars/**", + "/*/api-docs", + "/druid/**", + "/*.html", + "/**/*.html", + "/**/*.css", + "/**/*.js", + "/profile/**" + ); + + @Override + public void addInterceptors(InterceptorRegistry registry) + { + if (licenseEnabled) + { + List excludeList = new ArrayList<>(BASE_EXCLUDE); + excludeList.addAll(permitAllUrl.getUrls()); + registry.addInterceptor(licenseInterceptor) + .addPathPatterns("/**") + .excludePathPatterns(excludeList); + } + } +} diff --git a/dosc/ruoyi-license/src/main/java/com/ruoyi/license/domain/.WeDrive b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/domain/.WeDrive new file mode 100644 index 0000000..be19c04 --- /dev/null +++ b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/domain/.WeDrive @@ -0,0 +1 @@ +C:\Users\李涛\Documents\WXWork\1688851319997782\WeDrive\福莱瑞达\软件产品中心\软件产品中心共享资料\集成授权码功能\vue版本集成\授权码\ruoyi-license\src\main\java\com\ruoyi\license\domain \ No newline at end of file diff --git a/dosc/ruoyi-license/src/main/java/com/ruoyi/license/domain/SysLicense.java b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/domain/SysLicense.java new file mode 100644 index 0000000..90dfc8d --- /dev/null +++ b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/domain/SysLicense.java @@ -0,0 +1,105 @@ +package com.ruoyi.license.domain; + +import com.ruoyi.common.core.domain.BaseEntity; +import java.util.Date; + +/** + * 系统授权码对象 sys_license + * + * @author ruoyi + */ +public class SysLicense extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 授权ID */ + private Long licenseId; + + /** 授权码 */ + private String licenseCode; + + /** 授权开始时间 */ + private Date startTime; + + /** 授权结束时间 */ + private Date expireTime; + + /** 授权状态(0未激活 1已激活 2已过期) */ + private String status; + + /** 激活时间 */ + private Date activeTime; + + /** 激活人 */ + private String activeBy; + + public Long getLicenseId() + { + return licenseId; + } + + public void setLicenseId(Long licenseId) + { + this.licenseId = licenseId; + } + + public String getLicenseCode() + { + return licenseCode; + } + + public void setLicenseCode(String licenseCode) + { + this.licenseCode = licenseCode; + } + + public Date getStartTime() + { + return startTime; + } + + public void setStartTime(Date startTime) + { + this.startTime = startTime; + } + + public Date getExpireTime() + { + return expireTime; + } + + public void setExpireTime(Date expireTime) + { + this.expireTime = expireTime; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + public Date getActiveTime() + { + return activeTime; + } + + public void setActiveTime(Date activeTime) + { + this.activeTime = activeTime; + } + + public String getActiveBy() + { + return activeBy; + } + + public void setActiveBy(String activeBy) + { + this.activeBy = activeBy; + } +} diff --git a/dosc/ruoyi-license/src/main/java/com/ruoyi/license/interceptor/.WeDrive b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/interceptor/.WeDrive new file mode 100644 index 0000000..67e9730 --- /dev/null +++ b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/interceptor/.WeDrive @@ -0,0 +1 @@ +C:\Users\李涛\Documents\WXWork\1688851319997782\WeDrive\福莱瑞达\软件产品中心\软件产品中心共享资料\集成授权码功能\vue版本集成\授权码\ruoyi-license\src\main\java\com\ruoyi\license\interceptor \ No newline at end of file diff --git a/dosc/ruoyi-license/src/main/java/com/ruoyi/license/interceptor/LicenseInterceptor.java b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/interceptor/LicenseInterceptor.java new file mode 100644 index 0000000..a2cbc64 --- /dev/null +++ b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/interceptor/LicenseInterceptor.java @@ -0,0 +1,46 @@ +package com.ruoyi.license.interceptor; + +import java.io.PrintWriter; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.HandlerInterceptor; +import com.ruoyi.license.service.ISysLicenseService; + +/** + * 授权拦截器 + * + * @author ruoyi + */ +@Component +public class LicenseInterceptor implements HandlerInterceptor +{ + @Autowired + private ISysLicenseService licenseService; + + @Value("${license.enabled:false}") + private boolean licenseEnabled; + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception + { + if (!licenseEnabled) + { + return true; + } + + if (!licenseService.checkLicenseValid()) + { + response.setStatus(HttpServletResponse.SC_OK); + response.setContentType("application/json;charset=UTF-8"); + PrintWriter writer = response.getWriter(); + writer.write("{\"code\":500,\"msg\":\"\u7cfb\u7edf\u6388\u6743\u5df2\u8fc7\u671f\uff0c\u8bf7\u8054\u7cfb\u7ba1\u7406\u5458\u6fc0\u6d3b\u6388\u6743\u7801\"}"); + writer.flush(); + return false; + } + + return true; + } +} diff --git a/dosc/ruoyi-license/src/main/java/com/ruoyi/license/mapper/.WeDrive b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/mapper/.WeDrive new file mode 100644 index 0000000..303125d --- /dev/null +++ b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/mapper/.WeDrive @@ -0,0 +1 @@ +C:\Users\李涛\Documents\WXWork\1688851319997782\WeDrive\福莱瑞达\软件产品中心\软件产品中心共享资料\集成授权码功能\vue版本集成\授权码\ruoyi-license\src\main\java\com\ruoyi\license\mapper \ No newline at end of file diff --git a/dosc/ruoyi-license/src/main/java/com/ruoyi/license/mapper/SysLicenseMapper.java b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/mapper/SysLicenseMapper.java new file mode 100644 index 0000000..bd29eb6 --- /dev/null +++ b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/mapper/SysLicenseMapper.java @@ -0,0 +1,67 @@ +package com.ruoyi.license.mapper; + +import com.ruoyi.license.domain.SysLicense; +import java.util.List; + +/** + * 授权码Mapper接口 + * + * @author ruoyi + */ +public interface SysLicenseMapper +{ + /** + * 查询授权码 + * + * @param licenseId 授权码ID + * @return 授权码 + */ + public SysLicense selectSysLicenseById(Long licenseId); + + /** + * 查询授权码列表 + * + * @param sysLicense 授权码 + * @return 授权码集合 + */ + public List selectSysLicenseList(SysLicense sysLicense); + + /** + * 查询当前有效的授权码 + * + * @return 授权码 + */ + public SysLicense selectActiveLicense(); + + /** + * 新增授权码 + * + * @param sysLicense 授权码 + * @return 结果 + */ + public int insertSysLicense(SysLicense sysLicense); + + /** + * 修改授权码 + * + * @param sysLicense 授权码 + * @return 结果 + */ + public int updateSysLicense(SysLicense sysLicense); + + /** + * 删除授权码 + * + * @param licenseId 授权码ID + * @return 结果 + */ + public int deleteSysLicenseById(Long licenseId); + + /** + * 批量删除授权码 + * + * @param licenseIds 需要删除的数据ID + * @return 结果 + */ + public int deleteSysLicenseByIds(String[] licenseIds); +} diff --git a/dosc/ruoyi-license/src/main/java/com/ruoyi/license/service/.WeDrive b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/service/.WeDrive new file mode 100644 index 0000000..8e4560f --- /dev/null +++ b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/service/.WeDrive @@ -0,0 +1 @@ +C:\Users\李涛\Documents\WXWork\1688851319997782\WeDrive\福莱瑞达\软件产品中心\软件产品中心共享资料\集成授权码功能\vue版本集成\授权码\ruoyi-license\src\main\java\com\ruoyi\license\service \ No newline at end of file diff --git a/dosc/ruoyi-license/src/main/java/com/ruoyi/license/service/ISysLicenseService.java b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/service/ISysLicenseService.java new file mode 100644 index 0000000..1a9a225 --- /dev/null +++ b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/service/ISysLicenseService.java @@ -0,0 +1,87 @@ +package com.ruoyi.license.service; + +import com.ruoyi.license.domain.SysLicense; +import java.util.List; + +/** + * 授权码Service接口 + * + * @author ruoyi + */ +public interface ISysLicenseService +{ + /** + * 查询授权码 + * + * @param licenseId 授权码ID + * @return 授权码 + */ + public SysLicense selectSysLicenseById(Long licenseId); + + /** + * 查询授权码列表 + * + * @param sysLicense 授权码 + * @return 授权码集合 + */ + public List selectSysLicenseList(SysLicense sysLicense); + + /** + * 新增授权码 + * + * @param sysLicense 授权码 + * @return 结果 + */ + public int insertSysLicense(SysLicense sysLicense); + + /** + * 修改授权码 + * + * @param sysLicense 授权码 + * @return 结果 + */ + public int updateSysLicense(SysLicense sysLicense); + + /** + * 批量删除授权码 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteSysLicenseByIds(String ids); + + /** + * 删除授权码信息 + * + * @param licenseId 授权码ID + * @return 结果 + */ + public int deleteSysLicenseById(Long licenseId); + + /** + * 激活授权码 + * + * @param licenseCode 授权码 + * @return 结果 + */ + public int activeLicense(String licenseCode); + + /** + * 检查授权是否有效 + * + * @return true有效 false无效 + */ + public boolean checkLicenseValid(); + + /** + * 获取当前有效授权信息 + * + * @return 授权信息 + */ + public SysLicense getActiveLicense(); + + /** + * 更新过期授权码状态 + */ + public void updateExpiredLicenses(); +} diff --git a/dosc/ruoyi-license/src/main/java/com/ruoyi/license/service/impl/.WeDrive b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/service/impl/.WeDrive new file mode 100644 index 0000000..d81aedd --- /dev/null +++ b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/service/impl/.WeDrive @@ -0,0 +1 @@ +C:\Users\李涛\Documents\WXWork\1688851319997782\WeDrive\福莱瑞达\软件产品中心\软件产品中心共享资料\集成授权码功能\vue版本集成\授权码\ruoyi-license\src\main\java\com\ruoyi\license\service\impl \ No newline at end of file diff --git a/dosc/ruoyi-license/src/main/java/com/ruoyi/license/service/impl/SysLicenseServiceImpl.java b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/service/impl/SysLicenseServiceImpl.java new file mode 100644 index 0000000..79f070c --- /dev/null +++ b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/service/impl/SysLicenseServiceImpl.java @@ -0,0 +1,266 @@ +package com.ruoyi.license.service.impl; + +import java.util.Date; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.common.core.text.Convert; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.license.domain.SysLicense; +import com.ruoyi.license.mapper.SysLicenseMapper; +import com.ruoyi.license.service.ISysLicenseService; +import com.ruoyi.license.util.LicenseUtils; + +/** + * 授权码Service业务层处理 + * + * @author ruoyi + */ +@Service +public class SysLicenseServiceImpl implements ISysLicenseService +{ + @Autowired + private SysLicenseMapper sysLicenseMapper; + + @Autowired + private com.ruoyi.system.mapper.SysConfigMapper sysConfigMapper; + + @org.springframework.beans.factory.annotation.Value("${license.enabled:false}") + private boolean licenseEnabled; + + /** + * 查询授权码 + * + * @param licenseId 授权码ID + * @return 授权码 + */ + @Override + public SysLicense selectSysLicenseById(Long licenseId) + { + return sysLicenseMapper.selectSysLicenseById(licenseId); + } + + /** + * 查询授权码列表 + * + * @param sysLicense 授权码 + * @return 授权码 + */ + @Override + public List selectSysLicenseList(SysLicense sysLicense) + { + return sysLicenseMapper.selectSysLicenseList(sysLicense); + } + + /** + * 新增授权码 + * + * @param sysLicense 授权码 + * @return 结果 + */ + @Override + public int insertSysLicense(SysLicense sysLicense) + { + sysLicense.setCreateTime(new Date()); + return sysLicenseMapper.insertSysLicense(sysLicense); + } + + /** + * 修改授权码 + * + * @param sysLicense 授权码 + * @return 结果 + */ + @Override + public int updateSysLicense(SysLicense sysLicense) + { + sysLicense.setUpdateTime(new Date()); + return sysLicenseMapper.updateSysLicense(sysLicense); + } + + /** + * 删除授权码对象 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + @Override + public int deleteSysLicenseByIds(String ids) + { + return sysLicenseMapper.deleteSysLicenseByIds(Convert.toStrArray(ids)); + } + + /** + * 删除授权码信息 + * + * @param licenseId 授权码ID + * @return 结果 + */ + @Override + public int deleteSysLicenseById(Long licenseId) + { + return sysLicenseMapper.deleteSysLicenseById(licenseId); + } + + /** + * 激活授权码 + * + * @param licenseCode 授权码 + * @return 结果 + */ + @Override + public int activeLicense(String licenseCode) + { + if (StringUtils.isEmpty(licenseCode)) + { + return 0; + } + + // 验证授权码格式 + if (!LicenseUtils.validateFormat(licenseCode)) + { + return 0; + } + + try + { + // 从配置表获取项目编号 + String projectNo = sysConfigMapper.selectConfigByKey("fortucky.project.no"); + if (StringUtils.isEmpty(projectNo)) + { + return 0; + } + + // 解析授权码 + long expireTime = LicenseUtils.parseLicense(licenseCode, projectNo); + if (expireTime == 0) + { + return 0; + } + + Date now = new Date(); + Date startTime = now; + Date expireDate = new Date(expireTime); + + // 验证是否已过期 + if (expireDate.before(now)) + { + return 0; + } + + // 创建授权记录 + SysLicense license = new SysLicense(); + license.setLicenseCode(licenseCode); + license.setStartTime(startTime); + license.setExpireTime(expireDate); + license.setStatus("1"); + license.setActiveTime(now); + license.setCreateTime(now); + + return sysLicenseMapper.insertSysLicense(license); + } + catch (Exception e) + { + return 0; + } + } + + /** + * 检查授权是否有效 + * + * @return true有效 false无效 + */ + @Override + public boolean checkLicenseValid() + { + // 如果授权码功能未启用,直接返回true + if (!licenseEnabled) + { + return true; + } + + SysLicense license = sysLicenseMapper.selectActiveLicense(); + if (license == null) + { + System.out.println("[授权检查] 没有找到激活的授权码"); + return false; + } + + // 从配置表获取项目编号 + String projectNo = sysConfigMapper.selectConfigByKey("fortucky.project.no"); + if (StringUtils.isEmpty(projectNo)) + { + System.out.println("[授权检查] 项目编号未配置"); + return false; + } + + System.out.println("[授权检查] 授权码: " + license.getLicenseCode()); + System.out.println("[授权检查] 项目编号: " + projectNo); + + // 从授权码解析过期时间 + long expireTime = LicenseUtils.parseLicense(license.getLicenseCode(), projectNo); + if (expireTime == 0) + { + System.out.println("[授权检查] 授权码解析失败"); + return false; + } + + Date now = new Date(); + System.out.println("[授权检查] 当前时间: " + now.getTime()); + System.out.println("[授权检查] 过期时间: " + expireTime); + + if (expireTime < now.getTime()) + { + System.out.println("[授权检查] 授权已过期"); + // 更新为过期状态 + license.setStatus("2"); + sysLicenseMapper.updateSysLicense(license); + return false; + } + + + return true; + } + + /** + * 获取当前有效授权信息 + * + * @return 授权信息 + */ + @Override + public SysLicense getActiveLicense() + { + return sysLicenseMapper.selectActiveLicense(); + } + + /** + * 更新过期授权码状态 + */ + @Override + public void updateExpiredLicenses() + { + SysLicense query = new SysLicense(); + query.setStatus("1"); + List licenses = sysLicenseMapper.selectSysLicenseList(query); + + // 从配置表获取项目编号 + String projectNo = sysConfigMapper.selectConfigByKey("fortucky.project.no"); + if (StringUtils.isEmpty(projectNo)) + { + return; + } + + Date now = new Date(); + for (SysLicense license : licenses) + { + // 从授权码解析过期时间 + long expireTime = LicenseUtils.parseLicense(license.getLicenseCode(), projectNo); + if (expireTime > 0 && expireTime < now.getTime()) + { + license.setStatus("2"); + license.setUpdateTime(now); + sysLicenseMapper.updateSysLicense(license); + } + } + } +} diff --git a/dosc/ruoyi-license/src/main/java/com/ruoyi/license/task/.WeDrive b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/task/.WeDrive new file mode 100644 index 0000000..27b60e6 --- /dev/null +++ b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/task/.WeDrive @@ -0,0 +1 @@ +C:\Users\李涛\Documents\WXWork\1688851319997782\WeDrive\福莱瑞达\软件产品中心\软件产品中心共享资料\集成授权码功能\vue版本集成\授权码\ruoyi-license\src\main\java\com\ruoyi\license\task \ No newline at end of file diff --git a/dosc/ruoyi-license/src/main/java/com/ruoyi/license/task/LicenseCheckTask.java b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/task/LicenseCheckTask.java new file mode 100644 index 0000000..9963c61 --- /dev/null +++ b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/task/LicenseCheckTask.java @@ -0,0 +1,47 @@ +package com.ruoyi.license.task; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.license.service.ISysLicenseService; + +/** + * 授权检查定时任务 + * + * @author ruoyi + */ +@Component +public class LicenseCheckTask +{ + @Autowired + private ISysLicenseService licenseService; + + @Autowired + private RedisCache redisCache; + + @Value("${license.enabled:false}") + private boolean licenseEnabled; + + /** + * 每5分钟检查一次授权状态 + */ + @Scheduled(cron = "0 */5 * * * ?") + public void checkLicense() + { + if (!licenseEnabled) + { + return; + } + + if (!licenseService.checkLicenseValid()) + { + // 授权无效,删除 Redis 中所有登录 token,强制踢出所有在线用户 + redisCache.deleteObject(redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*")); + } + + licenseService.updateExpiredLicenses(); + } +} diff --git a/dosc/ruoyi-license/src/main/java/com/ruoyi/license/util/.WeDrive b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/util/.WeDrive new file mode 100644 index 0000000..2fb358f --- /dev/null +++ b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/util/.WeDrive @@ -0,0 +1 @@ +C:\Users\李涛\Documents\WXWork\1688851319997782\WeDrive\福莱瑞达\软件产品中心\软件产品中心共享资料\集成授权码功能\vue版本集成\授权码\ruoyi-license\src\main\java\com\ruoyi\license\util \ No newline at end of file diff --git a/dosc/ruoyi-license/src/main/java/com/ruoyi/license/util/LicenseGenerator.java b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/util/LicenseGenerator.java new file mode 100644 index 0000000..16ce407 --- /dev/null +++ b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/util/LicenseGenerator.java @@ -0,0 +1,127 @@ +package com.ruoyi.license.util; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Scanner; + +/** + * 授权码生成工具(独立运行) + * + * @author ruoyi + */ +public class LicenseGenerator +{ + public static void main(String[] args) + { + Scanner scanner = new Scanner(System.in); + + System.out.println("========================================"); + System.out.println(" RuoYi 授权码生成工具"); + System.out.println("========================================"); + System.out.println(); + + try + { + // 选择授权类型 + System.out.println("请选择授权类型:"); + System.out.println("1. 5分钟测试"); + System.out.println("2. 1个月授权"); + System.out.println("3. 3个月授权"); + System.out.println("4. 1年授权"); + System.out.println("5. 5年授权"); + System.out.println("6. 长期授权"); + System.out.print("请输入选项(1-6): "); + String typeChoice = scanner.nextLine().trim(); + + String type; + String typeDesc; + long expireTime; + + switch (typeChoice) + { + case "1": + type = LicenseUtils.TYPE_TEST; + typeDesc = "5分钟测试"; + expireTime = System.currentTimeMillis() + 5 * 60 * 1000L; + break; + case "2": + type = LicenseUtils.TYPE_MONTH; + typeDesc = "1个月授权"; + expireTime = System.currentTimeMillis() + 30L * 24 * 60 * 60 * 1000; + break; + case "3": + type = LicenseUtils.TYPE_THREE; + typeDesc = "3个月授权"; + expireTime = System.currentTimeMillis() + 90L * 24 * 60 * 60 * 1000; + break; + case "4": + type = LicenseUtils.TYPE_YEAR; + typeDesc = "1年授权"; + expireTime = System.currentTimeMillis() + 365L * 24 * 60 * 60 * 1000; + break; + case "5": + type = LicenseUtils.TYPE_FIVE; + typeDesc = "5年授权"; + expireTime = System.currentTimeMillis() + 5 * 365L * 24 * 60 * 60 * 1000; + break; + case "6": + type = LicenseUtils.TYPE_FOREVER; + typeDesc = "长期授权"; + expireTime = System.currentTimeMillis() + 100 * 365L * 24 * 60 * 60 * 1000; + break; + default: + System.out.println("错误:无效的选项"); + return; + } + + // 输入项目编号 + System.out.print("请输入项目编号: "); + String projectNo = scanner.nextLine().trim(); + + if (projectNo.isEmpty()) + { + System.out.println("错误:项目编号不能为空"); + return; + } + + // 生成授权码 + String licenseCode = LicenseUtils.generateLicense(type, projectNo); + + if (licenseCode == null) + { + System.out.println("错误:授权码生成失败"); + return; + } + + // 格式化日期 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date now = new Date(); + Date expire = new Date(expireTime); + + System.out.println(); + System.out.println("========================================"); + System.out.println("授权码生成成功!"); + System.out.println("========================================"); + System.out.println("授权类型: " + typeDesc); + System.out.println("项目编号: " + projectNo); + System.out.println("当前时间: " + sdf.format(now)); + System.out.println("过期时间: " + sdf.format(expire)); + System.out.println("----------------------------------------"); + System.out.println("授权码:"); + System.out.println(licenseCode); + System.out.println("========================================"); + System.out.println(); + System.out.println("请妥善保管授权码,在系统中激活后即可使用。"); + System.out.println("注意:系统配置中的项目编号必须与此处一致才能激活。"); + } + catch (Exception e) + { + System.out.println("错误:" + e.getMessage()); + e.printStackTrace(); + } + finally + { + scanner.close(); + } + } +} diff --git a/dosc/ruoyi-license/src/main/java/com/ruoyi/license/util/LicenseTest.java b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/util/LicenseTest.java new file mode 100644 index 0000000..0b69a1c --- /dev/null +++ b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/util/LicenseTest.java @@ -0,0 +1,89 @@ +package com.ruoyi.license.util; + +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * 授权码测试工具 + * + * @author ruoyi + */ +public class LicenseTest +{ + public static void main(String[] args) + { + System.out.println("========================================"); + System.out.println(" 授权码功能测试"); + System.out.println("========================================"); + System.out.println(); + + String projectNo = "TEST001"; + + // 测试1:生成各类型授权码 + System.out.println("【测试1】生成各类型授权码"); + String testCode = LicenseUtils.generateLicense(LicenseUtils.TYPE_TEST, projectNo); + String yearCode = LicenseUtils.generateLicense(LicenseUtils.TYPE_YEAR, projectNo); + String fiveCode = LicenseUtils.generateLicense(LicenseUtils.TYPE_FIVE, projectNo); + String foreverCode = LicenseUtils.generateLicense(LicenseUtils.TYPE_FOREVER, projectNo); + + System.out.println("5分钟测试: " + testCode); + System.out.println("1年授权: " + yearCode); + System.out.println("5年授权: " + fiveCode); + System.out.println("长期授权: " + foreverCode); + System.out.println("结果: ✓ 通过"); + System.out.println(); + + // 测试2:验证授权码格式 + System.out.println("【测试2】验证授权码格式"); + boolean isValid = LicenseUtils.validateFormat(yearCode); + System.out.println("格式验证: " + (isValid ? "✓ 通过" : "✗ 失败")); + System.out.println(); + + // 测试3:解析授权码 + System.out.println("【测试3】解析授权码"); + long expireTime = LicenseUtils.parseLicense(yearCode, projectNo); + if (expireTime > 0) + { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date expire = new Date(expireTime); + System.out.println("过期时间: " + sdf.format(expire)); + System.out.println("结果: ✓ 通过"); + } + else + { + System.out.println("结果: ✗ 失败"); + } + System.out.println(); + + // 测试4:项目编号验证 + System.out.println("【测试4】项目编号验证"); + long validResult = LicenseUtils.parseLicense(yearCode, projectNo); + long invalidResult = LicenseUtils.parseLicense(yearCode, "WRONG001"); + System.out.println("正确项目编号: " + (validResult > 0 ? "✓ 通过" : "✗ 失败")); + System.out.println("错误项目编号: " + (invalidResult == 0 ? "✓ 通过(正确拒绝)" : "✗ 失败")); + System.out.println(); + + // 测试5:授权码格式展示 + System.out.println("【测试5】授权码格式展示"); + System.out.println("授权码: " + yearCode); + String[] parts = yearCode.split("_"); + if (parts.length == 5) + { + System.out.println("前缀: " + parts[0]); + System.out.println("类型: " + parts[1] + " (" + LicenseUtils.getTypeDesc(parts[1]) + ")"); + System.out.println("项目编号: " + parts[2]); + System.out.println("加密时间: " + parts[3]); + System.out.println("校验码: " + parts[4]); + System.out.println("结果: ✓ 通过"); + } + else + { + System.out.println("结果: ✗ 失败"); + } + System.out.println(); + + System.out.println("========================================"); + System.out.println("测试完成!"); + System.out.println("========================================"); + } +} diff --git a/dosc/ruoyi-license/src/main/java/com/ruoyi/license/util/LicenseUtils.java b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/util/LicenseUtils.java new file mode 100644 index 0000000..ef456ae --- /dev/null +++ b/dosc/ruoyi-license/src/main/java/com/ruoyi/license/util/LicenseUtils.java @@ -0,0 +1,275 @@ +package com.ruoyi.license.util; + +import java.util.Base64; +import java.util.Date; +import javax.crypto.Cipher; +import javax.crypto.spec.SecretKeySpec; + +/** + * 授权码工具类 + * 格式: FORTUCKY_授权类型_项目编号_加密时间_校验码 + * + * @author ruoyi + */ +public class LicenseUtils +{ + // 密钥(16位) + private static final String SECRET_KEY = "RuoYiLicense2024"; + + // 授权类型 + public static final String TYPE_TEST = "TEST"; // 5分钟测试 + public static final String TYPE_MONTH = "MONTH"; // 1个月 + public static final String TYPE_THREE = "THREE"; // 3个月 + public static final String TYPE_YEAR = "YEAR"; // 1年 + public static final String TYPE_FIVE = "FIVE"; // 5年 + public static final String TYPE_FOREVER = "FOREVER"; // 长期 + + /** + * 生成授权码 + * + * @param type 授权类型 + * @param projectNo 项目编号 + * @return 授权码 + */ + public static String generateLicense(String type, String projectNo) + { + try + { + long expireTime = calculateExpireTime(type); + if (expireTime == 0) + { + return null; + } + + // 加密过期时间 + String encryptedTime = encrypt(String.valueOf(expireTime)); + if (encryptedTime == null) + { + return null; + } + + // 生成校验码(取加密时间的前8位MD5) + String checkCode = generateCheckCode(type, projectNo, encryptedTime); + + // 拼接授权码: FORTUCKY_类型_项目编号_加密时间_校验码 + return "FORTUCKY_" + type + "_" + projectNo + "_" + encryptedTime + "_" + checkCode; + } + catch (Exception e) + { + return null; + } + } + + /** + * 验证授权码格式 + * + * @param licenseCode 授权码 + * @return true有效 false无效 + */ + public static boolean validateFormat(String licenseCode) + { + if (licenseCode == null || licenseCode.trim().isEmpty()) + { + return false; + } + + String[] parts = licenseCode.split("_"); + if (parts.length != 5) + { + return false; + } + + if (!"FORTUCKY".equals(parts[0])) + { + return false; + } + + // 验证授权类型 + String type = parts[1]; + if (!TYPE_TEST.equals(type) && !TYPE_MONTH.equals(type) && !TYPE_THREE.equals(type) && + !TYPE_YEAR.equals(type) && !TYPE_FIVE.equals(type) && !TYPE_FOREVER.equals(type)) + { + return false; + } + + return true; + } + + /** + * 解析授权码 + * + * @param licenseCode 授权码 + * @param projectNo 系统项目编号 + * @return 过期时间戳,0表示解析失败 + */ + public static long parseLicense(String licenseCode, String projectNo) + { + try + { + if (!validateFormat(licenseCode)) + { + return 0; + } + + String[] parts = licenseCode.split("_"); + String type = parts[1]; + String codeProjectNo = parts[2]; + String encryptedTime = parts[3]; + String checkCode = parts[4]; + + // 验证项目编号 + if (!codeProjectNo.equals(projectNo)) + { + return 0; + } + + // 验证校验码 + String expectedCheckCode = generateCheckCode(type, codeProjectNo, encryptedTime); + if (!checkCode.equals(expectedCheckCode)) + { + return 0; + } + + // 解密时间 + String decrypted = decrypt(encryptedTime); + if (decrypted == null) + { + return 0; + } + + return Long.parseLong(decrypted); + } + catch (Exception e) + { + return 0; + } + } + + /** + * 获取授权类型描述 + * + * @param type 授权类型 + * @return 描述 + */ + public static String getTypeDesc(String type) + { + switch (type) + { + case TYPE_TEST: return "5分钟测试"; + case TYPE_MONTH: return "1个月授权"; + case TYPE_THREE: return "3个月授权"; + case TYPE_YEAR: return "1年授权"; + case TYPE_FIVE: return "5年授权"; + case TYPE_FOREVER: return "长期授权"; + default: return "未知"; + } + } + + /** + * 计算过期时间 + * + * @param type 授权类型 + * @return 过期时间戳 + */ + private static long calculateExpireTime(String type) + { + long now = System.currentTimeMillis(); + + switch (type) + { + case TYPE_TEST: + return now + 5 * 60 * 1000L; // 5分钟 + case TYPE_MONTH: + return now + 30L * 24 * 60 * 60 * 1000; // 1个月 + case TYPE_THREE: + return now + 90L * 24 * 60 * 60 * 1000; // 3个月 + case TYPE_YEAR: + return now + 365L * 24 * 60 * 60 * 1000; // 1年 + case TYPE_FIVE: + return now + 5 * 365L * 24 * 60 * 60 * 1000; // 5年 + case TYPE_FOREVER: + return now + 100 * 365L * 24 * 60 * 60 * 1000; // 100年(视为长期) + default: + return 0; + } + } + + /** + * 生成校验码 + * + * @param type 授权类型 + * @param projectNo 项目编号 + * @param encryptedTime 加密时间 + * @return 校验码 + */ + private static String generateCheckCode(String type, String projectNo, String encryptedTime) + { + try + { + String data = type + projectNo + encryptedTime; + java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5"); + byte[] hash = md.digest(data.getBytes("UTF-8")); + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < Math.min(4, hash.length); i++) + { + sb.append(String.format("%02x", hash[i])); + } + return sb.toString().toUpperCase(); + } + catch (Exception e) + { + return "00000000"; + } + } + + /** + * 加密 + * + * @param data 原始数据 + * @return 加密后的数据 + */ + private static String encrypt(String data) + { + try + { + SecretKeySpec key = new SecretKeySpec(SECRET_KEY.getBytes("UTF-8"), "AES"); + Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); + cipher.init(Cipher.ENCRYPT_MODE, key); + byte[] encrypted = cipher.doFinal(data.getBytes("UTF-8")); + return Base64.getEncoder().encodeToString(encrypted).replace("+", "-").replace("/", ".").replace("=", ""); + } + catch (Exception e) + { + return null; + } + } + + /** + * 解密 + * + * @param encryptedData 加密数据 + * @return 解密后的数据 + */ + private static String decrypt(String encryptedData) + { + try + { + String base64Data = encryptedData.replace("-", "+").replace(".", "/"); + int padding = (4 - base64Data.length() % 4) % 4; + for (int i = 0; i < padding; i++) + { + base64Data += "="; + } + + SecretKeySpec key = new SecretKeySpec(SECRET_KEY.getBytes("UTF-8"), "AES"); + Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); + cipher.init(Cipher.DECRYPT_MODE, key); + byte[] decrypted = cipher.doFinal(Base64.getDecoder().decode(base64Data)); + return new String(decrypted, "UTF-8"); + } + catch (Exception e) + { + return null; + } + } +} diff --git a/dosc/ruoyi-license/src/main/resources/mapper/license/.WeDrive b/dosc/ruoyi-license/src/main/resources/mapper/license/.WeDrive new file mode 100644 index 0000000..f82e862 --- /dev/null +++ b/dosc/ruoyi-license/src/main/resources/mapper/license/.WeDrive @@ -0,0 +1 @@ +C:\Users\李涛\Documents\WXWork\1688851319997782\WeDrive\福莱瑞达\软件产品中心\软件产品中心共享资料\集成授权码功能\vue版本集成\授权码\ruoyi-license\src\main\resources\mapper\license \ No newline at end of file diff --git a/dosc/ruoyi-license/src/main/resources/mapper/license/SysLicenseMapper.xml b/dosc/ruoyi-license/src/main/resources/mapper/license/SysLicenseMapper.xml new file mode 100644 index 0000000..e6603f0 --- /dev/null +++ b/dosc/ruoyi-license/src/main/resources/mapper/license/SysLicenseMapper.xml @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + select license_id, license_code, start_time, expire_time, status, active_time, active_by, create_by, create_time, update_by, update_time, remark from sys_license + + + + + + + + + + insert into sys_license + + license_code, + start_time, + expire_time, + status, + active_time, + active_by, + create_by, + create_time, + update_by, + update_time, + remark, + + + #{licenseCode}, + #{startTime}, + #{expireTime}, + #{status}, + #{activeTime}, + #{activeBy}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{remark}, + + + + + update sys_license + + license_code = #{licenseCode}, + start_time = #{startTime}, + expire_time = #{expireTime}, + status = #{status}, + active_time = #{activeTime}, + active_by = #{activeBy}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + + where license_id = #{licenseId} + + + + delete from sys_license where license_id = #{licenseId} + + + + delete from sys_license where license_id in + + #{licenseId} + + + + diff --git a/dosc/vue授权码.md b/dosc/vue授权码.md new file mode 100644 index 0000000..d6c8609 --- /dev/null +++ b/dosc/vue授权码.md @@ -0,0 +1,270 @@ +# 授权码模块集成改动说明 + +> 本文档记录引入 `ruoyi-license` 授权码模块时,对原有项目文件的所有改动(不含 `ruoyi-license` 模块本身及 `SysLicenseController`)。 + +--- + +## 1. 根模块 `pom.xml` + +**文件路径:** `wms/pom.xml` + +**改动内容:** + +1. `` 中注册 `ruoyi-license` 子模块: + +```xml + + ruoyi-admin + ruoyi-framework + ruoyi-system + ruoyi-quartz + ruoyi-generator + ruoyi-common + ruoyi-license + +``` + +2. `` 中声明 `ruoyi-license` 依赖版本: + +```xml + + + com.ruoyi + ruoyi-license + ${ruoyi.version} + +``` + +--- + +## 2. `ruoyi-admin/pom.xml` + +**文件路径:** `wms/ruoyi-admin/pom.xml` + +**改动内容:** + +引入 `ruoyi-license` 依赖,使授权拦截器和配置能被 Spring Boot 扫描加载: + +```xml + + + com.ruoyi + ruoyi-license + +``` + +--- + +## 3. `SecurityConfig.java` + +**文件路径:** `wms/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java` + +**改动内容:** + +在 Spring Security 匿名白名单中加入 `/system/license/active`,允许未登录用户调用激活授权码接口: + +```java +// 改动前 +requests.antMatchers("/login", "/register", "/captchaImage").permitAll() + +// 改动后 +requests.antMatchers("/login", "/register", "/captchaImage", "/system/license/active").permitAll() +``` + +--- + +## 4. 前端 `api/license.js`(新建) + +**文件路径:** `wms/ui/src/api/license.js` + +**改动内容:** + +新建文件,封装授权码相关接口: + +```js +import request from '@/utils/request' + +// 激活授权码(无需登录) +export function activeLicense(licenseCode) { + return request({ + url: '/system/license/active', + method: 'post', + params: { licenseCode } + }) +} + +// 查询当前授权信息(需登录) +export function getLicenseInfo() { + return request({ + url: '/system/license/info', + method: 'get' + }) +} +``` + +--- + +## 5. 登录页 `login.vue` + +**文件路径:** `wms/ui/src/views/login.vue` + +**改动内容:** + +### 5.1 模板部分 + +在登录按钮下方新增"激活授权码"按钮,以及激活弹窗: + +```html + + + 激活授权码 + + + + + + + 取 消 + 激 活 + + +``` + +### 5.2 Script 部分 + +新增 import、data 字段和方法: + +```js +// 新增 import +import { activeLicense } from "@/api/license" + +// 新增 data 字段 +licenseDialogVisible: false, +licenseCode: '', +licenseLoading: false + +// 新增方法 +openLicenseDialog() { + this.licenseCode = '' + this.licenseDialogVisible = true +}, +handleActiveLicense() { + if (!this.licenseCode.trim()) { + this.$message.warning('请输入授权码') + return + } + this.licenseLoading = true + activeLicense(this.licenseCode.trim()).then(res => { + if (res.code === 200) { + this.$message.success(res.msg || '授权码激活成功') + this.licenseDialogVisible = false + } else { + this.$message.error(res.msg || '授权码激活失败') + } + }).catch(() => { + this.$message.error('授权码激活失败') + }).finally(() => { + this.licenseLoading = false + }) +} +``` + +--- + +## 6. 顶部导航栏 `Navbar.vue` + +**文件路径:** `wms/ui/src/layout/components/Navbar.vue` + +**改动内容:** + +### 6.1 模板部分 + +在 navbar 中间插入授权到期警告条(剩余不足 30 天时显示): + +```html +
+ + 系统授权将于 {{ licenseExpireText }} 后过期,请及时联系管理员续期 +
+``` + +### 6.2 Script 部分 + +```js +// 新增 import +import { getLicenseInfo } from '@/api/license' + +// 新增 data 字段 +licenseWarning: false, +licenseExpireText: '', +licenseTimer: null + +// 新增生命周期钩子 +mounted() { + this.checkLicenseExpire() + this.licenseTimer = setInterval(() => this.checkLicenseExpire(), 60 * 1000) +}, +beforeDestroy() { + if (this.licenseTimer) clearInterval(this.licenseTimer) +}, + +// 新增方法 +checkLicenseExpire() { + getLicenseInfo().then(res => { + if (res.code === 200 && res.data && res.data.expireTime) { + const expireTime = new Date(res.data.expireTime).getTime() + const now = Date.now() + const diffMs = expireTime - now + const diffDays = Math.ceil(diffMs / (1000 * 60 * 60 * 24)) + if (diffMs > 0 && diffDays <= 30) { + this.licenseWarning = true + if (diffMs < 1000 * 60 * 60 * 24) { + const hours = Math.floor(diffMs / (1000 * 60 * 60)) + const minutes = Math.floor((diffMs % (1000 * 60 * 60)) / (1000 * 60)) + this.licenseExpireText = hours > 0 ? `${hours} 小时 ${minutes} 分钟` : `${minutes} 分钟` + } else if (diffDays < 7) { + this.licenseExpireText = diffDays + ' 天' + } else { + this.licenseExpireText = Math.ceil(diffDays / 7) + ' 周' + } + } + } + }).catch(() => {}) +} +``` + +### 6.3 样式部分 + +```scss +.license-warning { + position: absolute; + left: 50%; + transform: translateX(-50%); + top: 0; + height: 50px; + line-height: 50px; + font-size: 13px; + color: #e6a23c; + font-weight: 500; + pointer-events: none; + i { margin-right: 4px; } +} +``` + +--- + +## 改动文件汇总 + +| 文件 | 类型 | 说明 | +|---|---|---| +| `wms/pom.xml` | 修改 | 注册模块 + 声明依赖版本 | +| `wms/ruoyi-admin/pom.xml` | 修改 | 引入 ruoyi-license 依赖 | +| `ruoyi-framework/.../SecurityConfig.java` | 修改 | 白名单加入激活授权码接口 | +| `ui/src/api/license.js` | 新建 | 封装激活和查询授权信息接口 | +| `ui/src/views/login.vue` | 修改 | 新增激活授权码按钮和弹窗 | +| `ui/src/layout/components/Navbar.vue` | 修改 | 新增授权到期倒计时警告条 | diff --git a/dosc/授权码vue版本配置手册.docx b/dosc/授权码vue版本配置手册.docx new file mode 100644 index 0000000..e6458c6 Binary files /dev/null and b/dosc/授权码vue版本配置手册.docx differ diff --git a/pom.xml b/pom.xml index 796e05e..8850b9e 100644 --- a/pom.xml +++ b/pom.xml @@ -191,6 +191,13 @@ ${ruoyi.version} + + + com.ruoyi + ruoyi-license + ${ruoyi.version} + + org.springframework.ai spring-ai-bom @@ -243,6 +250,7 @@ ruoyi-quartz ruoyi-generator ruoyi-common + ruoyi-license
pom @@ -251,7 +259,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.13.0 + 3.11.0 true ${java.version} diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index c3d5860..ce7f1fc 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -54,6 +54,12 @@ ruoyi-generator + + + com.ruoyi + ruoyi-license + + org.springframework.ai spring-ai-starter-model-openai diff --git a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java index c52287c..2c1c54c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java @@ -1,9 +1,11 @@ package com.ruoyi; +import java.security.Security; +import java.util.Arrays; +import java.util.stream.Collectors; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; -import org.springframework.context.annotation.ComponentScan; import org.springframework.scheduling.annotation.EnableScheduling; /** @@ -17,6 +19,7 @@ public class RuoYiApplication { public static void main(String[] args) { + enableSqlServerLegacyTls(); // System.setProperty("spring.devtools.restart.enabled", "false"); SpringApplication.run(RuoYiApplication.class, args); System.out.println(""" @@ -24,4 +27,25 @@ public class RuoYiApplication This is a text block with Unicode characters. """); } + + private static void enableSqlServerLegacyTls() + { + if (!Boolean.parseBoolean(System.getProperty("ruoyi.sqlserver.legacyTls.enabled", "true"))) + { + return; + } + + String propertyName = "jdk.tls.disabledAlgorithms"; + String disabledAlgorithms = Security.getProperty(propertyName); + if (disabledAlgorithms == null || disabledAlgorithms.isBlank()) + { + return; + } + + String compatibleAlgorithms = Arrays.stream(disabledAlgorithms.split(",")) + .map(String::trim) + .filter(algorithm -> !"TLSv1".equalsIgnoreCase(algorithm)) + .collect(Collectors.joining(", ")); + Security.setProperty(propertyName, compatibleAlgorithms); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/api/controller/ToErpApiController.java b/ruoyi-admin/src/main/java/com/ruoyi/api/controller/ToErpApiController.java index 3b0e3f0..212e2d8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/api/controller/ToErpApiController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/api/controller/ToErpApiController.java @@ -1,13 +1,19 @@ package com.ruoyi.api.controller; +import cn.hutool.json.JSONUtil; +import com.ruoyi.api.moveMsg.domain.MoveMsg; import com.ruoyi.api.service.IToErpService; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.log.service.IRequestLogService; +import com.ruoyi.pda.mapper.PdaMapper; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; import org.springframework.web.bind.annotation.*; import com.ruoyi.api.domain.DeliveryNoticeVo; +import java.util.HashMap; + /** * 作业统计 Controller */ @@ -19,6 +25,8 @@ public class ToErpApiController { private IToErpService toErpService; @Autowired private IRequestLogService requestLogService; + @Autowired + private PdaMapper pdaMapper; /** * 接收入出库通知单 @@ -28,7 +36,7 @@ public class ToErpApiController { public AjaxResult receiveDeliveryNotice(@RequestBody DeliveryNoticeVo deliveryNoticeVo) { AjaxResult ajaxResult = toErpService.receiveDeliveryNotice(deliveryNoticeVo); - requestLogService.insertRequestLog(requestLogService.getRequestLog(deliveryNoticeVo.toString(), "接收入出库通知单", ajaxResult)); + requestLogService.insertRequestLog(requestLogService.getRequestLogERP(JSONUtil.toJsonStr(deliveryNoticeVo), "接收入出库通知单", ajaxResult)); return ajaxResult; @@ -36,22 +44,107 @@ public class ToErpApiController { /** - * 回传其他入库单 + * 回传入库单 */ -// @Scheduled(fixedDelay = 1500) + @Scheduled(fixedDelay = 1500) @RequestMapping("/callbackInDeliveryNotice") @ResponseBody - public void callbackInDeliveryNotice() { - toErpService.callbackInDeliveryNotice(); + public void callbackInDeliveryNoticeNew() { + toErpService.callbackInDeliveryNoticeNew(); + } + + + /** + * 回传出库单(新) + */ + @Scheduled(fixedDelay = 1500) + @RequestMapping("/callbackOutDeliveryNotice") + @ResponseBody + public void callbackDeliveryOutNoticeNew() { + toErpService.callbackDeliveryOutNoticeNew(); + } + + +// @Scheduled(fixedDelay = 1500) +// @RequestMapping("/callbackOutDeliveryNotice") +// @ResponseBody +// public void callbackDeliveryOutNoticeNewS() { +// toErpService.callbackDeliveryOutNoticeNews(); +// } + + + + + +// /** +// * 回传其他入库单 +// */ +// @Scheduled(fixedDelay = 1500) +// @RequestMapping("/callbackInDeliveryNotice") +// @ResponseBody +// public void callbackInDeliveryNotice() { +// toErpService.callbackInDeliveryNotice(); +// } +// +// /** +// * 回传其他出库单 +// */ +// @Scheduled(fixedDelay = 1500) +// @RequestMapping("/callbackOutDeliveryNotice") +// @ResponseBody +// public void callbackDeliveryOutNotice() { +// toErpService.callbackoutDeliveryNotice(); +// } + + /** + * 移库回调接口 + */ + @Scheduled(fixedDelay = 1500) + @RequestMapping("/moveCargoSpace") + @ResponseBody + public void moveCargoSpace() { + toErpService.moveCargoSpace(); } /** - * 回传其他出库单 + * 自动确认入库单据 */ - @RequestMapping("/callbackOutDeliveryNotice") + @Scheduled(fixedDelay = 10000) +// @RequestMapping("/FillFinishAllot") @ResponseBody - public void callbackDeliveryOutNotice() { - toErpService.callbackoutDeliveryNotice(); + public void FillFinishAllot() { + HashMap map = new HashMap<>(); + map.put("v_result", null); + map.put("v_result_msg", null); + pdaMapper.FillFinishAllot(map); + String result = map.get("v_result").toString(); + String msg = map.get("v_result_msg").toString(); + if ("10".equals(result)) { + System.err.println(msg); + } else { +// System.err.println(msg); + } + } + /** + * 自动确认出库单据 + */ + @Scheduled(fixedDelay = 10000) +// @RequestMapping("/FillFinishAllot") + @ResponseBody + public void FillFinishAllotOut() { + HashMap map = new HashMap<>(); + map.put("v_result", null); + map.put("v_result_msg", null); + pdaMapper.FillFinishAllotOut(map); + String result = map.get("v_result").toString(); + String msg = map.get("v_result_msg").toString(); + if ("10".equals(result)) { + System.err.println(msg); + } else { +// System.err.println(msg); + } } + + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/api/controller/ToWmsApiController.java b/ruoyi-admin/src/main/java/com/ruoyi/api/controller/ToWmsApiController.java index be1c869..a92c5cd 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/api/controller/ToWmsApiController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/api/controller/ToWmsApiController.java @@ -1,5 +1,6 @@ package com.ruoyi.api.controller; +import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import com.ruoyi.api.domain.ErpProduct; import com.ruoyi.api.domain.ReMaterialParam; @@ -11,6 +12,10 @@ import com.ruoyi.bas.BasProduct.service.IBasProductService; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.device.agv.domain.AgvContainerTask; +import com.ruoyi.device.agv.service.IAgvContainerTaskService; +import com.ruoyi.job.mydojob.domain.MydoJob; +import com.ruoyi.job.mydojob.mapper.MydoJobMapper; import com.ruoyi.log.domain.RequestLog; import com.ruoyi.log.service.IRequestLogService; import com.ruoyi.out.outStockout.domain.OutStockoutVo; @@ -19,7 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; -import java.util.Map; +import java.util.*; /** * 作业统计 Controller @@ -36,6 +41,10 @@ public class ToWmsApiController { private IOutStockoutService outStockoutService; @Autowired private IBasProductService basProductService; + @Autowired + private MydoJobMapper mapper; + @Autowired + private IAgvContainerTaskService agvContainerTaskService; /** * 入库请求生成作业 @@ -43,18 +52,50 @@ public class ToWmsApiController { @PostMapping("/requestEnterByTrayCode") public AjaxResult requestEnterByTrayCode(@RequestBody RequestEnter requestEnter) { AjaxResult ajaxResult = toWmsService.requestEnterByTrayCode(requestEnter); - RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(requestEnter), "入库任务创建请求",ajaxResult); + RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(requestEnter), "入库任务创建请求", ajaxResult); requestLogService.insertRequestLog(requestLog); return ajaxResult; } + // 入库分货位 + @PostMapping("/sendCargoSpace") + public AjaxResult sendCargoSpace(@RequestBody RequestEnter requestEnter) { + AjaxResult ajaxResult = toWmsService.requestEnterByTaskNo(requestEnter); + RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(requestEnter), "入库请求分配货位", ajaxResult); + requestLogService.insertRequestLog(requestLog); + return ajaxResult; + } + + + // 出库到位更新LED显示屏 + @PostMapping("/updateLed") + public AjaxResult updateLed(@RequestBody RequestEnter requestEnter) { + HashMap map = new HashMap<>(); + map.put("v_task_no", requestEnter.getTaskNo()); + map.put("v_code", requestEnter.getDeviceCode()); + mapper.updateLed(map); + return AjaxResult.success(); + } + + + // 线体报警更新报警信息 + @PostMapping("/updateLedError") + public AjaxResult updateLedError(@RequestBody RequestEnter requestEnter) { + HashMap map = new HashMap<>(); + map.put("v_code", requestEnter.getDeviceCode()); + map.put("v_error_code", requestEnter.getErrorCode()); + mapper.updateLedError(map); + return AjaxResult.success(); + } + + /** * 请求补码作业 */ @RequestMapping("/requestByNoTrayCode") public AjaxResult requestByNoTrayCode(@RequestBody RequestEnter requestEnter) { AjaxResult ajaxResult = toWmsService.selectMydoJobByEntranceId(requestEnter); - RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(requestEnter), "请求补码作业",ajaxResult); + RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(requestEnter), "请求补码作业", ajaxResult); requestLogService.insertRequestLog(requestLog); return ajaxResult; } @@ -65,7 +106,7 @@ public class ToWmsApiController { @RequestMapping("/requestEnterByTrayCodeAndEntranceId") public AjaxResult requestEnterByTrayCodeAndEntranceId(@RequestBody RequestEnter requestEnter) { AjaxResult ajaxResult = toWmsService.requestEnterByTrayCodeAndEntranceId(requestEnter); - RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(requestEnter), "获取入库作业",ajaxResult); + RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(requestEnter), "获取入库作业", ajaxResult); requestLogService.insertRequestLog(requestLog); return ajaxResult; } @@ -74,18 +115,17 @@ public class ToWmsApiController { /** * 入库、出库 任务完成回传 * Map - * "wmsType": "任务类型" 1-入库 2-出库 3-agv搬运, - * taskNo:出库 入库任务号 - * trayCode:托盘码 - * positionCode1:起点 - * positionCode2:终点 - * containerCode:容器编码 - * + * "wmsType": "任务类型" 1-入库 2-出库 3-agv搬运, + * taskNo:出库 入库任务号 + * trayCode:托盘码 + * positionCode1:起点 + * positionCode2:终点 + * containerCode:容器编码 */ @PostMapping("/jobFinish") public AjaxResult jobFinish(@RequestBody WmsJobRequest wmsJobRequest) { AjaxResult ajaxResult = toWmsService.jobFinish(wmsJobRequest); - RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(wmsJobRequest), "jobFinish",ajaxResult); + RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(wmsJobRequest), "jobFinish", ajaxResult); requestLogService.insertRequestLog(requestLog); return ajaxResult; } @@ -96,7 +136,7 @@ public class ToWmsApiController { @PostMapping("/reAssign") public AjaxResult reAssign(@RequestBody ReMaterialParam reMaterialParam) { AjaxResult ajaxResult = toWmsService.reAssign(reMaterialParam); - RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(reMaterialParam), "reAssign",ajaxResult); + RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(reMaterialParam), "reAssign", ajaxResult); requestLogService.insertRequestLog(requestLog); return ajaxResult; } @@ -107,13 +147,12 @@ public class ToWmsApiController { @PostMapping("/reMaterial") public AjaxResult reMaterial(@RequestBody ReMaterialParam reMaterialParam) { AjaxResult ajaxResult = toWmsService.reMaterial(reMaterialParam); - RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(reMaterialParam), "reMaterial",ajaxResult); + RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(reMaterialParam), "reMaterial", ajaxResult); requestLogService.insertRequestLog(requestLog); return ajaxResult; } - /** * 出库单据保存 * @@ -137,8 +176,7 @@ public class ToWmsApiController { */ @Log(title = "接收物料", businessType = BusinessType.INSERT) @PutMapping("/receiveProduct") - public AjaxResult receiveProduct(@RequestBody ErpProduct erpProduct) - { + public AjaxResult receiveProduct(@RequestBody ErpProduct erpProduct) { AjaxResult ajaxResult = toWmsService.receiveProduct(erpProduct); RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(erpProduct), "接收物料", ajaxResult); requestLogService.insertRequestLog(requestLog); @@ -150,8 +188,7 @@ public class ToWmsApiController { */ @Log(title = "修改物料管理", businessType = BusinessType.UPDATE) @PutMapping("/updateProduct") - public AjaxResult updateProduct(@RequestBody ErpProduct erpProduct) - { + public AjaxResult updateProduct(@RequestBody ErpProduct erpProduct) { AjaxResult ajaxResult = toWmsService.updateProduct(erpProduct); RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(erpProduct), "修改物料管理", ajaxResult); requestLogService.insertRequestLog(requestLog); @@ -163,12 +200,76 @@ public class ToWmsApiController { */ @Log(title = "作废物料", businessType = BusinessType.UPDATE) @PutMapping("/InvalidProduct") - public AjaxResult InvalidProduct(@RequestBody ErpProduct erpProduct) - { + public AjaxResult InvalidProduct(@RequestBody ErpProduct erpProduct) { AjaxResult ajaxResult = toWmsService.InvalidProduct(erpProduct); RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(erpProduct), "作废物料", ajaxResult); requestLogService.insertRequestLog(requestLog); return ajaxResult; } + /** + * 请求AGV执行队列 + */ +// @Log(title = "请求未下发的AGV执行队列", businessType = BusinessType.OTHER) + @RequestMapping("/queryAgvQuene") + public AjaxResult queryAgvQuene() { + AgvContainerTask agvContainerTask = new AgvContainerTask(); + agvContainerTask.setStatus("0"); + List agvContainerTasks = agvContainerTaskService.selectAgvContainerTaskList(agvContainerTask); + RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(""), "请求未下发的AGV执行队列", AjaxResult.success(agvContainerTasks)); + requestLogService.insertRequestLog(requestLog); + if (agvContainerTasks != null && agvContainerTasks.size() > 0) { + for (AgvContainerTask containerTask : agvContainerTasks) { + containerTask.setStatus("1"); + agvContainerTaskService.updateAgvContainerTask(containerTask); + } + return AjaxResult.success(agvContainerTasks.get(0)); + } else { + return AjaxResult.error("无队列"); + } + } + + + /** + * 请求AGV执行队列 + */ + @Log(title = "完成AGV执行队列", businessType = BusinessType.UPDATE) + @RequestMapping("/finishAgvQuene") + public AjaxResult finishAgvQuene(@RequestBody JSONObject jsonObject) { + String order = (String) jsonObject.get("order"); + agvContainerTaskService.deleteAgvJobByOrder(order); + return AjaxResult.success(); + + } + + + @Log(title = "自动生成Agv搬运队列到线边", businessType = BusinessType.INSERT) + @PutMapping("/insertAgvQuene") + public AjaxResult insertAgvQuene(@RequestBody WmsJobRequest wmsJobRequest) { + String taskNo = wmsJobRequest.getTaskNo();// 到位任务号 + String code = wmsJobRequest.getCode();// 线体号 + AgvContainerTask agvContainerTask = new AgvContainerTask(); + agvContainerTask.setTaskNo(taskNo); + List agvContainerTasks = agvContainerTaskService.selectAgvContainerTaskList(agvContainerTask); + if (Objects.isNull(agvContainerTasks)) { + MydoJob mydoJob = new MydoJob(); + mydoJob.setTaskNo(taskNo); + List mydoJobs = mapper.selectMydoJobList(mydoJob); + AgvContainerTask agvContainerTask1 = new AgvContainerTask(); + agvContainerTask1.setContainer(UUID.randomUUID().toString()); + agvContainerTask1.setTaskNo(taskNo); + agvContainerTask1.setStartPoint(code); + agvContainerTask1.setEndPoint(mydoJobs.get(0).getEndPoint());//TODO 需要修改 + agvContainerTask1.setSpare2(mydoJobs.get(0).getTrayCode()); + // 10缓存区到线边 11立库到线边 12 立库到缓存区 13 缓存到立库 + agvContainerTask1.setSpare1("11"); + agvContainerTask1.setStatus("0"); + agvContainerTaskService.insertAgvContainerTask(agvContainerTask1); + } + RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(wmsJobRequest), "自动生成Agv搬运队列到线边", AjaxResult.success()); + requestLogService.insertRequestLog(requestLog); + return AjaxResult.success(); + } + + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/api/controller/TwinController.java b/ruoyi-admin/src/main/java/com/ruoyi/api/controller/TwinController.java index 7cb80c5..007d71d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/api/controller/TwinController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/api/controller/TwinController.java @@ -7,6 +7,7 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.annotation.Anonymous; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -23,6 +24,7 @@ public class TwinController { @Autowired private ITwinService twinService; + //获取所有货位 @Anonymous @GetMapping("/getEmptyCargoSpace") public AjaxResult getEmptyCargoSpace() { @@ -30,10 +32,25 @@ public class TwinController { return AjaxResult.success(list); } + //获取统计信息 @Anonymous @GetMapping("/getStockList") public Map getStockList() { return twinService.getStockListOverview(); } + //根据货位号获取库存中的物料信息 + @Anonymous + @GetMapping("/getCargo/{cargoSpaceName}") + public Map getCargo(@PathVariable("cargoSpaceName") String cargoSpaceName) { + return twinService.getCargo(cargoSpaceName); + } + + //根据任务号获取作业表中的物料信息 + @Anonymous + @GetMapping("/getTaskCargo/{taskNo}") + public Map getTaskCargo(@PathVariable("taskNo") String taskNo) { + return twinService.getTaskCargo(taskNo); + } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/api/domain/DeliveryNoticeItemVo.java b/ruoyi-admin/src/main/java/com/ruoyi/api/domain/DeliveryNoticeItemVo.java index 8fd3ecd..24f52b9 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/api/domain/DeliveryNoticeItemVo.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/api/domain/DeliveryNoticeItemVo.java @@ -4,6 +4,9 @@ import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import lombok.ToString; +import org.w3c.dom.stylesheets.LinkStyle; + +import java.util.List; /** * 出入库通知单-子表接收对象 @@ -42,7 +45,38 @@ public class DeliveryNoticeItemVo { /** 备注 */ private String remark; + private List locations; + /**货位*/ private String area; - + /**托盘*/ private String location; + + private String areaBefore; + + private String locationBefore; + /** 项目号 */ + private String projectNo; + /** + * erp子表主键 + ***/ + private String sourceLineId; + /** + * 条码号 + ***/ + private String barCode; + /** + * 是否批次管理 + **/ + private String isBatchManage; + + /**旧项目号**/ + private String oldProjectNo; + /**组件号**/ + private String groupNum; + + + /**存放地点 1 立库 2平库*/ + private String stg_location; + + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/api/domain/DeliveryNoticeVo.java b/ruoyi-admin/src/main/java/com/ruoyi/api/domain/DeliveryNoticeVo.java index f11d15f..88f545e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/api/domain/DeliveryNoticeVo.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/api/domain/DeliveryNoticeVo.java @@ -49,6 +49,17 @@ public class DeliveryNoticeVo { private String warehouseId; /** 备注 */ private String remark; + /** 配送终点 */ + private String destination; + /** 领料车间 */ + private String workshop; + + + private String companyShortName; + /** 账套号**/ + private String accountSetNo; /** 子表明细列表 */ + + private List detailList; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/api/domain/RequestEnter.java b/ruoyi-admin/src/main/java/com/ruoyi/api/domain/RequestEnter.java index 044d7dd..8638acf 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/api/domain/RequestEnter.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/api/domain/RequestEnter.java @@ -20,4 +20,8 @@ public class RequestEnter { private String type; private String flag; + private String taskNo; + private String deviceCode; + private String code; + private String errorCode; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/api/domain/WmsJobRequest.java b/ruoyi-admin/src/main/java/com/ruoyi/api/domain/WmsJobRequest.java index 4b0ec5f..079124f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/api/domain/WmsJobRequest.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/api/domain/WmsJobRequest.java @@ -24,4 +24,6 @@ public class WmsJobRequest { private String positionCode2; //任务id private String jobId; + //线体号 + private String code; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/api/service/IToErpService.java b/ruoyi-admin/src/main/java/com/ruoyi/api/service/IToErpService.java index f140fc6..8519c47 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/api/service/IToErpService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/api/service/IToErpService.java @@ -1,6 +1,7 @@ package com.ruoyi.api.service; import com.ruoyi.api.domain.DeliveryNoticeVo; +import com.ruoyi.api.moveMsg.domain.MoveMsg; import com.ruoyi.bas.BasProduct.domain.BasProduct; import com.ruoyi.common.core.domain.AjaxResult; @@ -16,5 +17,13 @@ public interface IToErpService { void callbackoutDeliveryNotice(); + void moveCargoSpace(); + AjaxResult createWorkshopInboundOrder(BasProduct basProduct); + + void callbackInDeliveryNoticeNew(); + + void callbackDeliveryOutNoticeNew(); + + void callbackDeliveryOutNoticeNews(); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/api/service/IToWmsService.java b/ruoyi-admin/src/main/java/com/ruoyi/api/service/IToWmsService.java index f41f6da..06a32d8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/api/service/IToWmsService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/api/service/IToWmsService.java @@ -59,4 +59,6 @@ public interface IToWmsService { * 作废物料 */ AjaxResult InvalidProduct(ErpProduct erpProduct); + + AjaxResult requestEnterByTaskNo(RequestEnter requestEnter); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/api/service/ITwinService.java b/ruoyi-admin/src/main/java/com/ruoyi/api/service/ITwinService.java index 1a7ff85..ae430e2 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/api/service/ITwinService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/api/service/ITwinService.java @@ -4,5 +4,7 @@ import java.util.Map; public interface ITwinService { Map getStockListOverview(); + Map getCargo(String cargoSpaceName); + Map getTaskCargo(String taskNo); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/api/service/impl/ToErpServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/api/service/impl/ToErpServiceImpl.java index 0841b34..01d44e7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/api/service/impl/ToErpServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/api/service/impl/ToErpServiceImpl.java @@ -1,8 +1,13 @@ package com.ruoyi.api.service.impl; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; +import com.ruoyi.api.controller.BatchNoGenerator; import com.ruoyi.api.domain.*; +import com.ruoyi.api.moveMsg.domain.MoveMsg; +import com.ruoyi.api.moveMsg.service.IMoveMsgService; import com.ruoyi.api.service.IToErpService; import com.ruoyi.bas.BasProduct.domain.BasProduct; import com.ruoyi.bas.basJobId.service.IBasJobIdService; @@ -27,10 +32,17 @@ import com.ruoyi.log.domain.RequestLog; import com.ruoyi.log.service.IRequestLogService; import com.ruoyi.out.outStockout.domain.OutStockout; import com.ruoyi.out.outStockout.service.IOutStockoutService; +import com.ruoyi.out.outStockoutBack.domain.OutStockoutBack; +import com.ruoyi.out.outStockoutBack.mapper.OutStockoutBackMapper; +import com.ruoyi.out.outStockoutBack.service.IOutStockoutBackService; import com.ruoyi.out.outStockoutDetail.domain.OutStockoutDetail; import com.ruoyi.out.outStockoutDetail.service.IOutStockoutDetailService; import com.ruoyi.out.outStockoutDetail.mapper.OutStockoutDetailMapper; import com.ruoyi.out.outStockout.mapper.OutStockoutMapper; +import com.ruoyi.out.outStockoutDetailBack.domain.OutStockoutDetailBack; +import com.ruoyi.out.outStockoutDetailBack.service.IOutStockoutDetailBackService; +import com.ruoyi.stock.stock.domain.BasStock; +import com.ruoyi.stock.stock.service.IBasStockService; import io.swagger.v3.oas.models.security.SecurityScheme; import org.apache.pdfbox.pdmodel.interactive.viewerpreferences.PDViewerPreferences; import org.springframework.beans.BeanUtils; @@ -38,10 +50,15 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.math.BigDecimal; +import java.util.Map; +import java.util.stream.Collectors; + +import static com.ruoyi.framework.datasource.DynamicDataSourceContextHolder.log; /** * 作业统计 Service 实现 @@ -55,9 +72,10 @@ public class ToErpServiceImpl implements IToErpService { private IMydoJobService mydoJobService; @Autowired private IMydoJobDetailService mydoJobDetailService; - @Autowired - private IBasJobIdService basJobIdService; + private IBasJobIdService iBasJobIdService; + @Autowired + private IBasJobIdService basJobIdService; @Autowired private IRequestLogService requestLogService; @@ -79,13 +97,24 @@ public class ToErpServiceImpl implements IToErpService { private IInStockinBackService inStockinBackService; @Autowired private IInStockinDetailBackService inStockinDetailBackService; + @Autowired + private IMoveMsgService moveMsgService; + + @Autowired + private IBasStockService basStockService; + @Autowired + private IOutStockoutBackService outStockoutBackService; + + @Autowired + private IOutStockoutDetailBackService outStockoutDetailBackService; private static final String TO_ERP_URL = "http://192.168.1.100:8080/api/"; //todo 需要调试 - private static final String WORKSHOP_INBOUND_ORDER_URL = TO_ERP_URL+"TRANSACTION_DOC"; + private static final String WORKSHOP_INBOUND_ORDER_URL = TO_ERP_URL + "TRANSACTION_DOC"; //todo 需要调试 - private static final String OTHER_IN_OUTBOUND_ORDER_URL = TO_ERP_URL+"WIP_TRANSFER_DOC"; + private static final String OTHER_IN_OUTBOUND_ORDER_URL = TO_ERP_URL + "WIP_TRANSFER_DOC"; + /** * 处理送货通知单的业务逻辑 * 根据单据类型和操作类型进行入库单或出库单的增删改操作 @@ -93,24 +122,269 @@ public class ToErpServiceImpl implements IToErpService { * @param deliveryNoticeVo 送货通知单数据对象,包含单据基本信息和明细列表 * @return AjaxResult 操作结果,包含成功或错误信息 */ +// @Override +// @Transactional(rollbackFor = Exception.class) +// public AjaxResult receiveDeliveryNotice(DeliveryNoticeVo deliveryNoticeVo) { +// +// if (deliveryNoticeVo == null || deliveryNoticeVo.getDetailList() == null || deliveryNoticeVo.getDetailList().isEmpty()) { +// return AjaxResult.error("单据或明细不能为空"); +// } +// String billType = deliveryNoticeVo.getBillType(); +// String opType = deliveryNoticeVo.getOpType(); +//// String status = deliveryNoticeVo.getStatus(); +// int type = 0; +// try { +// type = Integer.parseInt(billType); +// } catch (Exception ignored) { +// } +// +// // 处理入库单相关操作(单据类型1-4) +// if (type >= 1 && type <= 4) { +// InStockin param = new InStockin(); +// param.setErpBill(deliveryNoticeVo.getBillNo()); +// List existList = inStockinService.selectInStockinListApi(param); +// InStockin exist = (existList != null && !existList.isEmpty()) ? existList.get(0) : null; +// +// // 删除操作(操作类型3) +// if ("3".equals(opType)) { +// if (exist == null) { +// return AjaxResult.error("单据不存在"); +// } +// if ("3".equals(exist.getStatus())) { +// return AjaxResult.error("单据已执行,禁止删除"); +// } +// if (exist.getStockinGuid() != null) { +// inStockinDetailService.deleteInStockinDetailByStockinGuid(exist.getStockinGuid()); +// inStockinService.deleteInStockinByStockinGuid(exist.getStockinGuid()); +// } +// +// return AjaxResult.success(); +// } +// +// // 新增或修改操作(操作类型1或2) +// if ("2".equals(opType) || "1".equals(opType)) { +// if ("2".equals(opType) && exist == null) { +// return AjaxResult.error("单据不存在,无法修改"); +// } +// if ("1".equals(opType) && exist != null) { +// return AjaxResult.error("单据已存在,请勿重复添加"); +// } +// if (exist != null && "3".equals(exist.getStatus()) && "2".equals(opType)) { +// return AjaxResult.error("单据已执行,禁止修改"); +// } +// InStockin inStockin = exist != null ? exist : new InStockin(); +// if (exist == null) { +// inStockin.setStockinGuid(UUID.randomUUID().toString()); +// } +// String rkdId = iBasJobIdService.getJobId("RKD"); +// +// inStockin.setStockinId(rkdId); +// inStockin.setInType(deliveryNoticeVo.getBillType()); +// inStockin.setCreateDate(deliveryNoticeVo.getBillDate()); +// inStockin.setCreateManId(deliveryNoticeVo.getCreateMan()); +// inStockin.setStatus("2"); +// inStockin.setWarehouseId(deliveryNoticeVo.getWarehouseId()); +// inStockin.setErpBill(deliveryNoticeVo.getBillNo()); +// inStockin.setStockSource("1"); +// inStockin.setDepartmentNo(deliveryNoticeVo.getProjectNo());//项目号 +// inStockin.setSupplierNo(deliveryNoticeVo.getCustomerId());//供应商编码 +// inStockin.setClassNo(deliveryNoticeVo.getCustomerName());//供应商名称 +// inStockin.setSpare1(deliveryNoticeVo.getContractNo());//合同号 +// inStockin.setSpare2(deliveryNoticeVo.getSalesOrderNo());//销售订单号 +// inStockin.setSpare3(deliveryNoticeVo.getApproveDate());//审核时间 +// inStockin.setSpare4(deliveryNoticeVo.getApproveMan());//审核人 +// inStockin.setSpare5(deliveryNoticeVo.getRemark()); +// inStockin.setCompanyShortName(deliveryNoticeVo.getCompanyShortName()); +// inStockin.setAccountSetNo(deliveryNoticeVo.getAccountSetNo()); +// if (exist == null) { +// inStockinService.insertInStockin(inStockin); +// } else { +// inStockinService.updateInStockin(inStockin); +// inStockinDetailService.deleteInStockinDetailByStockinGuid(inStockin.getStockinGuid()); +// } +// List items = deliveryNoticeVo.getDetailList(); +// +// int a = 0; +// for (DeliveryNoticeItemVo item : items) { +// a += 1; +// InStockinDetail detail = new InStockinDetail(); +// detail.setStockinGuid(inStockin.getStockinGuid()); +// detail.setStockinDetailId(item.getBarCode()); +// detail.setStockinId(inStockin.getStockinId()); +// detail.setProductId(item.getInventoryCode()); +// detail.setProductName(item.getInventoryName()); +// detail.setSpec(item.getSpecModel()); +// detail.setUnit(item.getUnit()); +// detail.setQuantity(item.getQuantity()); +// if (item.getIsBatchManage().equals("1") && (item.getLotNo().equals("") || item.getLotNo() == null)) { +// // 获取流水号 +// detail.setLotNo(BatchNoGenerator.generateBatchNo()); +// } else { +// detail.setLotNo(item.getLotNo()); +// } +// detail.setSpare1(item.getLevelRelation()); +// detail.setSpare2(item.getUpperMaterial()); +// detail.setSpare3(item.getTopMaterial()); +// detail.setSpare4(item.getProjectNo()); +// detail.setSpare6(item.getLineNo()); +// detail.setRemark(item.getRemark()); +// detail.setAssignNum("0"); +// detail.setScanNum("0"); +// detail.setSourceLineId(item.getSourceLineId()); +// detail.setBarCode(item.getBarCode()); +// detail.setIsBatchManage(item.getIsBatchManage()); +// detail.setOldProjectNo(item.getOldProjectNo()); +// detail.setCargoNo(item.getGroupNum()); +// inStockinDetailService.insertInStockinDetail(detail); +// +// } +// +// return AjaxResult.success(); +// } +// } +// // 处理出库单相关操作(单据类型5-7) +// else if (type >= 5 && type <= 7) { +// OutStockout param = new OutStockout(); +// param.setErpStockoutId(deliveryNoticeVo.getBillNo()); +// List outList = outStockoutService.selectOutStockoutList(param); +// OutStockout exist = (outList != null && !outList.isEmpty()) ? outList.get(0) : null; +// +// // 删除操作(操作类型3) +// if ("3".equals(opType)) { +// if (exist == null) { +// return AjaxResult.error("单据不存在"); +// } +// if ("3".equals(exist.getStatus())) { +// return AjaxResult.error("单据已执行,禁止删除"); +// } +// OutStockoutDetail outStockoutDetail = new OutStockoutDetail(); +// outStockoutDetail.setStockoutId(deliveryNoticeVo.getBillNo()); +// List details = outStockoutDetailService.selectOutStockoutDetailList(outStockoutDetail); +// if (details != null && !details.isEmpty()) { +// String[] ids = details.stream().map(OutStockoutDetail::getStockoutDetailId).toArray(String[]::new); +// outStockoutDetailService.deleteOutStockoutDetailByStockoutDetailIds(ids); +// } +// outStockoutService.deleteOutStockoutByStockoutGuid(exist.getStockoutGuid()); +// return AjaxResult.success(); +// } +// +// // 新增或修改操作(操作类型1或2) +// if ("2".equals(opType) || "1".equals(opType)) { +// if ("2".equals(opType) && exist == null) { +// return AjaxResult.error("单据不存在,无法修改"); +// } +// if ("1".equals(opType) && exist != null) { +// return AjaxResult.error("单据已存在,请勿重复添加"); +// } +// if (exist != null && "3".equals(exist.getStatus()) && "2".equals(opType)) { +// return AjaxResult.error("单据已执行,禁止修改"); +// } +// OutStockout out = exist != null ? exist : new OutStockout(); +// +// if (exist == null) { +// out.setStockoutGuid(UUID.randomUUID().toString()); +// } +// String ckdId = iBasJobIdService.getJobId("CKD"); +// out.setStockoutId(ckdId); +// out.setOutType(deliveryNoticeVo.getBillType()); +// out.setCreateDate(deliveryNoticeVo.getBillDate()); +// out.setErpStockoutId(deliveryNoticeVo.getBillNo()); +// out.setCreateManId(deliveryNoticeVo.getCreateMan()); +// out.setStatus("2"); +// out.setWarehouseId(deliveryNoticeVo.getWarehouseId()); +// out.setStockoutSource("1"); +//// out.setSpare6(deliveryNoticeVo.getOutType()); +// out.setSpare6("1"); +// out.setCarNumber(deliveryNoticeVo.getIsProjectOut()); +// out.setDepartmentNo(deliveryNoticeVo.getProjectNo()); +// out.setCustomerNo(deliveryNoticeVo.getCustomerId()); +// out.setClassNowId(deliveryNoticeVo.getCustomerName()); +// out.setSpare1(deliveryNoticeVo.getContractNo());//合同号 +// out.setSpare2(deliveryNoticeVo.getSalesOrderNo());//销售订单号 +// out.setSpare3(deliveryNoticeVo.getApproveDate());//审核时间 +// out.setSpare4(deliveryNoticeVo.getApproveMan());//审核人 +// out.setSpare5(deliveryNoticeVo.getRemark()); +// out.setSpare7(deliveryNoticeVo.getDestination()); +// //手动设置出库类型为2 这样会赋值 in_or_out 21 +// out.setSpare8("2"); +// out.setCompanyShortName(deliveryNoticeVo.getCompanyShortName()); +// out.setAccountSetNo(deliveryNoticeVo.getAccountSetNo()); +// +// if (exist == null) { +// outStockoutService.insertOutStockout(out); +// } else { +// outStockoutService.updateOutStockout(out); +// OutStockoutDetail q2 = new OutStockoutDetail(); +// q2.setStockoutId(deliveryNoticeVo.getBillNo()); +// List oldDetails = outStockoutDetailService.selectOutStockoutDetailList(q2); +// if (oldDetails != null && !oldDetails.isEmpty()) { +// String[] ids = oldDetails.stream().map(OutStockoutDetail::getStockoutDetailId).toArray(String[]::new); +// outStockoutDetailService.deleteOutStockoutDetailByStockoutDetailIds(ids); +// } +// } +// int i = 0; +// for (DeliveryNoticeItemVo item : deliveryNoticeVo.getDetailList()) { +// OutStockoutDetail d = new OutStockoutDetail(); +// i += 1; +// d.setStockoutDetailId(out.getStockoutId() + "-" + i); +// d.setStockoutGuid(out.getStockoutGuid()); +// d.setStockoutId(out.getStockoutId()); +// d.setProductId(item.getInventoryCode()); +// d.setProductName(item.getInventoryName()); +// d.setLotNo(item.getLotNo()); +// d.setSpec(item.getSpecModel()); +// d.setUnit(item.getUnit()); +// d.setSpare1(item.getLevelRelation()); +// d.setSpare2(item.getUpperMaterial()); +// d.setSpare3(item.getTopMaterial()); +// d.setSpare4(item.getProjectNo()); +// d.setSpare6(item.getLineNo()); +// d.setRemark(item.getRemark()); +// d.setSourceLineId(item.getSourceLineId()); +// d.setCargoNo(item.getGroupNum()); +// d.setBarCode(item.getBarCode()); +// d.setIsBatchManage(item.getIsBatchManage()); +// d.setOldProjectNo(item.getOldProjectNo()); +// //d.setSpare8(deliveryNoticeVo.getDestination()); +// +// +// try { +// d.setQuantity(new BigDecimal(item.getQuantity())); +// d.setAllotQuantity(BigDecimal.ZERO); +// d.setAssignNum(BigDecimal.ZERO); +// } catch (Exception e) { +// d.setQuantity(BigDecimal.ZERO); +// } +// outStockoutDetailService.insertOutStockoutDetail(d); +// +// } +// return AjaxResult.success(); +// } +// } +// return AjaxResult.error("不支持的单据类型或操作类型"); +// +// } @Override @Transactional(rollbackFor = Exception.class) public AjaxResult receiveDeliveryNotice(DeliveryNoticeVo deliveryNoticeVo) { - - if (deliveryNoticeVo == null || deliveryNoticeVo.getDetailList() == null || deliveryNoticeVo.getDetailList().isEmpty()){ + if (deliveryNoticeVo == null || deliveryNoticeVo.getDetailList() == null || deliveryNoticeVo.getDetailList().isEmpty()) { return AjaxResult.error("单据或明细不能为空"); } String billType = deliveryNoticeVo.getBillType(); String opType = deliveryNoticeVo.getOpType(); -// String status = deliveryNoticeVo.getStatus(); int type = 0; - try { type = Integer.parseInt(billType); } catch (Exception ignored) {} + try { + type = Integer.parseInt(billType); + } catch (Exception ignored) { + } - // 处理入库单相关操作(单据类型1-4) + // ===================== 入库单 1-4 逻辑完全不变 ===================== if (type >= 1 && type <= 4) { InStockin param = new InStockin(); - param.setStockinId(deliveryNoticeVo.getBillNo()); - List existList = inStockinService.selectInStockinListApi(param); + param.setErpBill(deliveryNoticeVo.getBillNo()); + param.setAccountSetNo(deliveryNoticeVo.getAccountSetNo()); + List existList = inStockinService.selectInStockinListBill(param); +// List existList = inStockinService.selectInStockinListApi(param); InStockin exist = (existList != null && !existList.isEmpty()) ? existList.get(0) : null; // 删除操作(操作类型3) @@ -125,7 +399,6 @@ public class ToErpServiceImpl implements IToErpService { inStockinDetailService.deleteInStockinDetailByStockinGuid(exist.getStockinGuid()); inStockinService.deleteInStockinByStockinGuid(exist.getStockinGuid()); } - return AjaxResult.success(); } @@ -134,7 +407,7 @@ public class ToErpServiceImpl implements IToErpService { if ("2".equals(opType) && exist == null) { return AjaxResult.error("单据不存在,无法修改"); } - if("1".equals(opType) && exist != null){ + if ("1".equals(opType) && exist != null) { return AjaxResult.error("单据已存在,请勿重复添加"); } if (exist != null && "3".equals(exist.getStatus()) && "2".equals(opType)) { @@ -144,22 +417,27 @@ public class ToErpServiceImpl implements IToErpService { if (exist == null) { inStockin.setStockinGuid(UUID.randomUUID().toString()); } - inStockin.setStockinId(deliveryNoticeVo.getBillNo()); + String rkdId = iBasJobIdService.getJobId("RKD"); + + inStockin.setStockinId(rkdId); inStockin.setInType(deliveryNoticeVo.getBillType()); inStockin.setCreateDate(deliveryNoticeVo.getBillDate()); inStockin.setCreateManId(deliveryNoticeVo.getCreateMan()); - inStockin.setStatus("1"); + inStockin.setStatus("2"); inStockin.setWarehouseId(deliveryNoticeVo.getWarehouseId()); -// inStockin.setErpBill(deliveryNoticeVo.getBillNo()); + inStockin.setErpBill(deliveryNoticeVo.getBillNo()); inStockin.setStockSource("1"); - inStockin.setDepartmentNo(deliveryNoticeVo.getProjectNo());//项目号 - inStockin.setSupplierNo(deliveryNoticeVo.getCustomerId());//供应商编码 - inStockin.setClassNo(deliveryNoticeVo.getCustomerName());//供应商名称 - inStockin.setSpare1(deliveryNoticeVo.getContractNo());//合同号 - inStockin.setSpare2(deliveryNoticeVo.getSalesOrderNo());//销售订单号 - inStockin.setSpare3(deliveryNoticeVo.getApproveDate());//审核时间 - inStockin.setSpare4(deliveryNoticeVo.getApproveMan());//审核人 + inStockin.setDepartmentNo(deliveryNoticeVo.getProjectNo()); + inStockin.setSupplierNo(deliveryNoticeVo.getCustomerId()); + inStockin.setClassNo(deliveryNoticeVo.getCustomerName()); + inStockin.setSpare1(deliveryNoticeVo.getContractNo()); + inStockin.setSpare2(deliveryNoticeVo.getSalesOrderNo()); + inStockin.setSpare3(deliveryNoticeVo.getApproveDate()); + inStockin.setSpare4(deliveryNoticeVo.getApproveMan()); inStockin.setSpare5(deliveryNoticeVo.getRemark()); + inStockin.setCompanyShortName(deliveryNoticeVo.getCompanyShortName()); + inStockin.setAccountSetNo(deliveryNoticeVo.getAccountSetNo()); + if (exist == null) { inStockinService.insertInStockin(inStockin); } else { @@ -167,41 +445,52 @@ public class ToErpServiceImpl implements IToErpService { inStockinDetailService.deleteInStockinDetailByStockinGuid(inStockin.getStockinGuid()); } List items = deliveryNoticeVo.getDetailList(); - - + int a = 0; for (DeliveryNoticeItemVo item : items) { + a += 1; InStockinDetail detail = new InStockinDetail(); detail.setStockinGuid(inStockin.getStockinGuid()); - detail.setStockinDetailId(inStockin.getStockinId()+"-"+item.getLineNo()); + detail.setStockinDetailId(inStockin.getStockinId() + '-' + a); detail.setStockinId(inStockin.getStockinId()); detail.setProductId(item.getInventoryCode()); detail.setProductName(item.getInventoryName()); detail.setSpec(item.getSpecModel()); detail.setUnit(item.getUnit()); detail.setQuantity(item.getQuantity()); - detail.setLotNo(item.getLotNo()); + if (item.getIsBatchManage().equals("1") && (item.getLotNo().equals("") || item.getLotNo() == null)) { + detail.setLotNo(BatchNoGenerator.generateBatchNo()); + } else { + detail.setLotNo(item.getLotNo()); + } detail.setSpare1(item.getLevelRelation()); detail.setSpare2(item.getUpperMaterial()); detail.setSpare3(item.getTopMaterial()); + detail.setSpare4(item.getProjectNo()); detail.setSpare6(item.getLineNo()); detail.setRemark(item.getRemark()); detail.setAssignNum("0"); detail.setScanNum("0"); + detail.setSourceLineId(item.getSourceLineId()); + detail.setBarCode(item.getBarCode()); + detail.setIsBatchManage(item.getIsBatchManage()); + detail.setOldProjectNo(item.getOldProjectNo()); + detail.setCargoNo(item.getGroupNum()); inStockinDetailService.insertInStockinDetail(detail); - } - return AjaxResult.success(); } } - // 处理出库单相关操作(单据类型5-7) + + // ===================== 出库单 5-7 改造:按立库/平库分两组各1主单多明细 ===================== else if (type >= 5 && type <= 7) { OutStockout param = new OutStockout(); - param.setStockoutId(deliveryNoticeVo.getBillNo()); + param.setErpStockoutId(deliveryNoticeVo.getBillNo()); + param.setAccountSetNo(deliveryNoticeVo.getAccountSetNo()); List outList = outStockoutService.selectOutStockoutList(param); OutStockout exist = (outList != null && !outList.isEmpty()) ? outList.get(0) : null; + String billNo = deliveryNoticeVo.getBillNo(); - // 删除操作(操作类型3) + // 删除操作 不变 if ("3".equals(opType)) { if (exist == null) { return AjaxResult.error("单据不存在"); @@ -210,7 +499,7 @@ public class ToErpServiceImpl implements IToErpService { return AjaxResult.error("单据已执行,禁止删除"); } OutStockoutDetail outStockoutDetail = new OutStockoutDetail(); - outStockoutDetail.setStockoutId(deliveryNoticeVo.getBillNo()); + outStockoutDetail.setStockoutId(billNo); List details = outStockoutDetailService.selectOutStockoutDetailList(outStockoutDetail); if (details != null && !details.isEmpty()) { String[] ids = details.stream().map(OutStockoutDetail::getStockoutDetailId).toArray(String[]::new); @@ -220,114 +509,195 @@ public class ToErpServiceImpl implements IToErpService { return AjaxResult.success(); } - // 新增或修改操作(操作类型1或2) + // 新增/修改 if ("2".equals(opType) || "1".equals(opType)) { if ("2".equals(opType) && exist == null) { return AjaxResult.error("单据不存在,无法修改"); } - if ("1".equals(opType) && exist != null){ + if ("1".equals(opType) && exist != null) { return AjaxResult.error("单据已存在,请勿重复添加"); } - if (exist != null && "3".equals(exist.getStatus()) && "2".equals(opType) ) { + if (exist != null && "3".equals(exist.getStatus()) && "2".equals(opType)) { return AjaxResult.error("单据已执行,禁止修改"); } - OutStockout out = exist != null ? exist : new OutStockout(); - if (exist == null) { - out.setStockoutGuid(UUID.randomUUID().toString()); + List allDetail = deliveryNoticeVo.getDetailList(); + // 1. 按 stg_location 分组 + List liKuList = new ArrayList<>(); + List pingKuList = new ArrayList<>(); + for (DeliveryNoticeItemVo item : allDetail) { + String loc = item.getStg_location(); + if ("2".equals(loc)) { + pingKuList.add(item); + } else { + // 1 或空 都归立库 + liKuList.add(item); + } } - out.setStockoutId(deliveryNoticeVo.getBillNo()); - out.setOutType(deliveryNoticeVo.getBillType()); - out.setCreateDate(deliveryNoticeVo.getBillDate()); - out.setCreateManId(deliveryNoticeVo.getCreateMan()); - out.setStatus("1"); - out.setWarehouseId(deliveryNoticeVo.getWarehouseId()); - out.setStockoutSource("1"); - out.setDepartmentNo(deliveryNoticeVo.getProjectNo()); - out.setCustomerNo(deliveryNoticeVo.getCustomerId()); - out.setClassNowId(deliveryNoticeVo.getCustomerName()); - out.setSpare1(deliveryNoticeVo.getContractNo());//合同号 - out.setSpare2(deliveryNoticeVo.getSalesOrderNo());//销售订单号 - out.setSpare3(deliveryNoticeVo.getApproveDate());//审核时间 - out.setSpare4(deliveryNoticeVo.getApproveMan());//审核人 - out.setSpare5(deliveryNoticeVo.getRemark()); + + // ========== 处理立库:原有主单 + 所有立库明细 ========== + OutStockout mainOut = exist != null ? exist : new OutStockout(); + if (exist == null) { + mainOut.setStockoutGuid(UUID.randomUUID().toString()); + } + if (liKuList.size() > 0) { + String ckdId = iBasJobIdService.getJobId("CKD"); + fillOutStockout(mainOut, deliveryNoticeVo, ckdId); + } + if (exist == null) { - outStockoutService.insertOutStockout(out); + String ckdId = iBasJobIdService.getJobId("CKD"); + fillOutStockout(mainOut, deliveryNoticeVo, ckdId); + outStockoutService.insertOutStockout(mainOut); } else { - outStockoutService.updateOutStockout(out); + outStockoutService.updateOutStockouts(mainOut); + // 修改先删旧明细 OutStockoutDetail q2 = new OutStockoutDetail(); - q2.setStockoutId(deliveryNoticeVo.getBillNo()); + q2.setStockoutId(billNo); List oldDetails = outStockoutDetailService.selectOutStockoutDetailList(q2); if (oldDetails != null && !oldDetails.isEmpty()) { - String[] ids = oldDetails.stream().map(OutStockoutDetail::getStockoutDetailId).toArray(String[]::new); + String[] ids = oldDetails.stream() + .map(OutStockoutDetail::getStockoutDetailId) + .toArray(String[]::new); outStockoutDetailService.deleteOutStockoutDetailByStockoutDetailIds(ids); } } + if (liKuList.size() > 0) { + // 保存所有立库明细到主单 + saveOutDetailList(mainOut, liKuList, "1"); + } - for (DeliveryNoticeItemVo item : deliveryNoticeVo.getDetailList()) { - OutStockoutDetail d = new OutStockoutDetail(); - d.setStockoutDetailId(out.getStockoutId()+"-"+item.getLineNo()); - d.setStockoutGuid(out.getStockoutGuid()); - d.setStockoutId(out.getStockoutId()); - d.setProductId(item.getInventoryCode()); - d.setProductId(item.getInventoryCode()); - d.setLotNo(item.getLotNo()); - d.setSpec(item.getSpecModel()); - d.setUnit(item.getUnit()); - d.setSpare1(item.getLevelRelation()); - d.setSpare2(item.getUpperMaterial()); - d.setSpare3(item.getTopMaterial()); - d.setSpare6(item.getLineNo()); - d.setRemark(item.getRemark()); - - try { - d.setQuantity(new BigDecimal(item.getQuantity())); - d.setAllotQuantity(BigDecimal.ZERO); - d.setAssignNum(BigDecimal.ZERO); - } catch (Exception e) { - d.setQuantity(BigDecimal.ZERO); + // ========== 处理平库:新建一张独立主单 + 所有平库明细 ========== + if (CollUtil.isNotEmpty(pingKuList)) { + OutStockout pingKuOut = new OutStockout(); + pingKuOut.setStockoutGuid(UUID.randomUUID().toString()); + if (pingKuList.size() > 0) { + String pingCkdId = iBasJobIdService.getJobId("CKD"); + fillOutStockout(pingKuOut, deliveryNoticeVo, pingCkdId); + // 插入平库主单 + outStockoutService.insertOutStockout(pingKuOut); + log.info("平库分组生成独立出库单:{},明细条数:{}", pingCkdId, pingKuList.size()); + // 平库所有明细挂到这个新主单 + saveOutDetailList(pingKuOut, pingKuList, "2"); } - outStockoutDetailService.insertOutStockoutDetail(d); + } return AjaxResult.success(); } } return AjaxResult.error("不支持的单据类型或操作类型"); - } + /** + * 填充出库单主表公共字段 + */ + private void fillOutStockout(OutStockout out, DeliveryNoticeVo vo, String ckdId) { + out.setStockoutId(ckdId); + out.setOutType(vo.getBillType()); + out.setCreateDate(vo.getBillDate()); + out.setErpStockoutId(vo.getBillNo()); + out.setCreateManId(vo.getCreateMan()); + out.setStatus("2"); + out.setWarehouseId(vo.getWarehouseId()); + out.setStockoutSource("1"); + out.setSpare6(vo.getOutType()); // 搬运方式 1人工 2agv + out.setCarNumber(vo.getIsProjectOut()); + out.setDepartmentNo(vo.getProjectNo()); + out.setCustomerNo(vo.getCustomerId()); + out.setClassNowId(vo.getCustomerName()); + out.setSpare1(vo.getContractNo()); + out.setSpare2(vo.getSalesOrderNo()); + out.setSpare3(vo.getApproveDate()); + out.setSpare4(vo.getApproveMan()); + out.setSpare5(vo.getRemark()); + out.setSpare7(vo.getDestination()); // 配送终点 + out.setSpare8("2"); // 配送去向 1 缓存 2 线边 默认线边 + out.setCompanyShortName(vo.getCompanyShortName()); + out.setAccountSetNo(vo.getAccountSetNo()); + out.setFID(vo.getIsProjectOut()); // 是否按项目出 1是 0否 + } + + /** + * 批量保存出库明细列表 + */ + private void saveOutDetailList(OutStockout out, List detailList, String warehouseId) { + if (CollUtil.isEmpty(detailList)) { + return; + } + int i = 0; + for (DeliveryNoticeItemVo item : detailList) { + i++; + OutStockoutDetail d = new OutStockoutDetail(); + d.setStockoutDetailId(out.getStockoutId() + "-" + i); + d.setStockoutGuid(out.getStockoutGuid()); + d.setStockoutId(out.getStockoutId()); + d.setProductId(item.getInventoryCode()); + d.setProductName(item.getInventoryName()); + d.setLotNo(item.getLotNo()); + d.setSpec(item.getSpecModel()); + d.setUnit(item.getUnit()); + d.setSpare1(item.getLevelRelation()); + d.setSpare2(item.getUpperMaterial()); + d.setSpare3(item.getTopMaterial()); + d.setSpare4(item.getProjectNo()); + d.setSpare6(item.getLineNo()); + d.setRemark(item.getRemark()); + d.setSourceLineId(item.getSourceLineId()); + d.setBarCode(item.getBarCode()); + d.setIsBatchManage(item.getIsBatchManage()); + d.setOldProjectNo(item.getOldProjectNo()); + d.setProductGuid(item.getStg_location()); + d.setEntryid(item.getGroupNum()); + try { + d.setQuantity(new BigDecimal(item.getQuantity())); + d.setAllotQuantity(BigDecimal.ZERO); + d.setAssignNum(BigDecimal.ZERO); + } catch (Exception e) { + d.setQuantity(BigDecimal.ZERO); + } + outStockoutDetailService.insertOutStockoutDetail(d); + } + out.setWarehouseId(warehouseId); + outStockoutService.updateOutStockout(out); + } + @Override public void callbackInDeliveryNotice() { InStockinBack inStockin = inStockinBackService.selectTopInStockin(); + if (inStockin == null) { + return; + } DeliveryNoticeVo deliveryNoticeVo = new DeliveryNoticeVo(); deliveryNoticeVo.setBillNo(inStockin.getStockinId()); deliveryNoticeVo.setNoteBillNo(inStockin.getStockinId()); deliveryNoticeVo.setBillType(inStockin.getInType()); + deliveryNoticeVo.setOpType("1"); deliveryNoticeVo.setBillDate(inStockin.getCreateDate()); - deliveryNoticeVo.setCreateMan(inStockin.getCreateManId()); +// deliveryNoticeVo.setCreateMan(inStockin.getCreateManId()); deliveryNoticeVo.setWarehouseId(inStockin.getWarehouseId()); deliveryNoticeVo.setProjectNo(inStockin.getDepartmentNo()); deliveryNoticeVo.setCustomerId(inStockin.getSupplierNo()); deliveryNoticeVo.setCustomerName(inStockin.getClassNo()); // 对应receiveDeliveryNotice中的映射 deliveryNoticeVo.setContractNo(inStockin.getSpare1()); - deliveryNoticeVo.setSalesOrderNo(inStockin.getSpare2()); - deliveryNoticeVo.setApproveDate(inStockin.getSpare3()); - deliveryNoticeVo.setApproveMan(inStockin.getSpare4()); - deliveryNoticeVo.setRemark(inStockin.getSpare5()); +// deliveryNoticeVo.setSalesOrderNo(inStockin.getSpare2()); +// deliveryNoticeVo.setApproveDate(inStockin.getSpare3()); +// deliveryNoticeVo.setApproveMan(inStockin.getSpare4()); +// deliveryNoticeVo.setRemark(inStockin.getSpare5()); InStockinDetailBack inStockinDetailParam = new InStockinDetailBack(); inStockinDetailParam.setStockinId(inStockin.getStockinId()); List inStockinDetails = inStockinDetailBackService.selectInStockinDetailBackList(inStockinDetailParam); - + List detailList = new ArrayList<>(); if (inStockinDetails != null && !inStockinDetails.isEmpty()) { for (InStockinDetailBack detail : inStockinDetails) { DeliveryNoticeItemVo item = new DeliveryNoticeItemVo(); + item.setLineNo(detail.getStockinDetailId()); item.setNotelineNo(detail.getStockinDetailId()); item.setBillNo(detail.getStockinId()); @@ -336,29 +706,240 @@ public class ToErpServiceImpl implements IToErpService { item.setSpecModel(detail.getSpec()); item.setUnit(detail.getUnit()); item.setQuantity(detail.getAssignNum()); - item.setLotNo(detail.getLotNo()); +// item.setLotNo(detail.getLotNo()); item.setLevelRelation(detail.getSpare1()); item.setUpperMaterial(detail.getSpare2()); item.setTopMaterial(detail.getSpare3()); item.setRemark(detail.getRemark()); - item.setArea(detail.getSpare9()); - item.setLocation(detail.getSpare8()); + String[] splitArea = detail.getSpare9().split(","); + String[] splitLocation = detail.getSpare8().split(","); + String[] splitQuantity = detail.getQuantityX().split(","); + ArrayList locationDetails = new ArrayList<>(); + for (int i = 0; i < splitArea.length; i++) { + LocationDetail locationDetail = new LocationDetail(); + locationDetail.setLocationNo(splitLocation[i]); + locationDetail.setQuantity(splitQuantity[i]); + locationDetail.setAreaNo(splitArea[i]); + locationDetail.setLotNo(detail.getLotNo()); + locationDetails.add(locationDetail); + } + item.setLocations(locationDetails); + detailList.add(item); } } deliveryNoticeVo.setDetailList(detailList); - //todo 发送给erp 成功失败改状态 + String sendMsg = JSONUtil.toJsonStr(deliveryNoticeVo); + try { + //todo 发送给erp 成功失败改状态 + RequestLog requestLog = requestLogService.getRequestLog("http://192.168.188.235/app1/api?type=1&key=1", JSONUtil.toJsonStr(deliveryNoticeVo), "入库回传", "wms", "erp"); + if ("1".equals(requestLog.getIsSuccessful())) { + inStockin.setSendStatus("1"); + inStockin.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + inStockin.setMsg("成功"); + inStockinDetailParam.setSendStatus("1"); + inStockinDetailParam.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + inStockinDetailParam.setMsg("成功"); + + } else { + inStockin.setSendStatus("2"); + inStockin.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + inStockin.setMsg(requestLog.getErrorDetails()); + inStockinDetailParam.setSendStatus("2"); + inStockinDetailParam.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + inStockinDetailParam.setMsg(requestLog.getErrorDetails()); + } + inStockinBackService.updateInStockinBack(inStockin); + inStockinDetailBackService.updateInStockinDetailBack(inStockinDetailParam); + + } catch (Exception e) { + inStockin.setSendStatus("2"); + inStockin.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + inStockin.setMsg(e.getMessage()); + inStockinDetailParam.setSendStatus("2"); + inStockinDetailParam.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + inStockinDetailParam.setMsg(e.getMessage()); + inStockinBackService.updateInStockinBack(inStockin); + inStockinDetailBackService.updateInStockinDetailBack(inStockinDetailParam); + } -// return AjaxResult.success(deliveryNoticeVo); } @Override public void callbackoutDeliveryNotice() { + OutStockoutBack outStockoutBack = outStockoutBackService.selelctTopOutStockout(); + if (outStockoutBack == null) { + return; + } + DeliveryNoticeVo deliveryNoticeVo = new DeliveryNoticeVo(); + deliveryNoticeVo.setBillNo(outStockoutBack.getStockoutId()); + deliveryNoticeVo.setNoteBillNo(outStockoutBack.getStockoutId()); + deliveryNoticeVo.setBillType(outStockoutBack.getOutType()); + deliveryNoticeVo.setOpType("1"); + deliveryNoticeVo.setBillDate(outStockoutBack.getCreateDate()); + deliveryNoticeVo.setWarehouseId(outStockoutBack.getWarehouseId()); + deliveryNoticeVo.setProjectNo(outStockoutBack.getDepartmentNo()); + deliveryNoticeVo.setCustomerId(outStockoutBack.getCustomerNo()); + deliveryNoticeVo.setCustomerName(outStockoutBack.getClassNowId()); + deliveryNoticeVo.setContractNo(outStockoutBack.getSpare1()); + + OutStockoutDetailBack outStockoutDetailBack = new OutStockoutDetailBack(); + outStockoutDetailBack.setStockoutId(outStockoutBack.getStockoutId()); +// outStockoutDetailBack.setSendStatus("0"); + List outStockoutDetailBacks = outStockoutDetailBackService.selectOutStockoutDetailBackList(outStockoutDetailBack); + List detailList = new ArrayList<>(); + if (outStockoutDetailBacks != null && !outStockoutDetailBacks.isEmpty()) { + for (OutStockoutDetailBack detail : outStockoutDetailBacks) { + DeliveryNoticeItemVo item = new DeliveryNoticeItemVo(); + item.setLineNo(detail.getStockoutDetailId()); + item.setNotelineNo(detail.getStockoutDetailId()); + item.setInventoryCode(detail.getProductId()); + item.setInventoryName(detail.getProductName()); + item.setSpecModel(detail.getSpec()); + item.setUnit(detail.getUnit()); + item.setQuantity(detail.getQuantity().toString()); + item.setLevelRelation(detail.getSpare1()); + item.setUpperMaterial(detail.getSpare2()); + item.setTopMaterial(detail.getSpare3()); +// item.setLotNo(detail.getLotNo()); + item.setRemark(detail.getRemark()); +// item.setArea(detail.getSpare9()); +// item.setLocation(detail.getSpare8()); + String[] splitArea = detail.getSpare9().split(","); + String[] splitLocation = detail.getSpare8().split(","); + String[] splitQuantity = detail.getQuantityX().split(","); + String[] lotNo = new String[]{}; + if (StrUtil.isNotEmpty(detail.getLotNo())) { + lotNo = detail.getLotNo().split(","); + } + ArrayList locationDetails = new ArrayList<>(); + for (int i = 0; i < splitArea.length; i++) { + LocationDetail locationDetail = new LocationDetail(); + locationDetail.setLocationNo(splitLocation[i]); + locationDetail.setQuantity(splitQuantity[i]); + locationDetail.setAreaNo(splitArea[i]); + locationDetail.setLotNo(lotNo[i]); + locationDetails.add(locationDetail); + } + item.setLocations(locationDetails); + detailList.add(item); + } + deliveryNoticeVo.setDetailList(detailList); + } + + try { + //todo 发送给erp 成功失败改状态 + RequestLog requestLog = requestLogService.getRequestLog("http://192.168.188.235/app1/api?type=1&key=1", JSONUtil.toJsonStr(deliveryNoticeVo), "出库回传", "wms", "erp"); + if ("1".equals(requestLog.getIsSuccessful())) { + outStockoutBack.setSendStatus("1"); + outStockoutBack.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + outStockoutBack.setMsg("成功"); + outStockoutDetailBack.setSendStatus("1"); + outStockoutDetailBack.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + outStockoutDetailBack.setMsg("成功"); + + } else { + outStockoutBack.setSendStatus("2"); + outStockoutBack.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + outStockoutBack.setMsg(requestLog.getErrorDetails()); + outStockoutDetailBack.setSendStatus("2"); + outStockoutDetailBack.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + outStockoutDetailBack.setMsg(requestLog.getErrorDetails()); + } + outStockoutBackService.updateOutStockoutBack(outStockoutBack); + outStockoutDetailBackService.updateOutStockoutDetailBack(outStockoutDetailBack); + + } catch (Exception e) { + outStockoutBack.setSendStatus("2"); + outStockoutBack.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + outStockoutBack.setMsg(e.getMessage()); + outStockoutDetailBack.setSendStatus("2"); + outStockoutDetailBack.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + outStockoutDetailBack.setMsg(e.getMessage()); + outStockoutBackService.updateOutStockoutBack(outStockoutBack); + outStockoutDetailBackService.updateOutStockoutDetailBack(outStockoutDetailBack); + } + } + + @Override + public void moveCargoSpace() { + MoveMsg moveMsg1 = new MoveMsg(); + moveMsg1.setStatus("0"); + List moveMsgs = moveMsgService.selectMoveMsgList(moveMsg1); + MoveMsg moveMsg = new MoveMsg(); + if (moveMsgs.size() > 0) { + moveMsg = moveMsgs.get(0); + } else { + return; + } + + try { + BasStock basStock = new BasStock(); + basStock.setTrayCode(moveMsg.getTrayCode()); + List basStocks = basStockService.selectBasStockList(basStock); + //将basStocks按照stockinId分组 + Map> basStocksMap = basStocks.stream().collect(Collectors.groupingBy(BasStock::getStockinId)); + for (Map.Entry> entry : basStocksMap.entrySet()) { + // 获取 stockinId(键) + String stockinId = entry.getKey(); + + // 获取对应的 basStock 列表(值) + List basStockList = entry.getValue(); + DeliveryNoticeVo deliveryNoticeVo = new DeliveryNoticeVo(); + deliveryNoticeVo.setBillNo(basStockList.get(0).getStockinId()); + //deliveryNoticeVo.setNoteBillNo(basStockList.get(0).getStockinId()); + deliveryNoticeVo.setBillDate(DateUtil.formatDateTime(new Date())); + deliveryNoticeVo.setWarehouseId(basStockList.get(0).getWarehouseId()); + deliveryNoticeVo.setProjectNo(basStockList.get(0).getSpare4()); + deliveryNoticeVo.setBillType("9"); + ArrayList deliveryNoticeItemVos = new ArrayList<>(); + for (BasStock basStock1 : basStockList) { + DeliveryNoticeItemVo item = new DeliveryNoticeItemVo(); + item.setLineNo(basStock1.getStockinDetailId()); + //item.setNotelineNo(basStock1.getStockinDetailId()); + item.setInventoryCode(basStock1.getProductId()); + item.setInventoryName(basStock1.getProductName()); + item.setSpecModel(basStock1.getPower()); + item.setUnit(basStock1.getPhase()); + item.setQuantity(basStock1.getQuantity()); + item.setLevelRelation(basStock1.getSpare1()); + item.setUpperMaterial(basStock1.getSpare2()); + item.setTopMaterial(basStock1.getSpare3()); + item.setLotNo(basStock1.getLotNo()); + item.setAreaBefore(moveMsg.getOldSpace()); + //item.setLocationBefore(moveMsg.getTrayCode()); + item.setArea(moveMsg.getNewSpace()); + item.setLocation(moveMsg.getTrayCode()); + deliveryNoticeItemVos.add(item); + } + deliveryNoticeVo.setDetailList(deliveryNoticeItemVos); + + + //code success msg + RequestLog requestLog = requestLogService.getRequestLog("http://192.168.188.235/app1/api?type=1&key=2", JSONUtil.toJsonStr(deliveryNoticeVo), "移库回传", "wms", "erp"); + moveMsg.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + if ("1".equals(requestLog.getIsSuccessful())) { + moveMsg.setStatus("1"); + moveMsg.setMsg("成功"); + } else { + moveMsg.setStatus("2"); + moveMsg.setMsg(requestLog.getErrorDetails()); + } + + moveMsgService.updateMoveMsg(moveMsg); + } + } catch (Exception e) { + moveMsg.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + moveMsg.setStatus("2"); + moveMsg.setMsg(e.getMessage()); + moveMsgService.updateMoveMsg(moveMsg); + } } + @Override public AjaxResult createWorkshopInboundOrder(BasProduct basProduct) { ErpInterfaceParam param = new ErpInterfaceParam<>(); @@ -382,19 +963,249 @@ public class ToErpServiceImpl implements IToErpService { objectErpParameter.setDatas(List.of(wipTransferDoc)); erpStdData.setParameter(objectErpParameter); param.setStd_data(erpStdData); - RequestLog requestLog = requestLogService.getRequestLog(WORKSHOP_INBOUND_ORDER_URL, JSONUtil.toJsonStr(param), "创建工艺单","wms","erp"); + RequestLog requestLog = requestLogService.getRequestLog(WORKSHOP_INBOUND_ORDER_URL, JSONUtil.toJsonStr(param), "创建工艺单", "wms", "erp"); // String post = requestLog.getResponseBody(); // ErpInterfaceParam bean = JSONUtil.toBean(post, ErpInterfaceParam.class); // if ("0".equals(bean.getStd_data().getExecution().getCode())) { // return AjaxResult.success(); // } - if(requestLog != null && "1".equals(requestLog.getIsSuccessful())){ + if (requestLog != null && "1".equals(requestLog.getIsSuccessful())) { return AjaxResult.success(); - }else{ + } else { return AjaxResult.error(); } } + @Override + public void callbackInDeliveryNoticeNew() { + + InStockinBack inStockin = inStockinBackService.selectTopInStockin(); + if (inStockin == null) { + return; + } + CallBackErp callBackErp = new CallBackErp(); + callBackErp.setCcompany(inStockin.getCompanyShortName()); // 公司简称 + callBackErp.setCcode(inStockin.getStockinId()); // wms 单据号 需要改成作业号 + callBackErp.setDdate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); // 操作日期 + callBackErp.setCintype(inStockin.getInType()); // 业务类型 + callBackErp.setCvencode(inStockin.getSupplierNo()); // 供应商编码 + callBackErp.setCvenname(inStockin.getClassNo()); // 供应商名称 + callBackErp.setCoptname(inStockin.getCreateManId()); // 操作人 + callBackErp.setCmemo(inStockin.getRemark()); // 备注 + callBackErp.setCacc_id(inStockin.getAccountSetNo()); // 账套号 + callBackErp.setCwhcode("01"); // 仓库编码 + callBackErp.setCwhname("立体库"); // 仓库名称 + + + // TODO 以下需要重新编写根据给的字段 + InStockinDetailBack inStockinDetailParam = new InStockinDetailBack(); + inStockinDetailParam.setStockinId(inStockin.getStockinId()); + inStockinDetailParam.setSendStatus("0"); + List inStockinDetails = inStockinDetailBackService.selectInStockinDetailBackList(inStockinDetailParam); + + List detailList = new ArrayList<>(); + if (inStockinDetails != null && !inStockinDetails.isEmpty()) { + for (InStockinDetailBack detail : inStockinDetails) { + CallBackErpItems item = new CallBackErpItems(); + // 存货编码11 + item.setCinvcode(detail.getProductId()); + // 存货名称 + item.setCinvname(detail.getProductName()); + // 规格型号 + item.setCinvstd(detail.getSpec()); + // 单位 + item.setCinvm_unit(detail.getUnit()); + // 货位编码 + item.setCposcode(detail.getSpare9()); + item.setJobid(detail.getStockinGuid()); + // 货位名称 + item.setCposname(""); + // 托盘号 + item.setCtrayname(detail.getSpare8()); + //jobid +// item.setJobid(detail.getSpare7()); + // 批号 + item.setCbatch(detail.getLotNo()); + // 数量 + item.setIquantity(Integer.valueOf(detail.getAssignNum())); + // 老项目号 + item.setCxmh(detail.getOldProjectNo()); + // 新项目号 + item.setCnewxmh(detail.getSpare4()); + // erpbillno + item.setSrccode(inStockin.getErpBill()); + // erp来源单子表id + item.setSrcids(Integer.valueOf(detail.getSourceLineId())); + // erp子表行号 + item.setSrcrowno(detail.getSpare6()); + // 是否批次管理 + item.setBinvbatch(Integer.valueOf(detail.getIsBatchManage())); + // 仓库选择 1立库 2 平库 + item.setStg_location(detail.getProductGuid()); + // 组件号 + + System.err.println("组件号赋值 " + detail.getCargoNo()); + item.setGroupNum(detail.getCargoNo()); + System.err.println("组件号赋值 结束"); + detailList.add(item); + } + } + callBackErp.setDetails(detailList); + + String sendMsg = JSONUtil.toJsonStr(callBackErp); + System.err.println(sendMsg); + try { + //todo 发送给erp 成功失败改状态 + // http://192.168.188.235/app1/api?type=1&key=1 + RequestLog requestLog = requestLogService.getRequestLog("https://192.168.188.239:1093/hzgmid/ServerCommand/SaveDataFromWms", JSONUtil.toJsonStr(callBackErp), "入库回传", "wms", "erp", inStockin.getInType(), inStockin.getAccountSetNo()); + if ("1".equals(requestLog.getIsSuccessful())) { + inStockin.setSendStatus("1"); + inStockin.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + inStockin.setMsg("成功"); + inStockinDetailParam.setSendStatus("1"); + inStockinDetailParam.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + inStockinDetailParam.setMsg("成功"); + inStockinDetailBackService.insertInStockInDetailBackFinish(inStockinDetails); + inStockinDetailBackService.deleteInStockInDetailList(inStockinDetails); + } else { + inStockin.setSendStatus("2"); + inStockin.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + inStockin.setMsg(requestLog.getErrorDetails()); + inStockinDetailParam.setSendStatus("2"); + inStockinDetailParam.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + inStockinDetailParam.setMsg(requestLog.getErrorDetails()); + } + inStockinBackService.updateInStockinBack(inStockin); + inStockinDetailBackService.updateInStockinDetailBack(inStockinDetailParam); + + } catch (Exception e) { + inStockin.setSendStatus("2"); + inStockin.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + inStockin.setMsg(e.getMessage()); + inStockinDetailParam.setSendStatus("2"); + inStockinDetailParam.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + inStockinDetailParam.setMsg(e.getMessage()); + inStockinBackService.updateInStockinBack(inStockin); + inStockinDetailBackService.updateInStockinDetailBack(inStockinDetailParam); + } + + } + + @Override + public void callbackDeliveryOutNoticeNew() { + OutStockoutBack outStockoutBack = outStockoutBackService.selelctTopOutStockout(); + if (outStockoutBack == null) { + return; + } + CallBackErp callBackErp = new CallBackErp(); + callBackErp.setCcompany(outStockoutBack.getCompanyShortName()); // 公司简称 + callBackErp.setCcode(outStockoutBack.getStockoutId()); // wms 单据号 + callBackErp.setDdate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); // 操作日期 + callBackErp.setCintype(outStockoutBack.getOutType()); // 业务类型 + callBackErp.setCvencode(outStockoutBack.getCustomerNo()); // 供应商编码 + callBackErp.setCvenname(outStockoutBack.getCustomerNo()); // 供应商名称 + callBackErp.setCoptname(outStockoutBack.getCreateManId()); // 操作人 + callBackErp.setCmemo(outStockoutBack.getRemark()); // 备注 + callBackErp.setCacc_id(outStockoutBack.getAccountSetNo()); // 账套号 + callBackErp.setCwhcode("01"); // 仓库编码 + callBackErp.setCwhname("立体库"); // 仓库名称 + + + OutStockoutDetailBack outStockoutDetailBack = new OutStockoutDetailBack(); + outStockoutDetailBack.setStockoutId(outStockoutBack.getStockoutId()); + outStockoutDetailBack.setSendStatus("0"); +// outStockoutDetailBack.setSendStatus("0"); + List outStockoutDetailBacks = outStockoutDetailBackService.selectOutStockoutDetailBackList(outStockoutDetailBack); + List detailList = new ArrayList<>(); + if (outStockoutDetailBacks != null && !outStockoutDetailBacks.isEmpty()) { + for (OutStockoutDetailBack detail : outStockoutDetailBacks) { + CallBackErpItems item = new CallBackErpItems(); + // 存货编码 + item.setCinvcode(detail.getProductId()); + // 存货名称 + item.setCinvname(detail.getProductName()); + // 规格型号 + item.setCinvstd(detail.getSpec()); + // 单位 + item.setCinvm_unit(detail.getUnit()); + // 货位编码 + item.setCposcode(detail.getSpare9()); + // 货位名称 + item.setCposname(""); + // 托盘号 + item.setCtrayname(detail.getSpare8()); + // 批号 + item.setCbatch(detail.getLotNo()); + + item.setJobid(detail.getStockoutGuid()); +// item.setLotNo(detail.getLotNo()); + // 数量 + item.setIquantity(Integer.parseInt(String.valueOf(detail.getAssignNum()))); + // 老项目号 + item.setCxmh(detail.getOldProjectNo()); + // 新项目号 + item.setCnewxmh(detail.getSpare4()); + // erpbillno + item.setSrccode(outStockoutBack.getErpStockoutId()); + // erp来源单子表id + item.setSrcids(Integer.valueOf(detail.getSourceLineId())); + // erp子表行号 + item.setSrcrowno(detail.getSpare6()); + // 是否批次管理 + item.setBinvbatch(Integer.valueOf(detail.getIsBatchManage())); + // 仓库选择 1立库 2 平库 + item.setStg_location(detail.getProductGuid()); + // TODO 暂时未启用 等甲方后续通知 + item.setGroupNum(detail.getEntryid()); + + detailList.add(item); + } + callBackErp.setDetails(detailList); + + } + + try { + //todo 发送给erp 成功失败改状态 + RequestLog requestLog = requestLogService.getRequestLog("https://192.168.188.239:1093/hzgmid/ServerCommand/SaveDataFromWms", JSONUtil.toJsonStr(callBackErp), "出库回传", "wms", "erp", outStockoutBack.getOutType(), outStockoutBack.getAccountSetNo()); + if ("1".equals(requestLog.getIsSuccessful())) { + outStockoutBack.setSendStatus("1"); + outStockoutBack.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + outStockoutBack.setMsg("成功"); + outStockoutDetailBack.setSendStatus("1"); + outStockoutDetailBack.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + outStockoutDetailBack.setMsg("成功"); + outStockoutDetailBackService.insertOutStockDetailBackFinish(outStockoutDetailBacks); + outStockoutDetailBackService.deleteOutStockDetailList(outStockoutDetailBacks); + + } else { + outStockoutBack.setSendStatus("2"); + outStockoutBack.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + outStockoutBack.setMsg(requestLog.getErrorDetails()); + outStockoutDetailBack.setSendStatus("2"); + outStockoutDetailBack.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + outStockoutDetailBack.setMsg(requestLog.getErrorDetails()); + } + outStockoutBackService.updateOutStockoutBack(outStockoutBack); + outStockoutDetailBackService.updateOutStockoutDetailBack(outStockoutDetailBack); + + } catch (Exception e) { + outStockoutBack.setSendStatus("2"); + outStockoutBack.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + outStockoutBack.setMsg(e.getMessage()); + outStockoutDetailBack.setSendStatus("2"); + outStockoutDetailBack.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + outStockoutDetailBack.setMsg(e.getMessage()); + outStockoutBackService.updateOutStockoutBack(outStockoutBack); + outStockoutDetailBackService.updateOutStockoutDetailBack(outStockoutDetailBack); + } + + } + + @Override + public void callbackDeliveryOutNoticeNews() { + + } + public AjaxResult createOtherInOutboundOrder(TransferBillCallback transferBillCallback) { ErpInterfaceParam param = new ErpInterfaceParam<>(); @@ -404,10 +1215,10 @@ public class ToErpServiceImpl implements IToErpService { ErpInOutBoundOrder erpInOutBoundOrder = new ErpInOutBoundOrder(); String docNo = ""; String docIdDocCode = ""; - if ("1".equals(transferBillCallback.getType())){ + if ("1".equals(transferBillCallback.getType())) { docNo = basJobIdService.getJobId("11T1"); docIdDocCode = "11T1"; - }else { + } else { docNo = basJobIdService.getJobId("11T2"); docIdDocCode = "11T2"; } @@ -428,7 +1239,7 @@ public class ToErpServiceImpl implements IToErpService { for (int i = 0; i < mydoJobDetails.size(); i++) { MydoJobDetail mydoJobDetail = mydoJobDetails.get(i); ErpTransactionDocD erpTransactionDocD = new ErpTransactionDocD(); - erpTransactionDocD.setSequenceNumber(i+1); + erpTransactionDocD.setSequenceNumber(i + 1); erpTransactionDocD.setITEM_ID_ITEM_CODE(mydoJobDetail.getProductId()); erpTransactionDocD.setITEM_DESCRIPTION(mydoJobDetail.getProductName()); erpTransactionDocD.setITEM_SPECIFICATION(mydoJobDetail.getSpec()); @@ -444,11 +1255,11 @@ public class ToErpServiceImpl implements IToErpService { objectErpParameter.setDatas(list); erpStdData.setParameter(objectErpParameter); param.setStd_data(erpStdData); - RequestLog requestLog = requestLogService.getRequestLog( OTHER_IN_OUTBOUND_ORDER_URL, JSONUtil.toJsonStr(param), "创建其他入出库单","wms","erp"); + RequestLog requestLog = requestLogService.getRequestLog(OTHER_IN_OUTBOUND_ORDER_URL, JSONUtil.toJsonStr(param), "创建其他入出库单", "wms", "erp"); - if(requestLog != null && "1".equals(requestLog.getIsSuccessful())){ + if (requestLog != null && "1".equals(requestLog.getIsSuccessful())) { return AjaxResult.success(); - }else{ + } else { return AjaxResult.error(); } // String post = requestLog.getResponseBody(); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/api/service/impl/ToWcsServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/api/service/impl/ToWcsServiceImpl.java index 967dda8..0c5e949 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/api/service/impl/ToWcsServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/api/service/impl/ToWcsServiceImpl.java @@ -33,7 +33,7 @@ public class ToWcsServiceImpl implements IToWcsService { @Autowired private IAgvContainerTaskService agvContainerTaskService; - public static final String PUSH_OUT_MYDO_JOB = "http://localhost:8081/wcs2Wms/api/receiveOutMydoJob"; + public static final String PUSH_OUT_MYDO_JOB = "http://192.168.188.236:8081/wcs2Wms/api/receiveOutMydoJob"; public static final String PUSH_IN_MYDO_JOB = "http://localhost:8081/wcs2Wms/api/receiveInMydoJob"; public static final String PUSH_AGV_MOVE_JOB = "http://localhost:8081/agv/api/receiveAgvMoveJob"; public static final String OUT_MYDOJOB_MS = "http://localhost:8081/wcs2Wms/api/outMydojobMakesure"; @@ -43,15 +43,12 @@ public class ToWcsServiceImpl implements IToWcsService { @Override -// @Scheduled(fixedDelay=1500) + @Scheduled(fixedDelay=1500) public void pushOutMydoJob() { //查询所有未推送的料箱出库作业 MydoJob mydoJobParam = new MydoJob(); mydoJobParam.setStatus("1"); - List list = new ArrayList<>(); - list.add("21"); - list.add("26"); - mydoJobParam.setInOutIds(list); + mydoJobParam.setInOut("2"); List outMydoJobs = mydoJobService.selectMydoJobListApi(mydoJobParam); for (MydoJob outMydoJob : outMydoJobs) { RequestLog requestLog = requestLogService.getRequestLog(PUSH_OUT_MYDO_JOB, JSONUtil.toJsonStr(outMydoJob), "推送出库任务","wms","wcs"); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/api/service/impl/ToWmsServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/api/service/impl/ToWmsServiceImpl.java index faa09e5..718ca63 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/api/service/impl/ToWmsServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/api/service/impl/ToWmsServiceImpl.java @@ -93,27 +93,29 @@ public class ToWmsServiceImpl implements IToWmsService { @Override - @Transactional(rollbackFor = Exception.class) public AjaxResult requestEnterByTrayCode(RequestEnter requestEnter) { String trayCode = requestEnter.getTrayCode(); MydoJob inJob = mydoJobMapper.selectInJobByTrayCode(trayCode); if(inJob != null && Integer.parseInt(inJob.getInOrOut()) < 20){ - if(inJob.getCargoSpaceId() != null && !"".equals(inJob.getCargoSpaceId())){ - return AjaxResult.success(JSONUtil.toJsonStr(inJob)); - }else{ - //分配货位 - HashMap map = new HashMap<>(); +// if(inJob.getCargoSpaceId() != null && !"".equals(inJob.getCargoSpaceId())){ +// return AjaxResult.success(inJob); +// }else{ +// //分配货位 +// HashMap map = new HashMap<>(); +// +// map.put("v_tray_code", trayCode); +// mydoJobMapper.allotInJobSpace(map); +// if (!"10".equals(map.get("v_result").toString())) { +// return AjaxResult.error(map.get("v_resultmsg").toString()); +// }else{ +// +// } +// } + +// MydoJob inJob2 = mydoJobMapper.selectInJobByTrayCode(trayCode); + return AjaxResult.success(inJob); - map.put("v_tray_code", trayCode); - mydoJobMapper.allotInJobSpace(map); - if (!"10".equals(map.get("v_result").toString())) { - return AjaxResult.error(map.get("v_resultmsg").toString()); - }else{ - MydoJob inJob2 = mydoJobMapper.selectInJobByTrayCode(trayCode); - return AjaxResult.success(JSONUtil.toJsonStr(inJob2)); - } - } }else{ return AjaxResult.error("该条码无入库任务,请扫码绑定!"); } @@ -197,9 +199,20 @@ public class ToWmsServiceImpl implements IToWmsService { return AjaxResult.error("任务不存在"); } MydoJob outJob = outMydoJobs.get(0); + //出库作业 outJob.setExecutionPhase("2"); mydoJobService.updateMydoJob(outJob); break; + case "7": + //移库作业 + mydoJobParam.setTaskNo(wmsJobRequest.getTaskNo()); + List ykMydoJobs = mydoJobService.selectMydoJobListApi(mydoJobParam); + if (ykMydoJobs.isEmpty()) { + return AjaxResult.error("任务不存在"); + } + MydoJob ykJob = ykMydoJobs.get(0); + mydoJobService.ykCompleted(ykJob); + break; default: log.error("作业类型错误"); @@ -385,5 +398,32 @@ public class ToWmsServiceImpl implements IToWmsService { return AjaxResult.error(erpProduct.getSys_MainId()+"物料不存在"); } + @Override + public AjaxResult requestEnterByTaskNo(RequestEnter requestEnter) { + String taskNo = requestEnter.getTaskNo(); + String deviceCode = requestEnter.getDeviceCode(); + MydoJob inJob = mydoJobMapper.selectInJobByTaskNo(taskNo); + if(inJob != null && Integer.parseInt(inJob.getInOrOut()) < 20){ + if(inJob.getCargoSpaceId() != null && !"".equals(inJob.getCargoSpaceId())){ + return AjaxResult.success(inJob); + }else{ + //分配货位 + HashMap map = new HashMap<>(); + + map.put("v_tray_code", inJob.getTrayCode()); + map.put("v_code", deviceCode); + mydoJobMapper.allotInJobSpace(map); + if (!"10".equals(map.get("v_result").toString())) { + return AjaxResult.error(map.get("v_resultmsg").toString()); + }else{ + MydoJob inJob2 = mydoJobMapper.selectInJobByTaskNo(taskNo); + return AjaxResult.success(inJob2); + } + } + }else{ + return AjaxResult.error("该条码无入库任务,请扫码绑定!"); + } + } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/api/service/impl/TwinServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/api/service/impl/TwinServiceImpl.java index 33bb28d..467a480 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/api/service/impl/TwinServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/api/service/impl/TwinServiceImpl.java @@ -5,6 +5,10 @@ import com.ruoyi.bas.cargoSpace.domain.BasCargoSpace; import com.ruoyi.bas.cargoSpace.service.IBasCargoSpaceService; import com.ruoyi.in.stockinfinish.domain.InStockinFinish; import com.ruoyi.in.stockinfinish.service.IInStockinFinishService; +import com.ruoyi.job.mydojob.domain.MydoJob; +import com.ruoyi.job.mydojob.service.IMydoJobService; +import com.ruoyi.job.mydojobdetail.domain.MydoJobDetail; +import com.ruoyi.job.mydojobdetail.service.IMydoJobDetailService; import com.ruoyi.out.outStockoutFinish.domain.OutStockoutFinish; import com.ruoyi.out.outStockoutFinish.service.IOutStockoutFinishService; import com.ruoyi.stock.stock.domain.BasStock; @@ -33,6 +37,10 @@ public class TwinServiceImpl implements ITwinService { private IInStockinFinishService inStockinFinishService; @Autowired private IOutStockoutFinishService outStockoutFinishService; + @Autowired + private IMydoJobService mydoJobService; + @Autowired + private IMydoJobDetailService mydoJobDetailService; @Override public Map getStockListOverview() { @@ -250,4 +258,62 @@ public class TwinServiceImpl implements ITwinService { result.put("monthOutStock", monthOutStock); return result; } + + @Override + public Map getCargo(String cargoSpaceName) { + BasStock basStock = new BasStock(); + basStock.setCargoSpaceId(cargoSpaceName); + List list = basStockService.selectBasStockList(basStock); + List> dataList = new ArrayList<>(); + for (BasStock stock : list) { + Map dataMap = new HashMap<>(); + dataMap.put("productId", stock.getProductId()); + dataMap.put("productName", stock.getProductName()); + dataMap.put("quantity", stock.getQuantity()); + dataMap.put("trayCode", stock.getTrayCode()); + dataList.add(dataMap); + } + Map result = new HashMap<>(); + result.put("data", dataList); + return result; + } + + @Override + public Map getTaskCargo(String taskNo) { + MydoJob mydoJob = new MydoJob(); + mydoJob.setTaskNo(taskNo); + List jobList = mydoJobService.selectMydoJobList(mydoJob); + List> dataList = new ArrayList<>(); + if (jobList != null && !jobList.isEmpty()) { + MydoJob job = jobList.get(0); + String jobId = job.getJobId(); + String inOrOutStr = job.getInOrOut(); + int inOrOut = 0; + try { + inOrOut = Integer.parseInt(inOrOutStr); + } catch (Exception e) { + // Ignore parse error + } + + List details = mydoJobDetailService.selectMydoJobDetailListByJobId(jobId); + for (MydoJobDetail detail : details) { + Map dataMap = new HashMap<>(); + dataMap.put("productId", detail.getProductId()); + dataMap.put("productName", detail.getProductName()); + + String quantity = "0"; + if (inOrOut < 20) { + quantity = detail.getInQuantity(); + } else { + quantity = detail.getOutQuantity(); + } + dataMap.put("quantity", quantity); + dataMap.put("trayCode", detail.getTrayCode()); + dataList.add(dataMap); + } + } + Map result = new HashMap<>(); + result.put("data", dataList); + return result; + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/bas/traycode/controller/BasTraycodeController.java b/ruoyi-admin/src/main/java/com/ruoyi/bas/traycode/controller/BasTraycodeController.java index 2860e5f..78f9860 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/bas/traycode/controller/BasTraycodeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/bas/traycode/controller/BasTraycodeController.java @@ -71,6 +71,7 @@ public class BasTraycodeController extends BaseController @PostMapping public AjaxResult add(@RequestBody BasTraycode basTraycode) { + return toAjax(basTraycodeService.insertBasTraycode(basTraycode)); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/bas/traycode/domain/BasTraycode.java b/ruoyi-admin/src/main/java/com/ruoyi/bas/traycode/domain/BasTraycode.java index de122ce..7844fbd 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/bas/traycode/domain/BasTraycode.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/bas/traycode/domain/BasTraycode.java @@ -16,16 +16,16 @@ public class BasTraycode extends BaseEntity private static final long serialVersionUID = 1L; /** id */ - @Excel(name = "${bas.Traycode.id}") +// @Excel(name = "${bas.Traycode.id}") private Long id; /** 条码类型id */ - @Excel(name = "${bas.Traycode.formatId}") +// @Excel(name = "${bas.Traycode.formatId}") private Long formatId; private String formatName; /** 条码 */ - @Excel(name = "${bas.Traycode.trayCode}") + @Excel(name = "条码") private String trayCode; /** 备用字段1 */ @@ -33,7 +33,7 @@ public class BasTraycode extends BaseEntity private String spare1; /** 备用字段2 */ -// @Excel(name = "${bas.Traycode.spare2}") + @Excel(name = "是否可用",dictType = "sys_yes_no") private String spare2; /** 备用字段3 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/bas/traycode/mapper/BasTraycodeMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/bas/traycode/mapper/BasTraycodeMapper.java index cb76145..68e80a6 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/bas/traycode/mapper/BasTraycodeMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/bas/traycode/mapper/BasTraycodeMapper.java @@ -61,4 +61,6 @@ public interface BasTraycodeMapper public int deleteBasTraycodeByIds(Long[] ids); void insertBasTraycodeList(List list); + + Integer selectBasTrayCodeMax(); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/bas/traycode/service/IBasTraycodeService.java b/ruoyi-admin/src/main/java/com/ruoyi/bas/traycode/service/IBasTraycodeService.java index 28793c1..eeae6eb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/bas/traycode/service/IBasTraycodeService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/bas/traycode/service/IBasTraycodeService.java @@ -61,4 +61,6 @@ public interface IBasTraycodeService public int deleteBasTraycodeById(Long id); void insertBasTraycodeList(List traycodeList); + + Integer selectBasTrayCodeMax(); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/bas/traycode/service/impl/BasTraycodeServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/bas/traycode/service/impl/BasTraycodeServiceImpl.java index f737b01..69ad881 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/bas/traycode/service/impl/BasTraycodeServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/bas/traycode/service/impl/BasTraycodeServiceImpl.java @@ -1,9 +1,12 @@ package com.ruoyi.bas.traycode.service.impl; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.convert.Convert; import com.ruoyi.bas.traycode.domain.BasTraycode; import com.ruoyi.bas.traycode.mapper.BasTraycodeMapper; import com.ruoyi.bas.traycode.service.IBasTraycodeService; +import com.ruoyi.bas.traycodeformat.domain.BasTraycodeFormat; +import com.ruoyi.bas.traycodeformat.service.IBasTraycodeFormatService; import com.ruoyi.common.utils.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -21,6 +24,8 @@ public class BasTraycodeServiceImpl implements IBasTraycodeService { @Autowired private BasTraycodeMapper basTraycodeMapper; + @Autowired + private IBasTraycodeFormatService basTraycodeFormatService; /** * 查询条码信息 @@ -55,8 +60,33 @@ public class BasTraycodeServiceImpl implements IBasTraycodeService @Override public int insertBasTraycode(BasTraycode basTraycode) { - basTraycode.setCreateTime(DateUtils.getNowDate()); - return basTraycodeMapper.insertBasTraycode(basTraycode); + try { + BasTraycodeFormat basTraycodeFormat = basTraycodeFormatService.selectBasTraycodeFormatById(basTraycode.getFormatId()); + + + int i1 = Integer.parseInt(basTraycode.getSpare1()); + //如果i<4位数,前面补0 + String code = ""; + for (int j = 0; j < i1; j++) { + code = String.format("%07d",Convert.toInt( basTraycodeFormat.getSerialRule()) + 1 + j); + if(basTraycodeFormat.getMaxNum() < Convert.toLong( code)){ + throw new RuntimeException("已生成最大值"); + } + String finalCode = basTraycodeFormat.getBarcodeFormat()+code; + basTraycode.setTrayCode(finalCode); + basTraycode.setSpare1(null); + basTraycode.setCreateTime(DateUtils.getNowDate()); + basTraycode.setSpare2("Y"); + basTraycodeMapper.insertBasTraycode(basTraycode); + + + } + basTraycodeFormat.setSerialRule(Convert.toLong( code).toString()); + basTraycodeFormatService.updateBasTraycodeFormat(basTraycodeFormat); + } catch (Exception e) { + throw new RuntimeException(e); + } + return 1; } /** @@ -103,4 +133,9 @@ public class BasTraycodeServiceImpl implements IBasTraycodeService basTraycodeMapper.insertBasTraycodeList(list); } } + + @Override + public Integer selectBasTrayCodeMax() { + return basTraycodeMapper.selectBasTrayCodeMax(); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/bas/traycodeformat/service/impl/BasTraycodeFormatServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/bas/traycodeformat/service/impl/BasTraycodeFormatServiceImpl.java index f9d9031..7b4f3a0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/bas/traycodeformat/service/impl/BasTraycodeFormatServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/bas/traycodeformat/service/impl/BasTraycodeFormatServiceImpl.java @@ -1,17 +1,13 @@ package com.ruoyi.bas.traycodeformat.service.impl; -import cn.hutool.core.util.StrUtil; -import com.ruoyi.bas.traycode.domain.BasTraycode; import com.ruoyi.bas.traycode.service.IBasTraycodeService; import com.ruoyi.bas.traycodeformat.domain.BasTraycodeFormat; import com.ruoyi.bas.traycodeformat.mapper.BasTraycodeFormatMapper; import com.ruoyi.bas.traycodeformat.service.IBasTraycodeFormatService; -import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.utils.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.ArrayList; import java.util.List; /** @@ -79,20 +75,7 @@ public class BasTraycodeFormatServiceImpl implements IBasTraycodeFormatService public int updateBasTraycodeFormat(BasTraycodeFormat basTraycodeFormat) { BasTraycodeFormat old = selectBasTraycodeFormatById(basTraycodeFormat.getId()); - int oldSerialRule = Convert.toInt(old.getSerialRule()); - int newSerialRule = Convert.toInt(basTraycodeFormat.getSerialRule()); - - List traycodeList = new ArrayList<>(); - for (int i = oldSerialRule; i < newSerialRule; i++) { - BasTraycode basTraycode = new BasTraycode(); - basTraycode.setFormatId(basTraycodeFormat.getId()); - String traycode = old.getBarcodeFormat()+ StrUtil.padPre(Convert.toStr(i),5,'0'); - basTraycode.setTrayCode(traycode); - traycodeList.add(basTraycode); - } basTraycodeFormat.setUpdateTime(DateUtils.getNowDate()); - //插入条码信息 - basTraycodeService.insertBasTraycodeList(traycodeList); return basTraycodeFormatMapper.updateBasTraycodeFormat(basTraycodeFormat); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/check/stockcheck/service/impl/CheckStockinServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/check/stockcheck/service/impl/CheckStockinServiceImpl.java index e280463..7e08309 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/check/stockcheck/service/impl/CheckStockinServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/check/stockcheck/service/impl/CheckStockinServiceImpl.java @@ -182,8 +182,8 @@ public class CheckStockinServiceImpl implements ICheckStockinService { CheckStockinDetail checkStockinDetail = detailList.get(i); checkStockinDetail.setStockCheckDetailId(stockCheckId + "-" + (i + 1)); checkStockinDetail.setStockCheckId(stockCheckId); - BasProduct basProduct = productService.selectBasProductByProductId(checkStockinDetail.getProductId()); - checkStockinDetail.setProductGuid(basProduct.getProductGuid()); +// BasProduct basProduct = productService.selectBasProductByProductId(checkStockinDetail.getProductId()); +// checkStockinDetail.setProductGuid(basProduct.getProductGuid()); checkStockinDetail.setStockCheckGuid(checkStockin.getStockGuid()); checkStockinDetail.setScanNum("0"); checkStockinDetail.setAssignNum("0"); @@ -229,7 +229,7 @@ public class CheckStockinServiceImpl implements ICheckStockinService { checkStockinMapper.autoAllot(map); builder.append("行明细:" + checkStockinDetail.getStockCheckDetailId() + ",分配结果:" + map.get("v_resultmsg") + "
"); } - iToWcsService.pushOutMydoJob(); + //iToWcsService.pushOutMydoJob(); return AjaxResult.success(builder.toString()); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/device/agv/mapper/AgvContainerTaskMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/device/agv/mapper/AgvContainerTaskMapper.java index 7306baa..fdb6f30 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/device/agv/mapper/AgvContainerTaskMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/device/agv/mapper/AgvContainerTaskMapper.java @@ -60,4 +60,6 @@ public interface AgvContainerTaskMapper public int deleteAgvContainerTaskByIds(Long[] ids); void insertHistory(Long id); + + void deleteAgvJobByOrder(String order); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/device/agv/service/IAgvContainerTaskService.java b/ruoyi-admin/src/main/java/com/ruoyi/device/agv/service/IAgvContainerTaskService.java index 7df0984..8dba646 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/device/agv/service/IAgvContainerTaskService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/device/agv/service/IAgvContainerTaskService.java @@ -60,4 +60,6 @@ public interface IAgvContainerTaskService public int deleteAgvContainerTaskById(Long id); void insertHistory(Long id); + + void deleteAgvJobByOrder(String order); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/device/agv/service/impl/AgvContainerTaskServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/device/agv/service/impl/AgvContainerTaskServiceImpl.java index b8307cb..075c419 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/device/agv/service/impl/AgvContainerTaskServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/device/agv/service/impl/AgvContainerTaskServiceImpl.java @@ -97,4 +97,9 @@ public class AgvContainerTaskServiceImpl implements IAgvContainerTaskService public void insertHistory(Long id) { agvContainerTaskMapper.insertHistory(id); } + + @Override + public void deleteAgvJobByOrder(String order) { + agvContainerTaskMapper.deleteAgvJobByOrder(order); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/in/stockin/domain/InStockin.java b/ruoyi-admin/src/main/java/com/ruoyi/in/stockin/domain/InStockin.java index e82e973..802c4e2 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/in/stockin/domain/InStockin.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/in/stockin/domain/InStockin.java @@ -102,8 +102,54 @@ public class InStockin extends BaseEntity private String lotNo; private String materialDesc; + private String productId; private String startDate; + private String companyShortName; + private String accountSetNo; + private String cargoNo; + private String stockinDetailId; + + public String getProductId() { + return productId; + } + + public void setProductId(String productId) { + this.productId = productId; + } + + public String getStockinDetailId() { + return stockinDetailId; + } + + public void setStockinDetailId(String stockinDetailId) { + this.stockinDetailId = stockinDetailId; + } + + public String getCargoNo() { + return cargoNo; + } + + public void setCargoNo(String cargoNo) { + this.cargoNo = cargoNo; + } + + public String getCompanyShortName() { + return companyShortName; + } + + public void setCompanyShortName(String companyShortName) { + this.companyShortName = companyShortName; + } + + public String getAccountSetNo() { + return accountSetNo; + } + + public void setAccountSetNo(String accountSetNo) { + this.accountSetNo = accountSetNo; + } + private List typeData; public String getStartDate() { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/in/stockin/mapper/InStockinMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/in/stockin/mapper/InStockinMapper.java index 3be6e24..39f2f58 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/in/stockin/mapper/InStockinMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/in/stockin/mapper/InStockinMapper.java @@ -66,4 +66,6 @@ public interface InStockinMapper void insertInStockinHistory(InStockin inStockin); List selectStockinByDetail(String stockinDetailId); + + List selectInStockinListBill(InStockin param); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/in/stockin/service/IInStockinService.java b/ruoyi-admin/src/main/java/com/ruoyi/in/stockin/service/IInStockinService.java index 6ceece1..a73599a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/in/stockin/service/IInStockinService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/in/stockin/service/IInStockinService.java @@ -73,4 +73,6 @@ public interface IInStockinService public int deleteInStockinByStockinGuid(String stockinGuid); public List selectStockinByDetail(String stockinDetailId); + + List selectInStockinListBill(InStockin param); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/in/stockin/service/impl/InStockinServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/in/stockin/service/impl/InStockinServiceImpl.java index 0448f63..d9545af 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/in/stockin/service/impl/InStockinServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/in/stockin/service/impl/InStockinServiceImpl.java @@ -255,4 +255,9 @@ public class InStockinServiceImpl implements IInStockinService public List selectStockinByDetail(String stockinDetailId) { return inStockinMapper.selectStockinByDetail(stockinDetailId); } + + @Override + public List selectInStockinListBill(InStockin param) { + return inStockinMapper.selectInStockinListBill(param); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/in/stockinback/domain/InStockinBack.java b/ruoyi-admin/src/main/java/com/ruoyi/in/stockinback/domain/InStockinBack.java index e97d854..e739fe0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/in/stockinback/domain/InStockinBack.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/in/stockinback/domain/InStockinBack.java @@ -95,6 +95,24 @@ public class InStockinBack extends BaseEntity private String sendTime; private String msg; + private String companyShortName; + private String accountSetNo; + + public String getCompanyShortName() { + return companyShortName; + } + + public void setCompanyShortName(String companyShortName) { + this.companyShortName = companyShortName; + } + + public String getAccountSetNo() { + return accountSetNo; + } + + public void setAccountSetNo(String accountSetNo) { + this.accountSetNo = accountSetNo; + } public String getSendStatus() { return sendStatus; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/in/stockindeatilback/domain/InStockinDetailBack.java b/ruoyi-admin/src/main/java/com/ruoyi/in/stockindeatilback/domain/InStockinDetailBack.java index 68990fe..233d1f3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/in/stockindeatilback/domain/InStockinDetailBack.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/in/stockindeatilback/domain/InStockinDetailBack.java @@ -152,6 +152,44 @@ public class InStockinDetailBack extends BaseEntity private String msg; + + private String sourceLineId; + private String barCode; + private String isBatchManage; + private String oldProjectNo; + + public String getSourceLineId() { + return sourceLineId; + } + + public void setSourceLineId(String sourceLineId) { + this.sourceLineId = sourceLineId; + } + + public String getBarCode() { + return barCode; + } + + public void setBarCode(String barCode) { + this.barCode = barCode; + } + + public String getIsBatchManage() { + return isBatchManage; + } + + public void setIsBatchManage(String isBatchManage) { + this.isBatchManage = isBatchManage; + } + + public String getOldProjectNo() { + return oldProjectNo; + } + + public void setOldProjectNo(String oldProjectNo) { + this.oldProjectNo = oldProjectNo; + } + public String getSendStatus() { return sendStatus; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/in/stockindeatilback/mapper/InStockinDetailBackMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/in/stockindeatilback/mapper/InStockinDetailBackMapper.java index ede4f51..9ddc0ac 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/in/stockindeatilback/mapper/InStockinDetailBackMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/in/stockindeatilback/mapper/InStockinDetailBackMapper.java @@ -4,6 +4,7 @@ import java.util.List; import com.ruoyi.in.stockin.domain.InStockin; import com.ruoyi.in.stockindeatilback.domain.InStockinDetailBack; +import org.apache.ibatis.annotations.Param; /** * 入库单据子信息Mapper接口 @@ -61,4 +62,8 @@ public interface InStockinDetailBackMapper * @return 结果 */ public int deleteInStockinDetailBackByStockinDetailIds(String[] stockinDetailIds); + + void insertInStockInDetailBackFinish(@Param("list") List inStockinDetailParam); + + void deleteInStockInDetailList(@Param("idList") List inStockinDetails); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/in/stockindeatilback/service/IInStockinDetailBackService.java b/ruoyi-admin/src/main/java/com/ruoyi/in/stockindeatilback/service/IInStockinDetailBackService.java index c511d79..9b1b1fb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/in/stockindeatilback/service/IInStockinDetailBackService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/in/stockindeatilback/service/IInStockinDetailBackService.java @@ -58,4 +58,8 @@ public interface IInStockinDetailBackService * @return 结果 */ public int deleteInStockinDetailBackByStockinDetailId(String stockinDetailId); + + void insertInStockInDetailBackFinish(List inStockinDetails); + + void deleteInStockInDetailList(List inStockinDetails); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/in/stockindeatilback/service/impl/InStockinDetailBackServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/in/stockindeatilback/service/impl/InStockinDetailBackServiceImpl.java index 0821f61..9ec707c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/in/stockindeatilback/service/impl/InStockinDetailBackServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/in/stockindeatilback/service/impl/InStockinDetailBackServiceImpl.java @@ -90,4 +90,14 @@ public class InStockinDetailBackServiceImpl implements IInStockinDetailBackServi { return inStockinDetailBackMapper.deleteInStockinDetailBackByStockinDetailId(stockinDetailId); } + + @Override + public void insertInStockInDetailBackFinish(List inStockinDetails) { + inStockinDetailBackMapper.insertInStockInDetailBackFinish(inStockinDetails); + } + + @Override + public void deleteInStockInDetailList(List inStockinDetails) { + inStockinDetailBackMapper.deleteInStockInDetailList(inStockinDetails); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/in/stockindetail/domain/InStockinDetail.java b/ruoyi-admin/src/main/java/com/ruoyi/in/stockindetail/domain/InStockinDetail.java index 2f00a9d..c6080e8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/in/stockindetail/domain/InStockinDetail.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/in/stockindetail/domain/InStockinDetail.java @@ -143,9 +143,13 @@ public class InStockinDetail extends BaseEntity private String status; private ExtraField extraField; + private String erpBill; private String warehouseName; private String warehouseId; - + private String sourceLineId; + private String barCode; + private String isBatchManage; + private String oldProjectNo; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/in/stockindetail/mapper/InStockinDetailMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/in/stockindetail/mapper/InStockinDetailMapper.java index baa5ba4..93bbedd 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/in/stockindetail/mapper/InStockinDetailMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/in/stockindetail/mapper/InStockinDetailMapper.java @@ -69,4 +69,6 @@ public interface InStockinDetailMapper void deleteInStockinDetailByStockinGuid(String stockinGuid); InStockinDetail selectStockinByDetailById(InStockinDetail inStockinDetail); + + List selectStockInByDetailByBarCode(String barCode); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/in/stockindetail/service/IInStockinDetailService.java b/ruoyi-admin/src/main/java/com/ruoyi/in/stockindetail/service/IInStockinDetailService.java index aef8ee6..075e964 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/in/stockindetail/service/IInStockinDetailService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/in/stockindetail/service/IInStockinDetailService.java @@ -81,4 +81,6 @@ public interface IInStockinDetailService public InStockinDetail selectStockinByDetailById(InStockinDetail inStockinDetail); + + List selectStockInByDetailByBarCode(String barCode); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/in/stockindetail/service/impl/InStockinDetailServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/in/stockindetail/service/impl/InStockinDetailServiceImpl.java index 1763b66..07d21a4 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/in/stockindetail/service/impl/InStockinDetailServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/in/stockindetail/service/impl/InStockinDetailServiceImpl.java @@ -127,4 +127,9 @@ public class InStockinDetailServiceImpl implements IInStockinDetailService return inStockinDetailMapper.selectStockinByDetailById(inStockinDetail); } + + @Override + public List selectStockInByDetailByBarCode(String barCode) { + return inStockinDetailMapper.selectStockInByDetailByBarCode(barCode); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/in/stockinfinish/domain/InStockinFinish.java b/ruoyi-admin/src/main/java/com/ruoyi/in/stockinfinish/domain/InStockinFinish.java index 340a94c..ef1507d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/in/stockinfinish/domain/InStockinFinish.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/in/stockinfinish/domain/InStockinFinish.java @@ -89,6 +89,15 @@ public class InStockinFinish extends BaseEntity /** 备用字段5 */ @Excel(name = "备用字段5") private String spare5; + private String stockinDetailId; + + public String getStockinDetailId() { + return stockinDetailId; + } + + public void setStockinDetailId(String stockinDetailId) { + this.stockinDetailId = stockinDetailId; + } public void setStockinGuid(String stockinGuid) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/in/stockinfinish/service/impl/InStockinFinishServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/in/stockinfinish/service/impl/InStockinFinishServiceImpl.java index ad28711..7277d7f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/in/stockinfinish/service/impl/InStockinFinishServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/in/stockinfinish/service/impl/InStockinFinishServiceImpl.java @@ -102,7 +102,7 @@ public class InStockinFinishServiceImpl implements IInStockinFinishService } @Override - @DataScope(warehouseAlias = "is2") +// @DataScope(warehouseAlias = "is2") public List selectInStockinFinishListByInStockin(InStockin inStockin) { return inStockinFinishMapper.selectInStockinFinishListByInStockin(inStockin); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/job/mydojob/domain/MydoJob.java b/ruoyi-admin/src/main/java/com/ruoyi/job/mydojob/domain/MydoJob.java index 8648241..8caa432 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/job/mydojob/domain/MydoJob.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/job/mydojob/domain/MydoJob.java @@ -124,6 +124,9 @@ public class MydoJob extends BaseEntity /** 重分标记 */ @Excel(name = "重分标记") private String faultFlag; + private String endPoint; + + private String inOut; @@ -133,6 +136,23 @@ public class MydoJob extends BaseEntity private String createRightTime; private String productId; + private String stockinDetailId; + + public String getEndPoint() { + return endPoint; + } + + public void setEndPoint(String endPoint) { + this.endPoint = endPoint; + } + + public String getStockinDetailId() { + return stockinDetailId; + } + + public void setStockinDetailId(String stockinDetailId) { + this.stockinDetailId = stockinDetailId; + } public String getProductId() { return productId; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/job/mydojob/mapper/MydoJobMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/job/mydojob/mapper/MydoJobMapper.java index d10a63f..d6be1f0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/job/mydojob/mapper/MydoJobMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/job/mydojob/mapper/MydoJobMapper.java @@ -82,5 +82,14 @@ public interface MydoJobMapper MydoJob selectInJobByTrayCode(@Param("trayCode") String trayCode); + MydoJob selectInJobByTaskNo(@Param("taskNo") String taskNo); + + void allotInJobSpace(HashMap map); + + void ykCompleted(HashMap map); + + void updateLed(HashMap map); + + void updateLedError(HashMap map); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/job/mydojob/service/IMydoJobService.java b/ruoyi-admin/src/main/java/com/ruoyi/job/mydojob/service/IMydoJobService.java index 7bc45ff..0f60062 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/job/mydojob/service/IMydoJobService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/job/mydojob/service/IMydoJobService.java @@ -109,4 +109,6 @@ public interface IMydoJobService MydoJob selectMydoJobByEntranceId(MydoJob mydoJob); List getInJobBySerial(String serial); + + void ykCompleted(MydoJob outJob); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/job/mydojob/service/impl/MydoJobServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/job/mydojob/service/impl/MydoJobServiceImpl.java index f801eb1..9dd3046 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/job/mydojob/service/impl/MydoJobServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/job/mydojob/service/impl/MydoJobServiceImpl.java @@ -192,7 +192,7 @@ public class MydoJobServiceImpl implements IMydoJobService { List mydoJobDetails = mydoJobDetailService.selectMydoJobDetailList(param); for (MydoJobDetail mydoJobDetail : mydoJobDetails) { - String inOrOutDId = mydoJobDetail.getInOrOutDId(); + String inOrOutDId = mydoJobDetail.getStockinDetailId(); InStockinDetail inStockinDetail = inStockinDetailService.selectInStockinDetailByStockinDetailId(inOrOutDId); BigDecimal stockInNum = Convert.toBigDecimal(inStockinDetail.getScanNum()); BigDecimal jobInNum = Convert.toBigDecimal(mydoJobDetail.getInQuantity()); @@ -506,7 +506,7 @@ public class MydoJobServiceImpl implements IMydoJobService { msg = map.get("v_resultmsg").toString(); builder.append("托盘:" + basStock.getTrayCode() + ",分配结果:" + msg + "
"); } - iToWcsService.pushOutMydoJob(); + //iToWcsService.pushOutMydoJob(); if (!StrUtil.isEmpty(builder)) { return AjaxResult.warn(builder.toString()); } @@ -527,4 +527,17 @@ public class MydoJobServiceImpl implements IMydoJobService { public List getInJobBySerial(String trayCode) { return mydoJobMapper.getInJobBySerial(trayCode); } + + @Override + public void ykCompleted(MydoJob outJob) { + HashMap map = new HashMap<>(); + map.put("v_job_id", outJob.getJobId()); + map.put("v_result", null); + mydoJobMapper.ykCompleted(map); + if (!"10".equals(map.get("v_result").toString())) { + log.error("移库任务处理异常 异常代码{}", map.get("v_result")); + }else{ + log.info("移库任务处理成功 jobId:[{}] trayCode:[{}]", outJob.getJobId(), outJob.getTrayCode()); + } + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/job/mydojobdetail/domain/PkDetail.java b/ruoyi-admin/src/main/java/com/ruoyi/job/mydojobdetail/domain/PkDetail.java new file mode 100644 index 0000000..e0faf1b --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/job/mydojobdetail/domain/PkDetail.java @@ -0,0 +1,27 @@ +package com.ruoyi.job.mydojobdetail.domain; + +import java.io.Serializable; + +public class PkDetail implements Serializable { + private String stockinDetailId; + private String quantity; + + + public String getStockinDetailId() { + return stockinDetailId; + } + + public void setStockinDetailId(String stockinDetailId) { + this.stockinDetailId = stockinDetailId; + } + + public String getQuantity() { + return quantity; + } + + public void setQuantity(String quantity) { + this.quantity = quantity; + } + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/log/controller/RequestLogController.java b/ruoyi-admin/src/main/java/com/ruoyi/log/controller/RequestLogController.java index 226575a..339e569 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/log/controller/RequestLogController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/log/controller/RequestLogController.java @@ -85,6 +85,34 @@ public class RequestLogController extends BaseController return toAjax(requestLogService.updateRequestLog(requestLog)); } + + + + + @GetMapping("/getMethod") + public AjaxResult getMethod() + { + List strings=requestLogService.getMethod(); + return AjaxResult.success(requestLogService.getMethod()); + } + + // 获取原系统 + @GetMapping("/getSource") + public AjaxResult getSource() + { + List strings=requestLogService.getSource(); + return AjaxResult.success(requestLogService.getSource()); + } + // 获取目标系统 + @GetMapping("/getTarget") + public AjaxResult getTarget() + { + List strings=requestLogService.getTarget(); + return AjaxResult.success(requestLogService.getTarget()); + } + + + /** * 删除接口记录 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/log/mapper/RequestLogMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/log/mapper/RequestLogMapper.java index ba0c60a..34d1da1 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/log/mapper/RequestLogMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/log/mapper/RequestLogMapper.java @@ -59,4 +59,10 @@ public interface RequestLogMapper * @return 结果 */ public int deleteRequestLogByRequestIds(Long[] requestIds); + + List getMethod(); + + List getSource(); + + List getTarget(); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/log/service/IRequestLogService.java b/ruoyi-admin/src/main/java/com/ruoyi/log/service/IRequestLogService.java index bda1022..1a40a4c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/log/service/IRequestLogService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/log/service/IRequestLogService.java @@ -69,6 +69,7 @@ public interface IRequestLogService * @return */ public RequestLog getRequestLog(String url, String param, String remark,String source,String target); + public RequestLog getRequestLog(String url, String param, String remark,String source,String target,String billType,String ciccid); /** * 接收接口记录 * @@ -77,4 +78,12 @@ public interface IRequestLogService * @return */ public RequestLog getRequestLog(String param, String remark, AjaxResult ajaxResult); + + public RequestLog getRequestLogERP(String param, String remark, AjaxResult ajaxResult); + + List getMethod(); + + List getSource(); + + List getTarget(); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/log/service/impl/RequestLogServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/log/service/impl/RequestLogServiceImpl.java index f605af0..7c91349 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/log/service/impl/RequestLogServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/log/service/impl/RequestLogServiceImpl.java @@ -3,6 +3,8 @@ package com.ruoyi.log.service.impl; import cn.hutool.core.convert.Convert; import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.net.URLEncodeUtil; +import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpUtil; import cn.hutool.json.JSONUtil; import com.ruoyi.common.core.domain.AjaxResult; @@ -122,8 +124,10 @@ public class RequestLogServiceImpl implements IRequestLogService requestLog.setRequestBody(param); requestLog.setRequestUrl(url); try { - String resStr = HttpUtil.post(url, param); +// String resStr = HttpRequest.post(url).contentType("application/x-www-from-urlencoded").timeout(2000).body(param).execute().body(); + String resStr = HttpUtil.post(url, param); + requestLog.setResponseBody(resStr); // 判断resStr的状态码,如果不是200抛出异常让catch捕获 if (!JSONUtil.isJsonObj(resStr)) { throw new RuntimeException("返回结果不是有效的JSON对象"); @@ -133,7 +137,6 @@ public class RequestLogServiceImpl implements IRequestLogService if (codeObj == null || !codeObj.toString().equals("200")) { throw new RuntimeException("请求失败,状态码: " + (codeObj != null ? codeObj.toString() : "null")); } - requestLog.setResponseBody(resStr); requestLog.setResponseTime(DateUtil.formatDateTime(new Date())); requestLog.setResponseStatus("1"); requestLog.setDuration(Convert.toStr(DateUtil.between(Convert.toDate(requestLog.getRequestTime()), Convert.toDate(requestLog.getResponseTime()), DateUnit.MS))); @@ -148,6 +151,53 @@ public class RequestLogServiceImpl implements IRequestLogService return requestLog; } + @Override + public RequestLog getRequestLog(String url, String param, String remark, String source, String target, String billType, String ciccid) { + String body = "datajson=" + param + + "&ibilltype=" + URLEncodeUtil.encodeAll(billType) + + "&cacc_id=" + URLEncodeUtil.encodeAll(ciccid); + + RequestLog requestLog = new RequestLog(); + requestLog.setRequestTime(DateUtil.formatDateTime(new Date())); + requestLog.setSourceSystem(source); + requestLog.setTargetSystem(target); + requestLog.setEndpoint(remark); + requestLog.setRequestMethod("post"); + requestLog.setRequestHeaders(null); + requestLog.setRequestBody(body); + requestLog.setRequestUrl(url); + try { + String resStr = HttpRequest.post(url) + .contentType("application/x-www-form-urlencoded;charset=UTF-8") + .body(body) + .execute().body(); + + requestLog.setResponseBody(resStr); + // 判断resStr的状态码,如果不是200抛出异常让catch捕获 + if (!JSONUtil.isJsonObj(resStr)) { + throw new RuntimeException("返回结果不是有效的JSON对象"); + } + cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(resStr); + Object codeObj = jsonObject.get("ErrCode"); + if (codeObj == null || !codeObj.toString().equals("0")) { + throw new RuntimeException("请求失败,状态码: " + (codeObj != null ? codeObj.toString() : "null")); + } + requestLog.setResponseTime(DateUtil.formatDateTime(new Date())); + requestLog.setResponseStatus("1"); + requestLog.setDuration(Convert.toStr(DateUtil.between(Convert.toDate(requestLog.getRequestTime()), Convert.toDate(requestLog.getResponseTime()), DateUnit.MS))); + requestLog.setIsSuccessful("1"); + } catch (Exception e) { + requestLog.setErrorDetails(e.getMessage()); + requestLog.setIsSuccessful("0"); + requestLog.setResponseStatus("0"); + } finally { + insertRequestLog(requestLog); + } + return requestLog; + } + + + /** * 插入请求日志 * @@ -173,4 +223,46 @@ public class RequestLogServiceImpl implements IRequestLogService requestLog.setResponseBody(Convert.toStr(ajaxResult.get("msg"))); return requestLog; } + + @Override + public RequestLog getRequestLogERP(String param, String remark, AjaxResult ajaxResult) { + RequestLog requestLog = new RequestLog(); + requestLog.setRequestTime(DateUtil.formatDateTime(new Date())); + requestLog.setRequestBody(param); + requestLog.setSourceSystem("erp"); + requestLog.setTargetSystem("wms"); + requestLog.setEndpoint(remark); + requestLog.setRequestMethod("post"); + requestLog.setResponseTime(DateUtil.formatDateTime(new Date())); + requestLog.setDuration(Convert.toStr(DateUtil.between(Convert.toDate(requestLog.getRequestTime()), Convert.toDate(requestLog.getResponseTime()), DateUnit.MS))); + requestLog.setResponseStatus("1"); + if (ajaxResult.isSuccess()){ + requestLog.setIsSuccessful("1"); + }else { + requestLog.setIsSuccessful("0"); + } + requestLog.setResponseBody(Convert.toStr(ajaxResult.get("msg"))); + return requestLog; + } + + @Override + public List getMethod() { + + return requestLogMapper.getMethod(); + } + + @Override + public List getSource() { + return requestLogMapper.getSource(); + } + + @Override + public List getTarget() { + return requestLogMapper.getTarget(); + } + + public static void main(String[] args) { + String aa = "{\"code\":\"200,\"success\":true,\"msg\":\"请求成功\"}"; + System.out.println(JSONUtil.isJsonObj(aa)); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/out/handAllotStock/controller/ViewHandAllotStockController.java b/ruoyi-admin/src/main/java/com/ruoyi/out/handAllotStock/controller/ViewHandAllotStockController.java index 1378ddb..471961e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/out/handAllotStock/controller/ViewHandAllotStockController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/out/handAllotStock/controller/ViewHandAllotStockController.java @@ -42,6 +42,9 @@ public class ViewHandAllotStockController extends BaseController public TableDataInfo list(ViewHandAllotStock viewHandAllotStock) { startPage(); + if (viewHandAllotStock.getWarehouseCode()==null||viewHandAllotStock.getWarehouseCode().equals("")){ + viewHandAllotStock.setWarehouseCode("1"); + } List list = viewHandAllotStockService.selectViewHandAllotStockList(viewHandAllotStock); return getDataTable(list); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/out/handAllotStock/domain/ViewHandAllotStock.java b/ruoyi-admin/src/main/java/com/ruoyi/out/handAllotStock/domain/ViewHandAllotStock.java index ede42a8..006e27f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/out/handAllotStock/domain/ViewHandAllotStock.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/out/handAllotStock/domain/ViewHandAllotStock.java @@ -4,6 +4,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.core.domain.BaseEntity; +import org.springframework.data.annotation.Transient; /** * 手动分配库存对象 view_hand_allot_stock @@ -187,7 +188,38 @@ public class ViewHandAllotStock extends BaseEntity @Excel(name = "货位锁") private String locked; - public void setStockId(String stockId) + @Transient + private String ktpType; + @Transient + private String productType; + @Transient + private String warehouseCode; + + public String getWarehouseCode() { + return warehouseCode; + } + + public void setWarehouseCode(String warehouseCode) { + this.warehouseCode = warehouseCode; + } + + public String getKtpType() { + return ktpType; + } + + public void setKtpType(String ktpType) { + this.ktpType = ktpType; + } + + public String getProductType() { + return productType; + } + + public void setProductType(String productType) { + this.productType = productType; + } + + public void setStockId(String stockId) { this.stockId = stockId; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/controller/OutStockoutController.java b/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/controller/OutStockoutController.java index e438e28..007188b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/controller/OutStockoutController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/controller/OutStockoutController.java @@ -35,7 +35,7 @@ public class OutStockoutController extends BaseController { /** * 查询出库主单列表 */ - @PreAuthorize("@ss.hasPermi('out:outStockout:list')") +// @PreAuthorize("@ss.hasPermi('out:outStockout:list')") @GetMapping("/list") public TableDataInfo list(OutStockout outStockout) { startPage(); @@ -51,7 +51,7 @@ public class OutStockoutController extends BaseController { /** * 导出出库主单列表 */ - @PreAuthorize("@ss.hasPermi('out:outStockout:export')") +// @PreAuthorize("@ss.hasPermi('out:outStockout:export')") @Log(title = "出库主单", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, OutStockout outStockout) { @@ -63,7 +63,7 @@ public class OutStockoutController extends BaseController { /** * 获取出库主单详细信息 */ - @PreAuthorize("@ss.hasPermi('out:outStockout:query')") +// @PreAuthorize("@ss.hasPermi('out:outStockout:query')") @GetMapping(value = "/{stockoutGuid}") public AjaxResult getInfo(@PathVariable("stockoutGuid") String stockoutGuid) { return success(outStockoutService.selectOutStockoutByStockoutGuid(stockoutGuid)); @@ -72,7 +72,7 @@ public class OutStockoutController extends BaseController { /** * 新增出库主单 */ - @PreAuthorize("@ss.hasPermi('out:outStockout:add')") +// @PreAuthorize("@ss.hasPermi('out:outStockout:add')") @Log(title = "出库主单", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody OutStockout outStockout) { @@ -82,7 +82,7 @@ public class OutStockoutController extends BaseController { /** * 修改出库主单 */ - @PreAuthorize("@ss.hasPermi('out:outStockout:edit')") +// @PreAuthorize("@ss.hasPermi('out:outStockout:edit')") @Log(title = "出库主单", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody OutStockout outStockout) { @@ -92,7 +92,7 @@ public class OutStockoutController extends BaseController { /** * 删除出库主单 */ - @PreAuthorize("@ss.hasPermi('out:outStockout:remove')") +// @PreAuthorize("@ss.hasPermi('out:outStockout:remove')") @Log(title = "出库主单", businessType = BusinessType.DELETE) @DeleteMapping("/{stockoutGuids}") public AjaxResult remove(@PathVariable String[] stockoutGuids) { @@ -107,7 +107,7 @@ public class OutStockoutController extends BaseController { */ @Log(title = "出库主单保存", businessType = BusinessType.OTHER) @PostMapping("/saveBill") - @PreAuthorize("@ss.hasPermi('out:outStockout:saveBill')") +// @PreAuthorize("@ss.hasPermi('out:outStockout:saveBill')") @ResponseBody public AjaxResult saveBill(@RequestBody OutStockoutVo outStockoutVo) { String stockOutId = outStockoutService.saveBill(outStockoutVo); @@ -117,7 +117,7 @@ public class OutStockoutController extends BaseController { /** * 出库单据状态改变 */ - @PreAuthorize("@ss.hasPermi('out:outStockout:changeStatus')") +// @PreAuthorize("@ss.hasPermi('out:outStockout:changeStatus')") @Log(title = "出库主单状态改变", businessType = BusinessType.OTHER) @RequestMapping("/changeStatus") @ResponseBody @@ -132,17 +132,24 @@ public class OutStockoutController extends BaseController { * @param stockoutId * @return */ - @PreAuthorize("@ss.hasPermi('out:outStockout:autoAllot')") +// @PreAuthorize("@ss.hasPermi('out:outStockout:autoAllot')") @Log(title = "出库单自动分配", businessType = BusinessType.OTHER) @GetMapping("/autoAllot") public AjaxResult autoAllot(@RequestParam("stockoutId") String stockoutId) { + // 修改出库方向 +// OutStockout outStockout = new OutStockout(); +// outStockout.setStockoutId(stockoutId); +// outStockout.setSpare8(spare8); +// outStockoutService.updateOutStockout(outStockout); + System.out.println(stockoutId); +// System.out.println(spare8); return outStockoutService.autoAllot(stockoutId); } /** * 手动分配 */ - @PreAuthorize("@ss.hasPermi('out:outStockout:manualAllot')") +// @PreAuthorize("@ss.hasPermi('out:outStockout:manualAllot')") @Log(title = "出库单手动分配", businessType = BusinessType.OTHER) @GetMapping("/manualAllot") public AjaxResult manualAllot(@RequestParam("stockList") String[] stockList, @RequestParam("stockoutDetailId") String stockoutDetailId) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/domain/OutStockout.java b/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/domain/OutStockout.java index 8403648..ae75547 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/domain/OutStockout.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/domain/OutStockout.java @@ -91,6 +91,9 @@ public class OutStockout extends BaseEntity private String spare4; private String spare5; + private String spare6; + private String spare7; + private String spare8; private String customerName; @@ -99,9 +102,51 @@ public class OutStockout extends BaseEntity private String productId; private String productName; + private String companyShortName; + private String accountSetNo; + + public String getCompanyShortName() { + return companyShortName; + } + + public void setCompanyShortName(String companyShortName) { + this.companyShortName = companyShortName; + } + + public String getAccountSetNo() { + return accountSetNo; + } + + public void setAccountSetNo(String accountSetNo) { + this.accountSetNo = accountSetNo; + } private List typeData; + public String getSpare6() { + return spare6; + } + + public void setSpare6(String spare6) { + this.spare6 = spare6; + } + + public String getSpare7() { + return spare7; + } + + public void setSpare7(String spare7) { + this.spare7 = spare7; + } + + public String getSpare8() { + return spare8; + } + + public void setSpare8(String spare8) { + this.spare8 = spare8; + } + public List getTypeData() { return typeData; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/mapper/OutStockoutMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/mapper/OutStockoutMapper.java index c5c4496..451f337 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/mapper/OutStockoutMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/mapper/OutStockoutMapper.java @@ -68,4 +68,6 @@ public interface OutStockoutMapper OutStockout selectOutStockoutByStockoutId(String stockoutId); void manualAllot(HashMap map); + + void updateOutStockouts(OutStockout mainOut); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/service/IOutStockoutService.java b/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/service/IOutStockoutService.java index 94b2787..0a97a3f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/service/IOutStockoutService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/service/IOutStockoutService.java @@ -73,4 +73,6 @@ public interface IOutStockoutService List selectOutStockoutListApi(OutStockout outStockoutParam); AjaxResult manualAllot(String[] stockList,String stockoutDetailId); + + void updateOutStockouts(OutStockout mainOut); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/service/impl/OutStockoutServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/service/impl/OutStockoutServiceImpl.java index 02f0c1f..8033931 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/service/impl/OutStockoutServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/service/impl/OutStockoutServiceImpl.java @@ -180,10 +180,11 @@ public class OutStockoutServiceImpl implements IOutStockoutService for (OutStockoutDetail detail : outStockoutDetails) { if (detail.getAllotQuantity().compareTo(detail.getQuantity()) < 0){ map.put("v_stockout_detail_id", detail.getStockoutDetailId()); + map.put("v_result", null); + map.put("v_resultmsg", null); outStockoutMapper.autoAllot(map); - toWcsService.pushOutMydoJob(); if (!"10".equals(map.get("v_result"))){ - stringBuilder.append(",").append(detail.getStockoutDetailId()+map.get("v_resultString")); + stringBuilder.append(",").append(detail.getStockoutDetailId()+map.get("v_resultmsg")); } }else{ stringBuilder.append(",").append(detail.getStockoutDetailId()+"单据已分配完成"); @@ -209,7 +210,7 @@ public class OutStockoutServiceImpl implements IOutStockoutService map.put("v_stockout_detail_id", stockoutDetailId); map.put("v_stock_id", stock); outStockoutMapper.manualAllot(map); - toWcsService.pushOutMydoJob(); + //toWcsService.pushOutMydoJob(); if (!"10".equals(map.get("v_result"))){ stringBuilder.append(",").append(stockoutDetailId+map.get("v_resultString")); } @@ -219,4 +220,9 @@ public class OutStockoutServiceImpl implements IOutStockoutService } return AjaxResult.success(); } + + @Override + public void updateOutStockouts(OutStockout mainOut) { + outStockoutMapper.updateOutStockouts(mainOut); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/out/outStockoutDetail/domain/OutStockoutDetail.java b/ruoyi-admin/src/main/java/com/ruoyi/out/outStockoutDetail/domain/OutStockoutDetail.java index 4027dd2..a67c485 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/out/outStockoutDetail/domain/OutStockoutDetail.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/out/outStockoutDetail/domain/OutStockoutDetail.java @@ -48,7 +48,7 @@ public class OutStockoutDetail extends BaseEntity /** 计划数量(箱) */ @Excel(name = "计划数量", readConverterExp = "箱=") - private BigDecimal quantityX; + private String quantityX; /** 计划数量(件) */ @Excel(name = "计划数量", readConverterExp = "件=") @@ -200,6 +200,42 @@ public class OutStockoutDetail extends BaseEntity private String spare9; + private String sourceLineId; + private String barCode; + private String isBatchManage; + private String oldProjectNo; + + public String getSourceLineId() { + return sourceLineId; + } + + public void setSourceLineId(String sourceLineId) { + this.sourceLineId = sourceLineId; + } + + public String getBarCode() { + return barCode; + } + + public void setBarCode(String barCode) { + this.barCode = barCode; + } + + public String getIsBatchManage() { + return isBatchManage; + } + + public void setIsBatchManage(String isBatchManage) { + this.isBatchManage = isBatchManage; + } + + public String getOldProjectNo() { + return oldProjectNo; + } + + public void setOldProjectNo(String oldProjectNo) { + this.oldProjectNo = oldProjectNo; + } public String getSpare1() { return spare1; @@ -407,14 +443,12 @@ public class OutStockoutDetail extends BaseEntity return quantity; } - public void setQuantityX(BigDecimal quantityX) - { - this.quantityX = quantityX; + public String getQuantityX() { + return quantityX; } - public BigDecimal getQuantityX() - { - return quantityX; + public void setQuantityX(String quantityX) { + this.quantityX = quantityX; } public void setQuantityJ(BigDecimal quantityJ) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/out/productAndStock/controller/ViewProductAndStockController.java b/ruoyi-admin/src/main/java/com/ruoyi/out/productAndStock/controller/ViewProductAndStockController.java index e536960..90f41d4 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/out/productAndStock/controller/ViewProductAndStockController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/out/productAndStock/controller/ViewProductAndStockController.java @@ -35,7 +35,7 @@ public class ViewProductAndStockController extends BaseController private IViewProductAndStockService viewProductAndStockService; /** - * 查询库存物资列表 +// * 查询库存物资列表 */ @PreAuthorize("@ss.hasPermi('productAndStock:productAndStock:list')") @GetMapping("/list") diff --git a/ruoyi-admin/src/main/java/com/ruoyi/pda/controller/PdaController.java b/ruoyi-admin/src/main/java/com/ruoyi/pda/controller/PdaController.java index 2c2cb57..21167df 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/pda/controller/PdaController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/pda/controller/PdaController.java @@ -2,26 +2,42 @@ package com.ruoyi.pda.controller; import com.ruoyi.api.domain.RequestEnter; import com.ruoyi.api.domain.WcsPort; +import com.ruoyi.bas.agvPoint.domain.AgvPoint; +import com.ruoyi.bas.agvPoint.domain.AgvTask; +import com.ruoyi.bas.agvPoint.service.impl.AgvPointServiceImpl; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.device.agv.domain.AgvContainerTask; +import com.ruoyi.device.agv.service.IAgvContainerTaskService; import com.ruoyi.in.stockindetail.domain.InStockinDetail; import com.ruoyi.in.stockindetail.service.IInStockinDetailService; +import com.ruoyi.job.mydojob.domain.MydoJob; +import com.ruoyi.job.mydojob.service.IMydoJobService; +import com.ruoyi.job.mydojobdetail.domain.MydoJobDetail; +import com.ruoyi.out.outStockout.domain.OutStockout; +import com.ruoyi.out.outStockout.service.impl.OutStockoutServiceImpl; +import com.ruoyi.out.outStockoutDetail.domain.OutStockoutDetail; +import com.ruoyi.out.outStockoutDetail.service.impl.OutStockoutDetailServiceImpl; import com.ruoyi.pda.domain.TrayCodeMakeSure; import com.ruoyi.pda.domain.TrayCodeMsg; +import com.ruoyi.pda.mapper.PdaMapper; import com.ruoyi.pda.service.PdaService; import com.ruoyi.stock.stock.domain.BasStock; +import com.ruoyi.stock.stock.service.IBasStockService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; +import java.util.HashMap; import java.util.List; +import java.util.UUID; @Controller @RequestMapping("/pda") @@ -32,6 +48,20 @@ public class PdaController extends BaseController { private PdaService pdaService; @Autowired private IInStockinDetailService iInStockinDetailService; + @Autowired + private OutStockoutServiceImpl outStockoutService; + @Autowired + private OutStockoutDetailServiceImpl outStockoutDetailService; + @Autowired + private AgvPointServiceImpl agvPointService; + @Autowired + private IAgvContainerTaskService agvContainerTaskService; + @Autowired + private PdaMapper pdaMapper; + @Autowired + private IMydoJobService mydoJobService; + @Autowired + private IBasStockService basStockService; /** * 查询是否有半满托盘 @@ -46,11 +76,11 @@ public class PdaController extends BaseController { /** * 通过单据码查询物料详情 */ - @RequestMapping("/selectDetailById") + @RequestMapping("/selectDetailByIds") @ResponseBody - public AjaxResult selectDetailById(String inStockinDetailId) { + public AjaxResult selectDetailByIds(String inStockinDetailId) { InStockinDetail inStockinDetail = iInStockinDetailService.selectInStockinDetailByStockinDetailId(inStockinDetailId); - if(inStockinDetail != null) { + if (inStockinDetail != null) { inStockinDetail.setQuantity(String.valueOf(Integer.valueOf(inStockinDetail.getQuantity()) - Integer.valueOf(inStockinDetail.getScanNum()))); } return AjaxResult.success(inStockinDetail); @@ -67,6 +97,22 @@ public class PdaController extends BaseController { } + /** + * 通过单据码查询物料详情 TODO 修改单据码为barCode 前端需同步修改 + */ + @RequestMapping("/selectDetailById") + @ResponseBody + public AjaxResult selectDetailById(String barCode) { + List stockinDetails = iInStockinDetailService.selectStockInByDetailByBarCode(barCode); + stockinDetails.stream().forEach(inStockinDetail -> { + Integer quantity = StringUtils.hasText(inStockinDetail.getQuantity()) ? Integer.valueOf(inStockinDetail.getQuantity()) : 0; + Integer scanNum = StringUtils.hasText(inStockinDetail.getScanNum()) ? Integer.valueOf(inStockinDetail.getScanNum()) : 0; + inStockinDetail.setQuantity(String.valueOf(quantity - scanNum)); + }); + return AjaxResult.success(stockinDetails); + } + + /** * 通过托盘码查询作业或trayMsg */ @@ -85,13 +131,20 @@ public class PdaController extends BaseController { return pdaService.bindTray(trayCodeMakeSure); } + @RequestMapping("/bindTray2") + @ResponseBody + public AjaxResult bindTray2(@RequestBody TrayCodeMakeSure trayCodeMakeSure) { + return pdaService.bindTray2(trayCodeMakeSure); + } + + /** * 空托盘入库 */ @RequestMapping("/tpIn") @ResponseBody public AjaxResult tpIn(@RequestBody TrayCodeMsg trayCodeMsg) { - return pdaService.tpIn(trayCodeMsg.getTrayCode()); + return pdaService.tpIn(trayCodeMsg); } /** @@ -105,12 +158,13 @@ public class PdaController extends BaseController { /** * 出库确认查询子作业信息 + * * @param trayCodeMsg * @return */ @RequestMapping("/selectJobDetailByTray") @ResponseBody - public AjaxResult selectJobDetailByTray(@RequestBody TrayCodeMsg trayCodeMsg){ + public AjaxResult selectJobDetailByTray(@RequestBody TrayCodeMsg trayCodeMsg) { return pdaService.selectJobDetailByTray(trayCodeMsg); } @@ -129,9 +183,6 @@ public class PdaController extends BaseController { } - - - /** * 入库扫码生成作业 */ @@ -142,7 +193,6 @@ public class PdaController extends BaseController { } - @RequestMapping("/selectDetailByPDTray") @ResponseBody public AjaxResult selectDetailByPDTray(@RequestBody TrayCodeMakeSure trayCodeMakeSure) { @@ -150,9 +200,6 @@ public class PdaController extends BaseController { } - - - /** * 盘点出库确认 * @@ -161,7 +208,7 @@ public class PdaController extends BaseController { */ @PreAuthorize("@ss.hasPermi('pda:check:checkMakeSure')") @PostMapping("/checkMakeSure") - @Log(title = "手持机盘点出库确认", businessType = BusinessType.INSERT) + @Log(title = "手持机盘点出库确认", businessType = BusinessType.OTHER) @ResponseBody public AjaxResult checkMakeSure(@RequestBody TrayCodeMakeSure trayCodeMakeSure) { return pdaService.checkMakeSure(trayCodeMakeSure); @@ -179,6 +226,245 @@ public class PdaController extends BaseController { return pdaService.updateWcsPort(wcsPort); } + @RequestMapping("/hcoutMakesure") + @ResponseBody + @Log(title = "手持机缓存出库确认", businessType = BusinessType.OTHER) + public AjaxResult hcoutMakesure(String trayCode) { + + return pdaService.hcoutMakesure(trayCode); + } + + + /** + * 平库入库 + */ + @RequestMapping("/inStockPk") + @ResponseBody + public AjaxResult inStockPk(@RequestBody TrayCodeMakeSure trayCodeMakeSure) { + return pdaService.completeInPk(trayCodeMakeSure); + } + + /** + * 库存查询(平库扫码查询托盘入库信息) + */ + @RequestMapping("/searchStock") + @ResponseBody + public AjaxResult searchStock(@RequestBody TrayCodeMakeSure trayCodeMakeSure) { + + return pdaService.selectBasStockHc(trayCodeMakeSure.getTrayCode()); + } + + /** + * 立库出库信息校验 + * + * @param trayCodeMakeSure + * @return + */ + @RequestMapping("/verifyMaterial") + @ResponseBody + public AjaxResult verifyMaterial(@RequestBody TrayCodeMakeSure trayCodeMakeSure) { + String trayCode = trayCodeMakeSure.getTrayCode(); + List mydoJobDetailList = trayCodeMakeSure.getMydoJobDetailList(); + for (MydoJobDetail m : mydoJobDetailList) { + Integer count = pdaService.selectByTrayCodeAndProduct(trayCode, m.getProductId()); + if (count == 0) { + return AjaxResult.error(m.getProductId() + ",物料不是出库物料"); + } + } + + return AjaxResult.success(); + } + + /** + * 平库出库确认 + * + * @param trayCodeMakeSure + * @return + */ + @RequestMapping("/completeOutPk") + @ResponseBody + @Async + @Transactional(rollbackFor = Exception.class) + public AjaxResult completeOutPk(@RequestBody TrayCodeMakeSure trayCodeMakeSure) { + try { + String trayCode = trayCodeMakeSure.getTrayCode(); + List mydoJobDetailList = trayCodeMakeSure.getMydoJobDetailList(); + for (MydoJobDetail m : mydoJobDetailList) { + HashMap map = new HashMap<>(); + map.put("v_tray_code", trayCode); + map.put("v_out_stockout_detail_id", trayCodeMakeSure.getStockoutDetailId()); + map.put("v_quantity", m.getOutQuantity()); + map.put("v_stock_id", m.getStockId()); + pdaService.completeOutPk(map); + Integer vResult = (Integer) map.get("v_result"); + if (vResult != 10) { + System.err.println(map.get("v_result_msg").toString()); + return AjaxResult.error(map.get("v_result_msg").toString()); + } + } + return AjaxResult.success(); + } catch (Exception e) { + throw new RuntimeException(e.getMessage()); + } + } + + + /** + * 查询平库出库主单 建议参数(erpStockOutId U8单据号作为查询条件传到后台) + * + * @param outStockout + * @return + */ + @RequestMapping("/OutFillPk") + @ResponseBody + + public AjaxResult OutFillPk() { + OutStockout outStockout = new OutStockout(); + outStockout.setWarehouseId("2"); + outStockoutService.selectOutStockoutList(outStockout); + return AjaxResult.success(outStockoutService.selectOutStockoutList(outStockout)); + } + + + /** + * 查出平库出库子单 参数: stockoutId 作为参数传递到后台 + * + * @param outStockout + * @return + */ + @RequestMapping("/OutFillPkDetail") + @ResponseBody + public AjaxResult OutFillPkDetail(@RequestBody OutStockout outStockout) { + + List outStockouts = outStockoutService.selectOutStockoutList(outStockout); + + return AjaxResult.success(outStockoutDetailService.selectOutStockoutDetailByStockoutGuid(outStockouts.get(0).getStockoutGuid())); + } + + + /** + * 查询平库出库子单对应信息 在平库中是否存在 + * 参数:trayCode 托盘码 + * 参数:stockinDetailId 子单据号 + * + * @param trayCodeMsg + * @return + */ + @RequestMapping("/queryBasStockHc") + @ResponseBody + public AjaxResult queryBasStockHc(@RequestBody TrayCodeMsg trayCodeMsg) { + return pdaService.selectBasStockHcs(trayCodeMsg.getTrayCode(), trayCodeMsg.getStockoutDetailId()); + } + + // 立库扫码规则校验 + @RequestMapping("/validateMaterial") + @ResponseBody + public AjaxResult validateMaterial(@RequestBody TrayCodeMakeSure trayCodeMakeSure) { + HashMap map = new HashMap<>(); + map.put("v_tray_code", trayCodeMakeSure.getTrayCode()); + map.put("v_stockin_detail_id", trayCodeMakeSure.getInStockinDetailId()); + map.put("v_is_bound_accord", trayCodeMakeSure.getIsBoundByAccord()); + map.put("v_quantity", trayCodeMakeSure.getQuantity()); + pdaMapper.bindTray(map); + if (!"10".equals(map.get("v_result").toString())) { + return AjaxResult.error(map.get("v_result").toString()); + } else { + return AjaxResult.success(map.get("v_result").toString()); + } + } + + + /** + * 平库出库信息校验 + * + * @param trayCodeMakeSure TODO 要校验项目号,批号,以及其他条件,要复合查询,待修改 + * @return + */ + @RequestMapping("/verifypkTrayMaterials") + @ResponseBody + public AjaxResult verifypkTrayMaterials(@RequestBody TrayCodeMakeSure trayCodeMakeSure) { + String trayCode = trayCodeMakeSure.getTrayCode(); + List mydoJobDetailList = trayCodeMakeSure.getMydoJobDetailList(); + for (MydoJobDetail m : mydoJobDetailList) { + String productId = m.getProductId(); + Integer integer = pdaService.selectBasStockHcCount(trayCode, productId); + if (integer == 0) { + return AjaxResult.error(m.getProductId() + ",物料不是出库物料"); + } + } + return AjaxResult.success(); + } + + + // 查询AGV的起点和终点 + @RequestMapping("/selectAgvPointByType") + @ResponseBody + public AjaxResult selectAgvPointByType(String type) { + AgvPoint agvPoint = new AgvPoint(); + agvPoint.setType(type); + List agvPoints = agvPointService.selectAgvPointList(agvPoint); + return AjaxResult.success(agvPoints); + } + + // 保存agv执行队列 + @RequestMapping("/insertAgvJob") + @ResponseBody + public AjaxResult insertAgvJob(@RequestBody AgvTask agvTask) { + AgvPoint agvPoint = new AgvPoint(); + agvPoint.setStation(agvTask.getEndPoint()); + List agvPoints = agvPointService.selectAgvPointList(agvPoint); + if (!agvPoints.get(0).getStation().equals("K1-1") && !agvPoints.get(0).getStation().equals("K2-1") && agvPoints.get(0).getSpare1().equals("2")) { + return AjaxResult.error("该点位被占用,请检查!"); + } + AgvContainerTask agvContainerTask = new AgvContainerTask(); + agvContainerTask.setContainer(UUID.randomUUID().toString()); + agvContainerTask.setEndPoint(agvTask.getEndPoint()); + agvContainerTask.setStartPoint(agvTask.getStartPoint()); + agvContainerTask.setSpare1(agvTask.getType()); + agvContainerTask.setSpare2(agvTask.getTrayCode()); + agvContainerTask.setStatus("0"); + agvContainerTaskService.insertAgvContainerTask(agvContainerTask); + return AjaxResult.success(); + } + + + // 保存agv执行队列 + @GetMapping("/selectAgvPointByType") + @ResponseBody + public AjaxResult selectAgvPointByType(String type, String position) { + System.out.println(type + " " + position); + AgvPoint agvPoint = new AgvPoint(); +// agvPoint.setType(type); + agvPoint.setStation(position); + List agvPoints = agvPointService.selectAgvPointList(agvPoint); + + + return AjaxResult.success(agvPoints); + } + + +// // 查询子单据的明细信息 +// @RequestMapping("/selectDetailById") +// public AjaxResult selectDetailById(@RequestBody TrayCodeMakeSure trayCodeMakeSure) { +// String inStockinDetailId = trayCodeMakeSure.getInStockinDetailId(); +// InStockinDetail inStockinDetail = iInStockinDetailService.selectInStockinDetailByStockinDetailId(inStockinDetailId); +// return AjaxResult.success(inStockinDetail); +// +// } + + @RequestMapping("/selectByTrayCode") + public AjaxResult selectByTrayCode(@RequestBody TrayCodeMakeSure trayCodeMakeSure) { + MydoJob mydoJob = mydoJobService.selectMydoJobByTrayCode(trayCodeMakeSure.getTrayCode()); + if (mydoJob != null && mydoJob.getInOrOut().equals("26")) { + BasStock basStock = basStockService.selectBasStockListTopOne(trayCodeMakeSure.getTrayCode()); + return AjaxResult.success(basStock); + } else { + return AjaxResult.error("该托盘无盘任务"); + } + + + } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/pda/domain/TrayCodeMakeSure.java b/ruoyi-admin/src/main/java/com/ruoyi/pda/domain/TrayCodeMakeSure.java index 3e30ebe..a31483d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/pda/domain/TrayCodeMakeSure.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/pda/domain/TrayCodeMakeSure.java @@ -1,6 +1,7 @@ package com.ruoyi.pda.domain; import com.ruoyi.job.mydojobdetail.domain.MydoJobDetail; +import com.ruoyi.job.mydojobdetail.domain.PkDetail; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -22,10 +23,18 @@ public class TrayCodeMakeSure { private String exitId; private String isFull; + // 选中传1 没选中传0 + private String isBoundByAccord; //拣选详情列表 private List mydoJobDetailList; //盘点详情列表 private List materials; //异常详情列表 private List materialDetails; + private List pkDetailList; + private String quantity; + private String stockinDetailId; + private String inStockinDetailId; + private String stockoutDetailId; + private String cargoSpaceId; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/pda/domain/TrayCodeMsg.java b/ruoyi-admin/src/main/java/com/ruoyi/pda/domain/TrayCodeMsg.java index ef453f3..71cb587 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/pda/domain/TrayCodeMsg.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/pda/domain/TrayCodeMsg.java @@ -1,5 +1,7 @@ package com.ruoyi.pda.domain; +import java.util.List; + public class TrayCodeMsg { private String trayCode; @@ -18,6 +20,26 @@ private String stockinDetailId; private String inOut; private String status; +private String stockoutDetailId; + + + public String getStockoutDetailId() { + return stockoutDetailId; + } + + public void setStockoutDetailId(String stockoutDetailId) { + this.stockoutDetailId = stockoutDetailId; + } + + private String trayType; + + public String getTrayType() { + return trayType; + } + + public void setTrayType(String trayType) { + this.trayType = trayType; + } public String getStatus() { return status; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/pda/mapper/PdaMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/pda/mapper/PdaMapper.java index 64290a8..4721310 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/pda/mapper/PdaMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/pda/mapper/PdaMapper.java @@ -38,4 +38,18 @@ public interface PdaMapper { void pkOut(HashMap map); void outMakeSureException(HashMap map); + + void hcoutMakesure(HashMap map); + + Integer selectByTrayCodeAndProduct(String trayCode, String productId); + + void completeOutPk(HashMap map); + + void completeInPk(HashMap map); + + void FillFinishAllot(HashMap map); + + void FillFinishAllotOut(HashMap map); + + void bindTrayCheck(HashMap map); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/pda/service/PdaService.java b/ruoyi-admin/src/main/java/com/ruoyi/pda/service/PdaService.java index 767242a..2b29890 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/pda/service/PdaService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/pda/service/PdaService.java @@ -8,6 +8,7 @@ import com.ruoyi.pda.domain.TrayCodeMakeSure; import com.ruoyi.pda.domain.TrayCodeMsg; import com.ruoyi.stock.stock.domain.BasStock; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; @@ -28,7 +29,7 @@ public interface PdaService { AjaxResult bindTray(TrayCodeMakeSure trayCodeMakeSure); - AjaxResult tpIn(String trayCode); + AjaxResult tpIn(TrayCodeMsg trayCodeMsg); AjaxResult tpOut(TrayCodeMsg trayCodeMsg); @@ -56,4 +57,19 @@ public interface PdaService { AjaxResult updateWcsPort(WcsPort wcsport); + AjaxResult hcoutMakesure(String trayCode); + + AjaxResult completeInPk(TrayCodeMakeSure trayCodeMakeSure); + + AjaxResult selectBasStockHc(String trayCode); + + Integer selectByTrayCodeAndProduct(String trayCode, String productId); + + void completeOutPk(HashMap map); + + Integer selectBasStockHcCount(String trayCode, String productId); + + AjaxResult selectBasStockHcs(String trayCode, String stockoutDetailId); + + AjaxResult bindTray2(TrayCodeMakeSure trayCodeMakeSure); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/pda/service/PdaServiceImp.java b/ruoyi-admin/src/main/java/com/ruoyi/pda/service/PdaServiceImp.java index ba4607b..6442007 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/pda/service/PdaServiceImp.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/pda/service/PdaServiceImp.java @@ -9,17 +9,19 @@ import com.ruoyi.api.service.IToWmsService; import com.ruoyi.check.commit.domain.CheckCommitRecord; import com.ruoyi.check.commit.service.ICheckCommitRecordService; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.MessageUtils; -import com.ruoyi.in.stockin.domain.InStockin; import com.ruoyi.in.stockin.service.IInStockinService; import com.ruoyi.in.stockindetail.domain.InStockinDetail; import com.ruoyi.in.stockindetail.service.IInStockinDetailService; import com.ruoyi.job.mydojob.domain.MydoJob; import com.ruoyi.job.mydojob.service.IMydoJobService; import com.ruoyi.job.mydojobdetail.domain.MydoJobDetail; +import com.ruoyi.job.mydojobdetail.domain.PkDetail; import com.ruoyi.job.mydojobdetail.service.IMydoJobDetailService; -import com.ruoyi.job.mydojobdetail.service.impl.MydoJobDetailServiceImpl; +import com.ruoyi.out.outStockoutDetail.domain.OutStockoutDetail; +import com.ruoyi.out.outStockoutDetail.service.impl.OutStockoutDetailServiceImpl; import com.ruoyi.pda.domain.TrayCodeMakeSure; import com.ruoyi.pda.domain.TrayCodeMsg; import com.ruoyi.pda.mapper.PdaMapper; @@ -34,6 +36,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.*; +import java.util.stream.Collectors; @Service @Slf4j @@ -60,13 +63,14 @@ public class PdaServiceImp implements PdaService { private BasStockMapper basStockMapper; @Autowired private IInStockinService inStockinService; - + @Autowired + private OutStockoutDetailServiceImpl outStockoutDetailService; @Override public List selectHasHalfTray(String inStockinDetailId) { InStockinDetail inStockinDetail = inStockinDetailService.selectInStockinDetailByStockinDetailId(inStockinDetailId); - InStockin inStockin = inStockinService.selectInStockinByStockinId(inStockinDetail.getStockinId()); - inStockinDetail.setSpare4(inStockin.getDepartmentNo()); +// InStockin inStockin = inStockinService.selectInStockinByStockinId(inStockinDetail.getStockinId()); +// inStockinDetail.setSpare4(inStockinDetail.getSpare4()); List hasHalfTray = basStockMapper.selectHasHalfTray(inStockinDetail); return hasHalfTray; } @@ -75,16 +79,16 @@ public class PdaServiceImp implements PdaService { @Override public AjaxResult halfTrayOut(TrayCodeMsg trayCodeMsg) { InStockinDetail inStockinDetail = inStockinDetailService.selectInStockinDetailByStockinDetailId(trayCodeMsg.getStockinDetailId()); - InStockin inStockin = inStockinService.selectInStockinByStockinId(inStockinDetail.getStockinId()); - inStockinDetail.setSpare4(inStockin.getDepartmentNo()); +// InStockin inStockin = inStockinService.selectInStockinByStockinId(inStockinDetail.getStockinId()); +// inStockinDetail.setSpare4(inStockin.getDepartmentNo()); List hasHalfTray = basStockMapper.selectHasHalfTray(inStockinDetail); HashMap map = new HashMap<>(); map.put("v_tray_code", hasHalfTray.get(0).getTrayCode()); - map.put("v_exit_id",trayCodeMsg.getExitId()); + map.put("v_exit_id", trayCodeMsg.getExitId()); pdaMapper.halfTrayOut(map); - if(!"10".equals(map.get("v_result").toString())){ + if (!"10".equals(map.get("v_result").toString())) { return AjaxResult.error(map.get("v_resultmsg").toString()); - }else{ + } else { return AjaxResult.success(); } @@ -112,21 +116,18 @@ public class PdaServiceImp implements PdaService { @Transactional(rollbackFor = Exception.class) public AjaxResult bindTray(TrayCodeMakeSure trayCodeMakeSure) { StringBuilder errorbulider = new StringBuilder(); - - for (MydoJobDetail mydoJobDetail : trayCodeMakeSure.getMydoJobDetailList()) { HashMap map = new HashMap<>(); map.put("v_tray_code", trayCodeMakeSure.getTrayCode()); map.put("v_stockin_detail_id", mydoJobDetail.getStockinDetailId()); + map.put("v_is_bound_accord", trayCodeMakeSure.getIsBoundByAccord()); map.put("v_quantity", Integer.valueOf(mydoJobDetail.getInQuantity())); pdaMapper.bindTray(map); if (!"10".equals(map.get("v_result").toString())) { errorbulider.append(mydoJobDetail.getStockinDetailId() + map.get("v_resultmsg").toString()); return AjaxResult.error(errorbulider.toString()); } - } - HashMap map = new HashMap<>(); map.put("v_tray_code", trayCodeMakeSure.getTrayCode()); map.put("v_is_full", trayCodeMakeSure.getIsFull()); @@ -134,18 +135,19 @@ public class PdaServiceImp implements PdaService { if (!"10".equals(map.get("v_result").toString())) { return AjaxResult.error(errorbulider.toString()); } - return AjaxResult.success(); } @Override - public AjaxResult tpIn(String trayCode) { + public AjaxResult tpIn(TrayCodeMsg trayCodeMsg) { HashMap map = new HashMap<>(); - map.put("v_tray_code", trayCode); + map.put("v_tray_code", trayCodeMsg.getTrayCode()); + map.put("v_tray_type", trayCodeMsg.getTrayType()); + map.put("v_quantity", Integer.valueOf(trayCodeMsg.getInQuantity())); pdaMapper.tpIn(map); - if(!"10".equals(map.get("v_result").toString())){ + if (!"10".equals(map.get("v_result").toString())) { return AjaxResult.error(map.get("v_resultmsg").toString()); - }else{ + } else { return AjaxResult.success(); } @@ -155,11 +157,11 @@ public class PdaServiceImp implements PdaService { public AjaxResult tpOut(TrayCodeMsg trayCodeMsg) { HashMap map = new HashMap<>(); - map.put("v_exit_id", trayCodeMsg.getExitId()); + map.put("v_tray_type", trayCodeMsg.getTrayType()); pdaMapper.tpOut(map); - if(!"10".equals(map.get("v_result").toString())){ + if (!"10".equals(map.get("v_result").toString())) { return AjaxResult.error(map.get("v_resultmsg").toString()); - }else{ + } else { return AjaxResult.success(); } } @@ -197,9 +199,10 @@ public class PdaServiceImp implements PdaService { @Override public AjaxResult selectDetailByPDTray(TrayCodeMakeSure trayCodeMakeSure) { MydoJob mydoJob = new MydoJob(); - mydoJob.setExitId(trayCodeMakeSure.getExitId()); +// mydoJob.setExitId(trayCodeMakeSure.getExitId()); mydoJob.setStatus("3"); - mydoJob.setInOrOut("26"); + mydoJob.setInOrOut("28"); + mydoJob.setTrayCode(trayCodeMakeSure.getTrayCode()); List mydoJobDetails = mydoJobDetailService.selectPdMydoJobDetailListByExit(mydoJob); return AjaxResult.success(mydoJobDetails); } @@ -237,9 +240,9 @@ public class PdaServiceImp implements PdaService { public AjaxResult checkMakeSure(TrayCodeMakeSure trayCodeMakeSure) { MydoJob mydoJob = new MydoJob(); - mydoJob.setExitId(trayCodeMakeSure.getExitId()); + mydoJob.setTrayCode(trayCodeMakeSure.getTrayCode()); mydoJob.setStatus("3"); - mydoJob.setInOrOut("26"); + mydoJob.setInOrOut("28"); List mydoJobDetails = mydoJobDetailService.selectPdMydoJobDetailListByExit(mydoJob); if (mydoJobDetails.isEmpty()) { return AjaxResult.error("该物料没有盘点出库作业,请检查"); @@ -249,7 +252,7 @@ public class PdaServiceImp implements PdaService { if (CollUtil.isNotEmpty(mydoJobDetailList)) { boolean flag = mydoJobDetailList.stream().anyMatch(x -> StrUtil.isEmpty(x.getStockId()) && "0".equals(x.getInQuantity())); if (flag) { - return AjaxResult.warn(MessageUtils.message("warn.message8")); + return AjaxResult.warn(MessageUtils.message("盘点数量不可为0")); } for (MydoJobDetail mydoJobDetail : mydoJobDetailList) { //插入盘点提交表 @@ -287,4 +290,104 @@ public class PdaServiceImp implements PdaService { AjaxResult ajaxResult = toWcsService.updateWcsPort(wcsport); return ajaxResult; } + + @Override + public AjaxResult hcoutMakesure(String trayCode) { + HashMap map = new HashMap<>(); + map.put("v_tray_code", trayCode); + pdaMapper.hcoutMakesure(map); + String result = map.get("v_result").toString(); + if ("10".equals(result)) { + return AjaxResult.success(); + } else { + return AjaxResult.error(map.get("v_resultmsg").toString()); + } + } + + + @Override + @Transactional(rollbackFor = Exception.class) + public AjaxResult completeInPk(TrayCodeMakeSure trayCodeMakeSure) { + for (PkDetail pkDetail : trayCodeMakeSure.getPkDetailList()) { + HashMap map = new HashMap<>(); + map.put("v_tray_code", trayCodeMakeSure.getTrayCode()); + map.put("v_in_stockin_detail_id", pkDetail.getStockinDetailId()); + map.put("v_quantity", pkDetail.getQuantity()); + map.put("v_cargo_space_id", trayCodeMakeSure.getCargoSpaceId()); + pdaMapper.completeInPk(map); + + if (!"10".equals(String.valueOf(map.get("v_result")))) { + String errorMessage = Objects.toString(map.get("v_result_msg"), "平库入库失败"); + throw new ServiceException(errorMessage); + } + } + + return AjaxResult.success(); + } + + @Override + public AjaxResult selectBasStockHc(String trayCode) { + BasStock basStock = new BasStock(); + basStock.setTrayCode(trayCode); + List stocks = basStockMapper.selectBasStockListHc(basStock); + if (stocks.size() > 0) { + return AjaxResult.success(stocks); + } else { + return AjaxResult.error("无库存信息"); + } + } + + @Override + public Integer selectByTrayCodeAndProduct(String trayCode, String productId) { + return pdaMapper.selectByTrayCodeAndProduct(trayCode, productId); + } + + @Override + public void completeOutPk(HashMap map) { + pdaMapper.completeOutPk(map); + } + + @Override + public Integer selectBasStockHcCount(String trayCode, String productId) { + BasStock basStock = new BasStock(); + basStock.setTrayCode(trayCode); + basStock.setProductId(productId); + List basStocks = basStockMapper.selectBasStockHcCount(basStock); + return basStocks.size(); + } + + @Override + public AjaxResult selectBasStockHcs(String trayCode, String stockoutDetailId) { + OutStockoutDetail outStockoutDetail = outStockoutDetailService.selectOutStockoutDetailByStockoutDetailId(stockoutDetailId); + List stocks = basStockMapper.selectBasStockHcs(trayCode, outStockoutDetail); + if (stocks.size() > 0) { + return AjaxResult.success(stocks); + } + { + return AjaxResult.error("该托盘无对应库存,请检查!"); + } + } + + @Override + public AjaxResult bindTray2(TrayCodeMakeSure trayCodeMakeSure) { + String collect = trayCodeMakeSure.getMydoJobDetailList().stream().map(detail -> detail.getStockinDetailId() + ":" + detail.getInQuantity()).collect(Collectors.joining(",")); + HashMap map = new HashMap<>(); + map.put("v_tray_code", trayCodeMakeSure.getTrayCode()); + map.put("v_string", collect); + map.put("v_is_bound_accord", trayCodeMakeSure.getIsBoundByAccord()); + pdaMapper.bindTray(map); + if (!"10".equals(map.get("v_result").toString())) { + return AjaxResult.error(map.get("v_result").toString()); + } + map.clear(); + map.put("v_tray_code", trayCodeMakeSure.getTrayCode()); + map.put("v_is_full", trayCodeMakeSure.getIsFull()); + pdaMapper.addInJob(map); + if (!"10".equals(map.get("v_result").toString())) { + return AjaxResult.error(map.get("v_result").toString()); + } + return AjaxResult.success(); + } + + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/stock/stock/controller/BasStockController.java b/ruoyi-admin/src/main/java/com/ruoyi/stock/stock/controller/BasStockController.java index e67ac94..0381eb3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/stock/stock/controller/BasStockController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/stock/stock/controller/BasStockController.java @@ -58,9 +58,10 @@ public class BasStockController extends BaseController */ @PreAuthorize("@ss.hasPermi('stock:management:query')") @GetMapping(value = "/{stockId}") - public AjaxResult getInfo(@PathVariable("stockId") String stockId) + public AjaxResult getInfo(@PathVariable("stockId") String stockId, @RequestParam(value = "warehouseCode", required = false) String warehouseCode) { - return success(basStockService.selectBasStockByStockId(stockId)); + BasStock basStock = basStockService.selectBasStockByStockId2(stockId, warehouseCode); + return success(basStock); } /** @@ -91,9 +92,10 @@ public class BasStockController extends BaseController @PreAuthorize("@ss.hasPermi('stock:management:remove')") @Log(title = "库存信息", businessType = BusinessType.DELETE) @DeleteMapping("/{stockIds}") - public AjaxResult remove(@PathVariable String[] stockIds) + public AjaxResult remove(@PathVariable String[] stockIds,@RequestParam(value = "warehouseCode",required = false) String warehouseCode) { - return toAjax(basStockService.deleteBasStockByStockIds(stockIds)); + System.out.println(warehouseCode); + return toAjax(basStockService.deleteBasStockByStockIds2(stockIds,warehouseCode)); } /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/stock/stock/domain/BasStock.java b/ruoyi-admin/src/main/java/com/ruoyi/stock/stock/domain/BasStock.java index 10a23e8..98c34c8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/stock/stock/domain/BasStock.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/stock/stock/domain/BasStock.java @@ -11,6 +11,7 @@ import lombok.ToString; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import org.springframework.ai.tool.annotation.ToolParam; +import org.springframework.data.annotation.Transient; import java.util.List; @@ -184,6 +185,8 @@ public class BasStock extends BaseEntity /** 仓库 */ // @Excel(name = "${stock.BasStock.warehouseId}") private String warehouseId; + @Transient + private String warehouseCode; /** 垛型ID */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/stock/stock/mapper/BasStockMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/stock/stock/mapper/BasStockMapper.java index d630f00..4211b88 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/stock/stock/mapper/BasStockMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/stock/stock/mapper/BasStockMapper.java @@ -1,6 +1,7 @@ package com.ruoyi.stock.stock.mapper; import com.ruoyi.in.stockindetail.domain.InStockinDetail; +import com.ruoyi.out.outStockoutDetail.domain.OutStockoutDetail; import com.ruoyi.stock.stock.domain.BasStock; import org.apache.ibatis.annotations.Param; @@ -73,4 +74,20 @@ public interface BasStockMapper List getStockBySerial(String trayCode); List selectHasHalfTray(InStockinDetail inStockinDetail); + + List selectBasStockHcCount(BasStock basStock); + + List selectBasStockListHc(BasStock basStock); + + BasStock selectBasStockByStockId2(String stockId, String warehouseCode); + + int updateBasStock2(BasStock basStock); + + int deleteBasStockByStockIds2(@Param("stockIds") String[] stockIds, @Param("warehouseCode")String warehouseCode); + + List selectBasStockList2(BasStock basStock); + + List selectBasStockHcs(@Param("trayCode") String trayCode, @Param("out") OutStockoutDetail outStockoutDetail); + + BasStock selectBasStockListTopOne(String trayCode); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/stock/stock/service/IBasStockService.java b/ruoyi-admin/src/main/java/com/ruoyi/stock/stock/service/IBasStockService.java index c3ea57b..15b431c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/stock/stock/service/IBasStockService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/stock/stock/service/IBasStockService.java @@ -83,4 +83,10 @@ public interface IBasStockService AjaxResult resetPdRecord(); List getStockBySerial(String serial); + + BasStock selectBasStockByStockId2(String stockId, String warehouseCode); + + int deleteBasStockByStockIds2(String[] stockIds,String warehouseCode); + + BasStock selectBasStockListTopOne(String trayCode); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/stock/stock/service/impl/BasStockServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/stock/stock/service/impl/BasStockServiceImpl.java index f9ff3f3..fd81cf8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/stock/stock/service/impl/BasStockServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/stock/stock/service/impl/BasStockServiceImpl.java @@ -58,7 +58,7 @@ public class BasStockServiceImpl implements IBasStockService @Override public List selectBasStockList(BasStock basStock) { - return basStockMapper.selectBasStockList(basStock); + return basStockMapper.selectBasStockList2(basStock); } /** * 无权限查询库存信息列表 @@ -115,10 +115,10 @@ public class BasStockServiceImpl implements IBasStockService @Override public int updateBasStock(BasStock basStock) { - BasStock oldBasStock = basStockMapper.selectBasStockByStockId(basStock.getStockId()); + BasStock oldBasStock = basStockMapper.selectBasStockByStockId2(basStock.getStockId(),basStock.getWarehouseCode()); insertMaintainRecord(oldBasStock,basStock,"2"); insertFreezeRecord(oldBasStock,basStock); - return basStockMapper.updateBasStock(basStock); + return basStockMapper.updateBasStock2(basStock); } private void insertFreezeRecord(BasStock oldBasStock, BasStock basStock) { @@ -194,6 +194,28 @@ public class BasStockServiceImpl implements IBasStockService return basStockMapper.getStockBySerial(trayCode); } + @Override + public BasStock selectBasStockByStockId2(String stockId, String warehouseCode) { + return basStockMapper.selectBasStockByStockId2(stockId,warehouseCode); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public int deleteBasStockByStockIds2(String[] stockIds,String warehouseCode) + { + for (String stockId : stockIds) { + BasStock oldBasStock = basStockMapper.selectBasStockByStockId2(stockId,warehouseCode); + insertMaintainRecord(oldBasStock,oldBasStock,"3"); + } + return basStockMapper.deleteBasStockByStockIds2(stockIds,warehouseCode); + } + + @Override + public BasStock selectBasStockListTopOne(String trayCode) { + + return basStockMapper.selectBasStockListTopOne(trayCode); + } + /** * 新增库存信息(不记录维护记录) * diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index a75fd22..bf0bc50 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -6,14 +6,14 @@ spring: druid: # 主库数据源 master: - url: jdbc:sqlserver://172.16.4.141:1433;databaseName=FT546-wms;encrypt=true;trustServerCertificate=true; + url: jdbc:sqlserver://127.0.0.1:1433;databaseName=FT546-WMS;encrypt=false; username: sa - password: Flrd0914. + password: 123456 # 从库数据源 slave: # 从数据源开关/默认关闭 enabled: false - url: jdbc:mariadb://172.16.4.141:3307/mydb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:mariadb://172.16.4.12:3307/mydb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root password: Flrd0914. # 初始连接数 diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 14ccea8..cc479b0 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -66,12 +66,12 @@ spring: devtools: restart: # 热部署开关 - enabled: true + enabled: false data: # redis 配置 redis: # 地址 - host: 172.16.4.141 + host: 127.0.0.1 # 端口,默认为6379 port: 6379 # 数据库索引 @@ -133,7 +133,12 @@ token: # 令牌密钥 secret: abcdefghijklmnopqrstuvwxyz # 令牌有效期(默认30分钟) - expireTime: 30 + expireTime: 43800 + +# 授权码配置 +license: + # 首次部署需先执行 sql/sys_license.sql 并激活授权码,再改为 true 启用拦截 + enabled: false @@ -175,4 +180,6 @@ xss: # 匹配链接 urlPatterns: /system/*,/monitor/*,/tool/* - +mybatis-plus: + configuration: + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl diff --git a/ruoyi-admin/src/main/resources/mapper/agv/AgvContainerTaskMapper.xml b/ruoyi-admin/src/main/resources/mapper/agv/AgvContainerTaskMapper.xml index 6a067bb..e3198e8 100644 --- a/ruoyi-admin/src/main/resources/mapper/agv/AgvContainerTaskMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/agv/AgvContainerTaskMapper.xml @@ -1,4 +1,4 @@ - + @@ -19,21 +19,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select id, container, start_point, end_point, create_time, start_time, finish_time, task_no, status, spare1, spare2 from agv_container_task + select top 1 id, container, start_point, end_point, create_time, start_time, finish_time, task_no, status, spare1, spare2 from agv_container_task @@ -101,4 +101,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + + delete from agv_container_task where container = #{order} + + + diff --git a/ruoyi-admin/src/main/resources/mapper/ai/ChatMessageMapper.xml b/ruoyi-admin/src/main/resources/mapper/ai/ChatMessageMapper.xml index 99c335a..2ed84a1 100644 --- a/ruoyi-admin/src/main/resources/mapper/ai/ChatMessageMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/ai/ChatMessageMapper.xml @@ -1,4 +1,4 @@ - + @@ -28,14 +28,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -115,3 +115,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" delete from chat_message where conversation_id = #{conversationId} + diff --git a/ruoyi-admin/src/main/resources/mapper/ai/ConversationsMapper.xml b/ruoyi-admin/src/main/resources/mapper/ai/ConversationsMapper.xml index 62ac9b6..2d43b17 100644 --- a/ruoyi-admin/src/main/resources/mapper/ai/ConversationsMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/ai/ConversationsMapper.xml @@ -1,4 +1,4 @@ - + @@ -26,17 +26,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -105,3 +105,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + diff --git a/ruoyi-admin/src/main/resources/mapper/api/KnowledgeFileMapper.xml b/ruoyi-admin/src/main/resources/mapper/api/KnowledgeFileMapper.xml index 75155ec..a4cc5a1 100644 --- a/ruoyi-admin/src/main/resources/mapper/api/KnowledgeFileMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/api/KnowledgeFileMapper.xml @@ -1,4 +1,4 @@ - + @@ -26,17 +26,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -103,4 +103,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/resources/mapper/bas/BasContainerDetailsMapper.xml b/ruoyi-admin/src/main/resources/mapper/bas/BasContainerDetailsMapper.xml index 707d37e..914c453 100644 --- a/ruoyi-admin/src/main/resources/mapper/bas/BasContainerDetailsMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/bas/BasContainerDetailsMapper.xml @@ -1,4 +1,4 @@ - + @@ -23,14 +23,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -90,4 +90,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/resources/mapper/bas/BasContainerMapper.xml b/ruoyi-admin/src/main/resources/mapper/bas/BasContainerMapper.xml index 9fd4d17..12a8819 100644 --- a/ruoyi-admin/src/main/resources/mapper/bas/BasContainerMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/bas/BasContainerMapper.xml @@ -1,4 +1,4 @@ - + @@ -26,11 +26,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and container_id like concat('%', #{containerId}, '%') - and port_name = #{portName} - and status = #{status} - and product_type_quantity = #{productTypeQuantity} - and update_time = #{updateTime} - and operation_man = #{operationMan} + and port_name like concat('%', #{portName}, '%') + and status like concat('%', #{status}, '%') + and product_type_quantity like concat('%', #{productTypeQuantity}, '%') + and update_time like concat('%', #{updateTime}, '%') + and operation_man like concat('%', #{operationMan}, '%') @@ -102,4 +102,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/resources/mapper/bas/BasCustomerMapper.xml b/ruoyi-admin/src/main/resources/mapper/bas/BasCustomerMapper.xml index d762e50..35e7956 100644 --- a/ruoyi-admin/src/main/resources/mapper/bas/BasCustomerMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/bas/BasCustomerMapper.xml @@ -1,4 +1,4 @@ - + @@ -39,7 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and customer_group_no like concat('%', #{customerGroupNo}, '%') and customer_name like concat('%', #{customerName}, '%') and simple_name like concat('%', #{simpleName}, '%') - and useable = #{useable} + and useable like concat('%', #{useable}, '%') and business_department like concat('%', #{businessDepartment}, '%') and salesman like concat('%', #{salesman}, '%') and mnemonic_code like concat('%', #{mnemonicCode}, '%') @@ -149,4 +149,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/resources/mapper/bas/BasJobIdMapper.xml b/ruoyi-admin/src/main/resources/mapper/bas/BasJobIdMapper.xml index ba52e38..98985bc 100644 --- a/ruoyi-admin/src/main/resources/mapper/bas/BasJobIdMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/bas/BasJobIdMapper.xml @@ -1,4 +1,4 @@ - + @@ -34,25 +34,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -162,3 +162,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + diff --git a/ruoyi-admin/src/main/resources/mapper/bas/BasProductCodeMapper.xml b/ruoyi-admin/src/main/resources/mapper/bas/BasProductCodeMapper.xml index 5477ce9..fa70aca 100644 --- a/ruoyi-admin/src/main/resources/mapper/bas/BasProductCodeMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/bas/BasProductCodeMapper.xml @@ -1,4 +1,4 @@ - + @@ -31,7 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -129,4 +129,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/resources/mapper/bas/BasProductPortMapper.xml b/ruoyi-admin/src/main/resources/mapper/bas/BasProductPortMapper.xml index 2fb90aa..690dd4a 100644 --- a/ruoyi-admin/src/main/resources/mapper/bas/BasProductPortMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/bas/BasProductPortMapper.xml @@ -1,4 +1,4 @@ - + @@ -21,9 +21,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and port_name like concat('%', #{portName}, '%') - and port_type = #{portType} - and port_desc = #{portDesc} - and create_man = #{createMan} + and port_type like concat('%', #{portType}, '%') + and port_desc like concat('%', #{portDesc}, '%') + and create_man like concat('%', #{createMan}, '%') @@ -74,4 +74,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/resources/mapper/bas/BasProductPortRelMapper.xml b/ruoyi-admin/src/main/resources/mapper/bas/BasProductPortRelMapper.xml index ecc6728..53bfd74 100644 --- a/ruoyi-admin/src/main/resources/mapper/bas/BasProductPortRelMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/bas/BasProductPortRelMapper.xml @@ -1,4 +1,4 @@ - + @@ -43,9 +43,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -63,7 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and product_id not in (select product_id from bas_product_port_rel where port_id=#{portId}) - and product_id = #{productId} + and product_id like concat('%', #{productId}, '%') and product_name like concat('%', #{productName}, '%') @@ -112,3 +112,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + diff --git a/ruoyi-admin/src/main/resources/mapper/bas/BasRoadwayMapper.xml b/ruoyi-admin/src/main/resources/mapper/bas/BasRoadwayMapper.xml index 0ca261a..4bb69c0 100644 --- a/ruoyi-admin/src/main/resources/mapper/bas/BasRoadwayMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/bas/BasRoadwayMapper.xml @@ -1,4 +1,4 @@ - + @@ -23,14 +23,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -90,4 +90,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/resources/mapper/bas/BasSupplierMapper.xml b/ruoyi-admin/src/main/resources/mapper/bas/BasSupplierMapper.xml index b3bbc6b..434e1d9 100644 --- a/ruoyi-admin/src/main/resources/mapper/bas/BasSupplierMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/bas/BasSupplierMapper.xml @@ -1,4 +1,4 @@ - + @@ -37,7 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and supplier_group_no like concat('%', #{supplierGroupNo}, '%') and supplier_name like concat('%', #{supplierName}, '%') and simple_name like concat('%', #{simpleName}, '%') - and useable = #{useable} + and useable like concat('%', #{useable}, '%') and supplier_arae like concat('%', #{supplierArae}, '%') and taxpayer_registration_number like concat('%', #{taxpayerRegistrationNumber}, '%') and country like concat('%', #{country}, '%') @@ -139,4 +139,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/resources/mapper/bas/BasTagMapper.xml b/ruoyi-admin/src/main/resources/mapper/bas/BasTagMapper.xml index 1d81f5b..4be0cb1 100644 --- a/ruoyi-admin/src/main/resources/mapper/bas/BasTagMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/bas/BasTagMapper.xml @@ -1,4 +1,4 @@ - + @@ -23,14 +23,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -93,3 +93,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + diff --git a/ruoyi-admin/src/main/resources/mapper/bas/BasTraycodeFormatMapper.xml b/ruoyi-admin/src/main/resources/mapper/bas/BasTraycodeFormatMapper.xml index 791a9ff..33caa50 100644 --- a/ruoyi-admin/src/main/resources/mapper/bas/BasTraycodeFormatMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/bas/BasTraycodeFormatMapper.xml @@ -1,4 +1,4 @@ - + @@ -32,9 +32,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and remarks like concat('%',#{remarks}, '%') and min_num like concat('%',#{minNum}, '%') and max_num like concat('%',#{maxNum}, '%') - and spare1 = #{spare1} - and spare2 = #{spare2} - and spare3 = #{spare3} + and spare1 like concat('%', #{spare1}, '%') + and spare2 like concat('%', #{spare2}, '%') + and spare3 like concat('%', #{spare3}, '%') @@ -103,4 +103,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/resources/mapper/bas/BasTraycodeMapper.xml b/ruoyi-admin/src/main/resources/mapper/bas/BasTraycodeMapper.xml index 631bd54..9adf098 100644 --- a/ruoyi-admin/src/main/resources/mapper/bas/BasTraycodeMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/bas/BasTraycodeMapper.xml @@ -1,4 +1,4 @@ - + @@ -26,11 +26,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -98,3 +98,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + diff --git a/ruoyi-admin/src/main/resources/mapper/bas/BasWarehousePortMapper.xml b/ruoyi-admin/src/main/resources/mapper/bas/BasWarehousePortMapper.xml index 12d8f18..26b7155 100644 --- a/ruoyi-admin/src/main/resources/mapper/bas/BasWarehousePortMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/bas/BasWarehousePortMapper.xml @@ -1,4 +1,4 @@ - + @@ -19,10 +19,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -70,4 +70,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/resources/mapper/bas/cargoSpace/BasCargoSpaceMapper.xml b/ruoyi-admin/src/main/resources/mapper/bas/cargoSpace/BasCargoSpaceMapper.xml index 0b306a1..ce02176 100644 --- a/ruoyi-admin/src/main/resources/mapper/bas/cargoSpace/BasCargoSpaceMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/bas/cargoSpace/BasCargoSpaceMapper.xml @@ -1,4 +1,4 @@ - + @@ -63,24 +63,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and bcs.cargo_space_id like concat('%', #{cargoSpaceId}, '%') - and bcs.warehouse_id = #{warehouseId} - and bcs.roadway_id = #{roadwayId} - and bcs.cargo_area_id = #{cargoAreaId} - and bcs.the_type = #{theType} + and bcs.warehouse_id like concat('%', #{warehouseId}, '%') + and bcs.roadway_id like concat('%', #{roadwayId}, '%') + and bcs.cargo_area_id like concat('%', #{cargoAreaId}, '%') + and bcs.the_type like concat('%', #{theType}, '%') and bcs.the_type_name like concat('%', #{theTypeName}, '%') and bcs.cargo_space_name like concat('%', #{cargoSpaceName}, '%') - and bcs.the_platoon = #{thePlatoon} - and bcs.the_column = #{theColumn} - and bcs.the_floor = #{theFloor} - and bcs.status = #{status} - and bcs.locked = #{locked} + and bcs.the_platoon like concat('%', #{thePlatoon}, '%') + and bcs.the_column like concat('%', #{theColumn}, '%') + and bcs.the_floor like concat('%', #{theFloor}, '%') + and bcs.status like concat('%', #{status}, '%') + and bcs.locked like concat('%', #{locked}, '%') and bcs.tray_code like concat('%', #{trayCode}, '%') - and bcs.cargo_hight = #{cargoHight} - and bcs.iss_double = #{issDouble} - and bcs.group_coding_no = #{groupCodingNo} - and bcs.group_coding = #{groupCoding} - and bcs.cargo_space_logo = #{cargoSpaceLogo} - and bcs.this_cargo_area = #{thisCargoArea} + and bcs.cargo_hight like concat('%', #{cargoHight}, '%') + and bcs.iss_double like concat('%', #{issDouble}, '%') + and bcs.group_coding_no like concat('%', #{groupCodingNo}, '%') + and bcs.group_coding like concat('%', #{groupCoding}, '%') + and bcs.cargo_space_logo like concat('%', #{cargoSpaceLogo}, '%') + and bcs.this_cargo_area like concat('%', #{thisCargoArea}, '%') ${params.warehouseDataScope} @@ -188,10 +188,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" WHERE status = '1' and locked = 'N' - and warehouse_id = #{warehouseId} + and warehouse_id like concat('%', #{warehouseId}, '%') - and roadway_id = #{roadwayId} + and roadway_id like concat('%', #{roadwayId}, '%') ORDER BY the_platoon, the_floor,the_column @@ -202,13 +202,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" bcs.the_platoon, bcs.the_column, bcs.the_floor, - bcs.status, - bs.tray_code, - bs.product_id, - bs.product_name + bcs.status from bas_cargo_space bcs - left join bas_stock bs on bcs.cargo_space_id = bs.cargo_space_id - where bcs.status in ('1', '2') + where bcs.status in ( '2') + diff --git a/ruoyi-admin/src/main/resources/mapper/bas/warehouse/BasWarehouseMapper.xml b/ruoyi-admin/src/main/resources/mapper/bas/warehouse/BasWarehouseMapper.xml index 44029d8..c3bf2f8 100644 --- a/ruoyi-admin/src/main/resources/mapper/bas/warehouse/BasWarehouseMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/bas/warehouse/BasWarehouseMapper.xml @@ -1,4 +1,4 @@ - + @@ -29,11 +29,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and warehouse_name like concat('%', #{warehouseName}, '%') - and address = #{address} - and c_desc = #{cDesc} - and warehouse_kind = #{warehouseKind} - and warehouse_type = #{warehouseType} - and is_current = #{isCurrent} + and address like concat('%', #{address}, '%') + and c_desc like concat('%', #{cDesc}, '%') + and warehouse_kind like concat('%', #{warehouseKind}, '%') + and warehouse_type like concat('%', #{warehouseType}, '%') + and is_current like concat('%', #{isCurrent}, '%') and warehouse_id in @@ -111,3 +111,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + diff --git a/ruoyi-admin/src/main/resources/mapper/check/CheckCommitRecordMapper.xml b/ruoyi-admin/src/main/resources/mapper/check/CheckCommitRecordMapper.xml index 35ec7e1..86061f3 100644 --- a/ruoyi-admin/src/main/resources/mapper/check/CheckCommitRecordMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/check/CheckCommitRecordMapper.xml @@ -1,4 +1,4 @@ - + @@ -21,13 +21,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -79,4 +79,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{pdGuid} - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/resources/mapper/check/CheckDifferenceRecordFinishMapper.xml b/ruoyi-admin/src/main/resources/mapper/check/CheckDifferenceRecordFinishMapper.xml index 6aa0b1c..92da99d 100644 --- a/ruoyi-admin/src/main/resources/mapper/check/CheckDifferenceRecordFinishMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/check/CheckDifferenceRecordFinishMapper.xml @@ -1,4 +1,4 @@ - + @@ -72,46 +72,46 @@ - and r.check_stock_detail_id = #{checkStockDetailId} + and r.check_stock_detail_id like concat('%', #{checkStockDetailId}, '%') - and r.stock_id = #{stockId} + and r.stock_id like concat('%', #{stockId}, '%') - and r.tray_code = #{trayCode} + and r.tray_code like concat('%', #{trayCode}, '%') - and r.cargo_space_id = #{cargoSpaceId} + and r.cargo_space_id like concat('%', #{cargoSpaceId}, '%') - and r.product_id = #{productId} + and r.product_id like concat('%', #{productId}, '%') - and r.lot_no = #{lotNo} + and r.lot_no like concat('%', #{lotNo}, '%') - and r.supplier = #{supplier} + and r.supplier like concat('%', #{supplier}, '%') - and r.customer = #{customer} + and r.customer like concat('%', #{customer}, '%') - and r.old_quantity = #{oldQuantity} + and r.old_quantity like concat('%', #{oldQuantity}, '%') - and r.new_quantity = #{newQuantity} + and r.new_quantity like concat('%', #{newQuantity}, '%') - and r.record_type = #{recordType} + and r.record_type like concat('%', #{recordType}, '%') - and r.product_guid = #{productGuid} + and r.product_guid like concat('%', #{productGuid}, '%') - and r.status = #{status} + and r.status like concat('%', #{status}, '%') - and r.warehouse_id = #{warehouseId} + and r.warehouse_id like concat('%', #{warehouseId}, '%') ${params.warehouseDataScope} @@ -200,3 +200,4 @@ + diff --git a/ruoyi-admin/src/main/resources/mapper/check/CheckDifferenceRecordMapper.xml b/ruoyi-admin/src/main/resources/mapper/check/CheckDifferenceRecordMapper.xml index 29b0b26..89d9a8c 100644 --- a/ruoyi-admin/src/main/resources/mapper/check/CheckDifferenceRecordMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/check/CheckDifferenceRecordMapper.xml @@ -1,4 +1,4 @@ - + @@ -72,46 +72,46 @@ - and r.check_stock_detail_id = #{checkStockDetailId} + and r.check_stock_detail_id like concat('%', #{checkStockDetailId}, '%') - and r.stock_id = #{stockId} + and r.stock_id like concat('%', #{stockId}, '%') - and r.tray_code = #{trayCode} + and r.tray_code like concat('%', #{trayCode}, '%') - and r.cargo_space_id = #{cargoSpaceId} + and r.cargo_space_id like concat('%', #{cargoSpaceId}, '%') - and r.product_id = #{productId} + and r.product_id like concat('%', #{productId}, '%') - and r.lot_no = #{lotNo} + and r.lot_no like concat('%', #{lotNo}, '%') - and r.supplier = #{supplier} + and r.supplier like concat('%', #{supplier}, '%') - and r.customer = #{customer} + and r.customer like concat('%', #{customer}, '%') - and r.old_quantity = #{oldQuantity} + and r.old_quantity like concat('%', #{oldQuantity}, '%') - and r.new_quantity = #{newQuantity} + and r.new_quantity like concat('%', #{newQuantity}, '%') - and r.record_type = #{recordType} + and r.record_type like concat('%', #{recordType}, '%') - and r.product_guid = #{productGuid} + and r.product_guid like concat('%', #{productGuid}, '%') - and r.status = #{status} + and r.status like concat('%', #{status}, '%') - and r.warehouse_id = #{warehouseId} + and r.warehouse_id like concat('%', #{warehouseId}, '%') ${params.warehouseDataScope} @@ -200,3 +200,4 @@ + diff --git a/ruoyi-admin/src/main/resources/mapper/check/CheckStockinDetailFinishMapper.xml b/ruoyi-admin/src/main/resources/mapper/check/CheckStockinDetailFinishMapper.xml index 46ecb11..52358bd 100644 --- a/ruoyi-admin/src/main/resources/mapper/check/CheckStockinDetailFinishMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/check/CheckStockinDetailFinishMapper.xml @@ -1,4 +1,4 @@ - + @@ -98,34 +98,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -137,34 +137,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" resultMap="CheckStockinDetailResult"> - and csd.stock_check_guid = #{stockCheckGuid} - and csd.stock_check_id = #{stockCheckId} - and csd.lot_no = #{lotNo} - and csd.product_guid = #{productGuid} - and csd.product_id = #{productId} - and csd.quantity = #{quantity} - and csd.quantity_x = #{quantityX} - and csd.quantity_j = #{quantityJ} - and csd.price = #{price} - and csd.cargo_no = #{cargoNo} - and csd.assign_num = #{assignNum} - and csd.assign_num_x = #{assignNumX} - and csd.assign_num_j = #{assignNumJ} - and csd.print_date = #{printDate} - and csd.stock_status = #{stockStatus} - and csd.supplier_id = #{supplierId} - and csd.customer_id = #{customerId} - and csd.unit = #{unit} - and csd.spec = #{spec} - and csd.scan_num = #{scanNum} - and csd.scan_num_x = #{scanNumX} - and csd.scan_num_j = #{scanNumJ} - and csd.spare1 = #{spare1} - and csd.spare2 = #{spare2} - and csd.spare3 = #{spare3} - and csd.spare4 = #{spare4} - and csd.spare5 = #{spare5} - and csd.spare6 = #{spare6} + and csd.stock_check_guid like concat('%', #{stockCheckGuid}, '%') + and csd.stock_check_id like concat('%', #{stockCheckId}, '%') + and csd.lot_no like concat('%', #{lotNo}, '%') + and csd.product_guid like concat('%', #{productGuid}, '%') + and csd.product_id like concat('%', #{productId}, '%') + and csd.quantity like concat('%', #{quantity}, '%') + and csd.quantity_x like concat('%', #{quantityX}, '%') + and csd.quantity_j like concat('%', #{quantityJ}, '%') + and csd.price like concat('%', #{price}, '%') + and csd.cargo_no like concat('%', #{cargoNo}, '%') + and csd.assign_num like concat('%', #{assignNum}, '%') + and csd.assign_num_x like concat('%', #{assignNumX}, '%') + and csd.assign_num_j like concat('%', #{assignNumJ}, '%') + and csd.print_date like concat('%', #{printDate}, '%') + and csd.stock_status like concat('%', #{stockStatus}, '%') + and csd.supplier_id like concat('%', #{supplierId}, '%') + and csd.customer_id like concat('%', #{customerId}, '%') + and csd.unit like concat('%', #{unit}, '%') + and csd.spec like concat('%', #{spec}, '%') + and csd.scan_num like concat('%', #{scanNum}, '%') + and csd.scan_num_x like concat('%', #{scanNumX}, '%') + and csd.scan_num_j like concat('%', #{scanNumJ}, '%') + and csd.spare1 like concat('%', #{spare1}, '%') + and csd.spare2 like concat('%', #{spare2}, '%') + and csd.spare3 like concat('%', #{spare3}, '%') + and csd.spare4 like concat('%', #{spare4}, '%') + and csd.spare5 like concat('%', #{spare5}, '%') + and csd.spare6 like concat('%', #{spare6}, '%') @@ -283,3 +283,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + diff --git a/ruoyi-admin/src/main/resources/mapper/check/CheckStockinDetailMapper.xml b/ruoyi-admin/src/main/resources/mapper/check/CheckStockinDetailMapper.xml index 3568f9f..7058fc2 100644 --- a/ruoyi-admin/src/main/resources/mapper/check/CheckStockinDetailMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/check/CheckStockinDetailMapper.xml @@ -1,4 +1,4 @@ - + @@ -63,34 +63,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -235,3 +235,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select * from check_stockin_detail where stock_check_id = #{stockCheckId} + diff --git a/ruoyi-admin/src/main/resources/mapper/check/CheckStockinFinishMapper.xml b/ruoyi-admin/src/main/resources/mapper/check/CheckStockinFinishMapper.xml index c098c28..18c6a9c 100644 --- a/ruoyi-admin/src/main/resources/mapper/check/CheckStockinFinishMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/check/CheckStockinFinishMapper.xml @@ -1,4 +1,4 @@ - + @@ -59,24 +59,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -87,24 +87,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - and cs.stock_check_id = #{stockCheckId} - and cs.check_type = #{checkType} - and cs.create_date = #{createDate} - and cs.create_man_id = #{createManId} - and cs.status = #{status} - and cs.warehouse_id = #{warehouseId} - and cs.finish_date = #{finishDate} - and cs.erp_bill = #{erpBill} - and cs.stock_source = #{stockSource} - and cs.department_no = #{departmentNo} - and cs.customer_no = #{customerNo} - and cs.class_no = #{classNo} - and cs.supplier_no = #{supplierNo} - and cs.spare1 = #{spare1} - and cs.spare2 = #{spare2} - and cs.spare3 = #{spare3} - and cs.spare4 = #{spare4} - and cs.spare5 = #{spare5} + and cs.stock_check_id like concat('%', #{stockCheckId}, '%') + and cs.check_type like concat('%', #{checkType}, '%') + and cs.create_date like concat('%', #{createDate}, '%') + and cs.create_man_id like concat('%', #{createManId}, '%') + and cs.status like concat('%', #{status}, '%') + and cs.warehouse_id like concat('%', #{warehouseId}, '%') + and cs.finish_date like concat('%', #{finishDate}, '%') + and cs.erp_bill like concat('%', #{erpBill}, '%') + and cs.stock_source like concat('%', #{stockSource}, '%') + and cs.department_no like concat('%', #{departmentNo}, '%') + and cs.customer_no like concat('%', #{customerNo}, '%') + and cs.class_no like concat('%', #{classNo}, '%') + and cs.supplier_no like concat('%', #{supplierNo}, '%') + and cs.spare1 like concat('%', #{spare1}, '%') + and cs.spare2 like concat('%', #{spare2}, '%') + and cs.spare3 like concat('%', #{spare3}, '%') + and cs.spare4 like concat('%', #{spare4}, '%') + and cs.spare5 like concat('%', #{spare5}, '%') ${params.warehouseDataScope} @@ -183,3 +183,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + diff --git a/ruoyi-admin/src/main/resources/mapper/in/InStockinBackMapper.xml b/ruoyi-admin/src/main/resources/mapper/in/InStockinBackMapper.xml index 36519fa..fa0edd4 100644 --- a/ruoyi-admin/src/main/resources/mapper/in/InStockinBackMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/in/InStockinBackMapper.xml @@ -1,4 +1,4 @@ - + @@ -27,38 +27,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + select stockin_guid, stockin_id, in_type, create_date, create_man_id, status, warehouse_id, spare5, spare4, spare3, finish_date, spare2, spare1, erp_bill, stock_source, department_no, - customer_no, class_no, supplier_no,send_status,send_time,msg from in_stockin_back + customer_no, class_no, supplier_no,send_status,send_time,msg,company_short_name,account_set_no from in_stockin_back @@ -146,7 +148,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" class_no = #{classNo}, supplier_no = #{supplierNo}, send_status = #{sendStatus}, - send_time = #{senTime}, + send_time = #{sendTime}, msg = #{msg}, where stockin_guid = #{stockinGuid} @@ -165,7 +167,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/resources/mapper/in/InStockinDetailBackMapper.xml b/ruoyi-admin/src/main/resources/mapper/in/InStockinDetailBackMapper.xml index 3d14518..797c3c1 100644 --- a/ruoyi-admin/src/main/resources/mapper/in/InStockinDetailBackMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/in/InStockinDetailBackMapper.xml @@ -1,4 +1,4 @@ - + @@ -42,53 +42,95 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + - select stockin_detail_id, stockin_guid, stockin_id, lot_no, product_guid, product_id, quantity, - quantity_x, quantity_j, price, cargo_no, remark, assign_num, assign_num_x, assign_num_j, - print_date, stock_status, supplier_id, customer_id, unit, spec, spare1, spare2, spare3, - spare4, spare5, spare6, scan_num, scan_num_x, scan_num_j, spare7, spare8, spare9, product_name,send_status,send_time,msg from in_stockin_detail_back + select stockin_detail_id, + stockin_guid, + stockin_id, + lot_no, + product_guid, + product_id, + quantity, + quantity_x, + quantity_j, + price, + cargo_no, + remark, + assign_num, + assign_num_x, + assign_num_j, + print_date, + stock_status, + supplier_id, + customer_id, + unit, + spec, + spare1, + spare2, + spare3, + spare4, + spare5, + spare6, + scan_num, + scan_num_x, + scan_num_j, + spare7, + spare8, + spare9, + product_name, + send_status, + send_time, + msg, + source_line_id, + bar_code, + is_batch_manage, + old_project_no + from in_stockin_detail_back @@ -189,7 +231,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update in_stockin_detail_back stockin_guid = #{stockinGuid}, - stockin_id = #{stockinId}, + lot_no = #{lotNo}, product_guid = #{productGuid}, product_id = #{productId}, @@ -222,10 +264,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" spare9 = #{spare9}, product_name = #{productName}, send_status = #{sendStatus}, - send_time = #{senTime}, + send_time = #{sendTime}, msg = #{msg}, - where stockin_detail_id = #{stockinDetailId} + where stockin_id = #{stockinId} @@ -238,4 +280,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{stockinDetailId} - \ No newline at end of file + + + INSERT INTO in_stockin_detail_back_finish + + SELECT * FROM in_stockin_detail_back + WHERE stockin_detail_id = #{item.stockinDetailId} + + + + + DELETE FROM in_stockin_detail_back + WHERE stockin_detail_id IN + + #{item.stockinDetailId} + + + + diff --git a/ruoyi-admin/src/main/resources/mapper/in/InStockinDetailFinishMapper.xml b/ruoyi-admin/src/main/resources/mapper/in/InStockinDetailFinishMapper.xml index 8a9d58d..67aa1e0 100644 --- a/ruoyi-admin/src/main/resources/mapper/in/InStockinDetailFinishMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/in/InStockinDetailFinishMapper.xml @@ -1,4 +1,4 @@ - + @@ -103,34 +103,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -142,34 +142,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" resultMap="InStockinDetailResult"> - and isd.stockin_guid = #{stockinGuid} - and isd.stockin_id = #{stockinId} - and isd.lot_no = #{lotNo} - and isd.product_guid = #{productGuid} - and isd.product_id = #{productId} - and isd.quantity = #{quantity} - and isd.quantity_x = #{quantityX} - and isd.quantity_j = #{quantityJ} - and isd.price = #{price} - and isd.cargo_no = #{cargoNo} - and isd.assign_num = #{assignNum} - and isd.assign_num_x = #{assignNumX} - and isd.assign_num_j = #{assignNumJ} - and isd.print_date = #{printDate} - and isd.stock_status = #{stockStatus} - and isd.supplier_id = #{supplierId} - and isd.customer_id = #{customerId} - and isd.unit = #{unit} - and isd.spec = #{spec} - and isd.spare1 = #{spare1} - and isd.spare2 = #{spare2} - and isd.spare3 = #{spare3} - and isd.spare4 = #{spare4} - and isd.spare5 = #{spare5} - and isd.spare6 = #{spare6} - and isd.scan_num = #{scanNum} - and isd.scan_num_x = #{scanNumX} - and isd.scan_num_j = #{scanNumJ} + and isd.stockin_guid like concat('%', #{stockinGuid}, '%') + and isd.stockin_id like concat('%', #{stockinId}, '%') + and isd.lot_no like concat('%', #{lotNo}, '%') + and isd.product_guid like concat('%', #{productGuid}, '%') + and isd.product_id like concat('%', #{productId}, '%') + and isd.quantity like concat('%', #{quantity}, '%') + and isd.quantity_x like concat('%', #{quantityX}, '%') + and isd.quantity_j like concat('%', #{quantityJ}, '%') + and isd.price like concat('%', #{price}, '%') + and isd.cargo_no like concat('%', #{cargoNo}, '%') + and isd.assign_num like concat('%', #{assignNum}, '%') + and isd.assign_num_x like concat('%', #{assignNumX}, '%') + and isd.assign_num_j like concat('%', #{assignNumJ}, '%') + and isd.print_date like concat('%', #{printDate}, '%') + and isd.stock_status like concat('%', #{stockStatus}, '%') + and isd.supplier_id like concat('%', #{supplierId}, '%') + and isd.customer_id like concat('%', #{customerId}, '%') + and isd.unit like concat('%', #{unit}, '%') + and isd.spec like concat('%', #{spec}, '%') + and isd.spare1 like concat('%', #{spare1}, '%') + and isd.spare2 like concat('%', #{spare2}, '%') + and isd.spare3 like concat('%', #{spare3}, '%') + and isd.spare4 like concat('%', #{spare4}, '%') + and isd.spare5 like concat('%', #{spare5}, '%') + and isd.spare6 like concat('%', #{spare6}, '%') + and isd.scan_num like concat('%', #{scanNum}, '%') + and isd.scan_num_x like concat('%', #{scanNumX}, '%') + and isd.scan_num_j like concat('%', #{scanNumJ}, '%') @@ -288,3 +288,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + diff --git a/ruoyi-admin/src/main/resources/mapper/in/InStockinDetailMapper.xml b/ruoyi-admin/src/main/resources/mapper/in/InStockinDetailMapper.xml index 4e3ad1a..fd19718 100644 --- a/ruoyi-admin/src/main/resources/mapper/in/InStockinDetailMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/in/InStockinDetailMapper.xml @@ -1,4 +1,4 @@ - + @@ -41,6 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -69,34 +70,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -143,7 +144,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" scan_num_x, scan_num_j, product_name, - + source_line_id, + bar_code, + is_batch_manage, + old_project_no, + #{stockinDetailId}, #{stockinGuid}, @@ -180,7 +185,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{scanNumX}, #{scanNumJ}, #{productName}, - + + #{sourceLineId}, + #{barCode}, + #{isBatchManage}, + #{oldProjectNo}, + + INSERT INTO in_stockin_detail @@ -333,4 +344,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" order by ist.create_date desc + + + + + + + diff --git a/ruoyi-admin/src/main/resources/mapper/in/InStockinFinishMapper.xml b/ruoyi-admin/src/main/resources/mapper/in/InStockinFinishMapper.xml index 5a19b7d..81cad95 100644 --- a/ruoyi-admin/src/main/resources/mapper/in/InStockinFinishMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/in/InStockinFinishMapper.xml @@ -1,4 +1,4 @@ - + @@ -53,7 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select is2.stockin_guid, + select distinct is2.stockin_guid, is2.stockin_id, is2.in_type, is2.create_date, @@ -78,6 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" -- su.user_name from in_stockin_finish is2 left join bas_warehouse bw on is2.warehouse_id = bw.warehouse_id + left join in_stockin_detail is3 on is2.stockin_id=is3.stockin_id -- left join bas_supplier bs on bs.supplier_no = is2.supplier_no -- left join sys_dept sd on is2.department_no = sd.dept_id -- left join sys_user su on su.user_id = is2.create_man_id @@ -86,24 +87,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -121,24 +123,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + diff --git a/ruoyi-admin/src/main/resources/mapper/in/TransferBillCallbackMapper.xml b/ruoyi-admin/src/main/resources/mapper/in/TransferBillCallbackMapper.xml index 8fcd1e0..88eaed5 100644 --- a/ruoyi-admin/src/main/resources/mapper/in/TransferBillCallbackMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/in/TransferBillCallbackMapper.xml @@ -1,4 +1,4 @@ - + @@ -24,14 +24,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -92,4 +92,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/resources/mapper/job/MydoJobDetailFinishMapper.xml b/ruoyi-admin/src/main/resources/mapper/job/MydoJobDetailFinishMapper.xml index dd402f1..f32aeea 100644 --- a/ruoyi-admin/src/main/resources/mapper/job/MydoJobDetailFinishMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/job/MydoJobDetailFinishMapper.xml @@ -1,4 +1,4 @@ - + @@ -84,32 +84,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" from mydo_job_detail_finish mjd left join bas_product bp on mjd.product_id = bp.product_id - and mjd.job_detail_id = #{jobDetailId} - and mjd.job_id = #{jobId} - and mjd.stock_id = #{stockId} - and mjd.lot_no = #{lotNo} - and mjd.in_date = #{inDate} - and mjd.in_or_out_id = #{inOrOutId} - and mjd.in_or_out_d_id = #{inOrOutDId} - and mjd.product_guid = #{productGuid} - and mjd.product_id = #{productId} - and mjd.stock_status = #{stockStatus} - and mjd.in_quantity = #{inQuantity} - and mjd.stock_quantity = #{stockQuantity} - and mjd.out_quantity = #{outQuantity} - and mjd.layer_quantity = #{layerQuantity} - and mjd.out_layer_quantity = #{outLayerQuantity} - and mjd.give_num = #{giveNum} - and mjd.stockin_id = #{stockinId} - and mjd.stacking_id = #{stackingId} - and mjd.exit_id = #{exitId} - and mjd.print_date = #{printDate} - and mjd.customer_id = #{customerId} - and mjd.supplier_id = #{supplierId} - and mjd.spare1 = #{spare1} - and mjd.spare2 = #{spare2} - and mjd.spare3 = #{spare3} - and mjd.spare4 = #{spare4} + and mjd.job_detail_id like concat('%', #{jobDetailId}, '%') + and mjd.job_id like concat('%', #{jobId}, '%') + and mjd.stock_id like concat('%', #{stockId}, '%') + and mjd.lot_no like concat('%', #{lotNo}, '%') + and mjd.in_date like concat('%', #{inDate}, '%') + and mjd.in_or_out_id like concat('%', #{inOrOutId}, '%') + and mjd.in_or_out_d_id like concat('%', #{inOrOutDId}, '%') + and mjd.product_guid like concat('%', #{productGuid}, '%') + and mjd.product_id like concat('%', #{productId}, '%') + and mjd.stock_status like concat('%', #{stockStatus}, '%') + and mjd.in_quantity like concat('%', #{inQuantity}, '%') + and mjd.stock_quantity like concat('%', #{stockQuantity}, '%') + and mjd.out_quantity like concat('%', #{outQuantity}, '%') + and mjd.layer_quantity like concat('%', #{layerQuantity}, '%') + and mjd.out_layer_quantity like concat('%', #{outLayerQuantity}, '%') + and mjd.give_num like concat('%', #{giveNum}, '%') + and mjd.stockin_id like concat('%', #{stockinId}, '%') + and mjd.stacking_id like concat('%', #{stackingId}, '%') + and mjd.exit_id like concat('%', #{exitId}, '%') + and mjd.print_date like concat('%', #{printDate}, '%') + and mjd.customer_id like concat('%', #{customerId}, '%') + and mjd.supplier_id like concat('%', #{supplierId}, '%') + and mjd.spare1 like concat('%', #{spare1}, '%') + and mjd.spare2 like concat('%', #{spare2}, '%') + and mjd.spare3 like concat('%', #{spare3}, '%') + and mjd.spare4 like concat('%', #{spare4}, '%') @@ -299,3 +299,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + diff --git a/ruoyi-admin/src/main/resources/mapper/job/MydoJobDetailMapper.xml b/ruoyi-admin/src/main/resources/mapper/job/MydoJobDetailMapper.xml index 1222e25..4eac9a1 100644 --- a/ruoyi-admin/src/main/resources/mapper/job/MydoJobDetailMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/job/MydoJobDetailMapper.xml @@ -1,4 +1,4 @@ - + @@ -87,32 +87,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" from mydo_job_detail mjd left join bas_product bp on mjd.product_id = bp.product_id - and mjd.job_detail_id = #{jobDetailId} - and mjd.job_id = #{jobId} - and mjd.stock_id = #{stockId} - and mjd.lot_no = #{lotNo} - and mjd.in_date = #{inDate} - and mjd.in_or_out_id = #{inOrOutId} - and mjd.in_or_out_d_id = #{inOrOutDId} - and mjd.product_guid = #{productGuid} - and mjd.product_id = #{productId} - and mjd.stock_status = #{stockStatus} - and mjd.in_quantity = #{inQuantity} - and mjd.stock_quantity = #{stockQuantity} - and mjd.out_quantity = #{outQuantity} - and mjd.layer_quantity = #{layerQuantity} - and mjd.out_layer_quantity = #{outLayerQuantity} - and mjd.give_num = #{giveNum} - and mjd.stockin_id = #{stockinId} - and mjd.stacking_id = #{stackingId} - and mjd.exit_id = #{exitId} - and mjd.print_date = #{printDate} - and mjd.customer_id = #{customerId} - and mjd.supplier_id = #{supplierId} - and mjd.spare1 = #{spare1} - and mjd.spare2 = #{spare2} - and mjd.spare3 = #{spare3} - and mjd.spare4 = #{spare4} + and mjd.job_detail_id like concat('%', #{jobDetailId}, '%') + and mjd.job_id like concat('%', #{jobId}, '%') + and mjd.stock_id like concat('%', #{stockId}, '%') + and mjd.lot_no like concat('%', #{lotNo}, '%') + and mjd.in_date like concat('%', #{inDate}, '%') + and mjd.in_or_out_id like concat('%', #{inOrOutId}, '%') + and mjd.in_or_out_d_id like concat('%', #{inOrOutDId}, '%') + and mjd.product_guid like concat('%', #{productGuid}, '%') + and mjd.product_id like concat('%', #{productId}, '%') + and mjd.stock_status like concat('%', #{stockStatus}, '%') + and mjd.in_quantity like concat('%', #{inQuantity}, '%') + and mjd.stock_quantity like concat('%', #{stockQuantity}, '%') + and mjd.out_quantity like concat('%', #{outQuantity}, '%') + and mjd.layer_quantity like concat('%', #{layerQuantity}, '%') + and mjd.out_layer_quantity like concat('%', #{outLayerQuantity}, '%') + and mjd.give_num like concat('%', #{giveNum}, '%') + and mjd.stockin_id like concat('%', #{stockinId}, '%') + and mjd.stacking_id like concat('%', #{stackingId}, '%') + and mjd.exit_id like concat('%', #{exitId}, '%') + and mjd.print_date like concat('%', #{printDate}, '%') + and mjd.customer_id like concat('%', #{customerId}, '%') + and mjd.supplier_id like concat('%', #{supplierId}, '%') + and mjd.spare1 like concat('%', #{spare1}, '%') + and mjd.spare2 like concat('%', #{spare2}, '%') + and mjd.spare3 like concat('%', #{spare3}, '%') + and mjd.spare4 like concat('%', #{spare4}, '%') @@ -403,8 +403,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" mjd.spare3, mjd.spare4, mjd.pick_quantity, - mjd.out_quantity-mjd.pick_quantity as pick_quantity_real, - bp.product_name, + mjd.out_quantity - mjd.pick_quantity as pick_quantity_real, + mjd.product_name, mjd.spare5, mjd.spare6, mjd.spare7, @@ -415,11 +415,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" mj.tray_code from mydo_job_detail mjd - left join bas_product bp on mjd.product_id = bp.product_id + left join mydo_job mj on mjd.job_id = mj.job_id - where mj.exit_id=#{exitId} - and mj.status='3' - and mj.execution_phase=2 + where mj.status = '3' + and mj.execution_phase = 2 + and mj.tray_code = #{trayCode} and mj.in_or_out = #{inOrOut} + diff --git a/ruoyi-admin/src/main/resources/mapper/job/MydoJobFinishMapper.xml b/ruoyi-admin/src/main/resources/mapper/job/MydoJobFinishMapper.xml index f35a52a..63e01f3 100644 --- a/ruoyi-admin/src/main/resources/mapper/job/MydoJobFinishMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/job/MydoJobFinishMapper.xml @@ -1,4 +1,4 @@ - + @@ -60,30 +60,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -205,6 +206,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where job_id = #{jobId} + delete from mydo_job where job_id = #{jobId} @@ -237,10 +244,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -260,11 +267,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select * from mydo_job where tray_code = #{trayCode} + + + + + + + + + + + + diff --git a/ruoyi-admin/src/main/resources/mapper/out/OutExceptionRecordMapper.xml b/ruoyi-admin/src/main/resources/mapper/out/OutExceptionRecordMapper.xml index 9e432c3..f34c2db 100644 --- a/ruoyi-admin/src/main/resources/mapper/out/OutExceptionRecordMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/out/OutExceptionRecordMapper.xml @@ -1,4 +1,4 @@ - + @@ -22,13 +22,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -83,4 +83,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{outGuid} - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/resources/mapper/out/OutPickSubmitMapper.xml b/ruoyi-admin/src/main/resources/mapper/out/OutPickSubmitMapper.xml index 37685d6..98b9731 100644 --- a/ruoyi-admin/src/main/resources/mapper/out/OutPickSubmitMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/out/OutPickSubmitMapper.xml @@ -1,4 +1,4 @@ - + @@ -25,16 +25,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -98,4 +98,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/resources/mapper/out/OutStockoutDetailFinishMapper.xml b/ruoyi-admin/src/main/resources/mapper/out/OutStockoutDetailFinishMapper.xml index 0bf97cb..56d4ac2 100644 --- a/ruoyi-admin/src/main/resources/mapper/out/OutStockoutDetailFinishMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/out/OutStockoutDetailFinishMapper.xml @@ -1,4 +1,4 @@ - + @@ -90,36 +90,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -253,10 +253,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select d.stockout_detail_id, d.stockout_guid, d.stockout_id, d.lot_no, d.product_guid, d.product_id, d.quantity, d.quantity_x, d.quantity_j, d.assign_num, d.assign_num_x, d.assign_num_j, d.allot_quantity, d.allot_quantity_x, d.allot_quantity_j, d.price, d.remark, d.warehouse_id, d.out_id, d.bukechai_quantity, d.kechai_quantity, d.entryid, d.flat_quantity, d.fid, - d.erp_stockout_id, d.unit, d.spec, d.supplier_id, d.cargo_no, d.create_time, d.print_date, - d.voltage, d.power, d.phase, d.net_weight, d.gross_weight, d.distribution, d.model, d.order_id, - p.product_name + d.erp_stockout_id, d.unit, d.spec, + d.product_name,d.spare1, d.spare2, d.spare3, d.spare4,d.spare5, d.spare6,d.spare7,d.spare8,d.spare9 from out_stockout_detail_finish d left join bas_product p on d.product_id = p.product_id where stockout_guid = #{stockoutGuid} + diff --git a/ruoyi-admin/src/main/resources/mapper/out/OutStockoutDetailMapper.xml b/ruoyi-admin/src/main/resources/mapper/out/OutStockoutDetailMapper.xml index 31db6a8..9162384 100644 --- a/ruoyi-admin/src/main/resources/mapper/out/OutStockoutDetailMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/out/OutStockoutDetailMapper.xml @@ -1,4 +1,4 @@ - + @@ -57,42 +57,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -141,47 +141,55 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" spare7, spare8, spare9, + source_line_id, + bar_code, + is_batch_manage, + old_project_no, - #{stockoutDetailId}, - #{stockoutGuid}, - #{stockoutId}, - #{lotNo}, - #{productGuid}, - #{productId}, - #{productName}, - #{quantity}, - #{quantityX}, - #{quantityJ}, - #{assignNum}, - #{assignNumX}, - #{assignNumJ}, - #{allotQuantity}, - #{allotQuantityX}, - #{allotQuantityJ}, - #{price}, - #{remark}, - #{warehouseId}, - #{outId}, - #{bukechaiQuantity}, - #{kechaiQuantity}, - #{entryid}, - #{flatQuantity}, - #{fid}, - #{erpStockoutId}, - #{unit}, - #{spec}, - #{spare1}, - #{spare2}, - #{spare3}, - #{spare4}, - #{spare5}, - #{spare6}, - #{spare7}, - #{spare8}, - #{spare9}, - + #{stockoutDetailId}, + #{stockoutGuid}, + #{stockoutId}, + #{lotNo}, + #{productGuid}, + #{productId}, + #{productName}, + #{quantity}, + #{quantityX}, + #{quantityJ}, + #{assignNum}, + #{assignNumX}, + #{assignNumJ}, + #{allotQuantity}, + #{allotQuantityX}, + #{allotQuantityJ}, + #{price}, + #{remark}, + #{warehouseId}, + #{outId}, + #{bukechaiQuantity}, + #{kechaiQuantity}, + #{entryid}, + #{flatQuantity}, + #{fid}, + #{erpStockoutId}, + #{unit}, + #{spec}, + #{spare1}, + #{spare2}, + #{spare3}, + #{spare4}, + #{spare5}, + #{spare6}, + #{spare7}, + #{spare8}, + #{spare9}, + #{sourceLineId}, + #{barCode}, + #{isBatchManage}, + #{oldProjectNo}, + @@ -248,3 +256,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where d.stockout_guid = #{stockoutGuid} + diff --git a/ruoyi-admin/src/main/resources/mapper/out/OutStockoutFinishMapper.xml b/ruoyi-admin/src/main/resources/mapper/out/OutStockoutFinishMapper.xml index b66d614..4168ae0 100644 --- a/ruoyi-admin/src/main/resources/mapper/out/OutStockoutFinishMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/out/OutStockoutFinishMapper.xml @@ -1,4 +1,4 @@ - + @@ -33,23 +33,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -142,26 +142,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" left join out_stockout_detail_finish d on d.stockout_id = o.stockout_id left join bas_product bp on bp.product_id = d.product_id - and o.stockout_guid = #{stockoutGuid} - and o.stockout_id = #{stockoutId} - and o.out_type = #{outType} - and o.department_no = #{departmentNo} - and o.customer_no = #{customerNo} - and o.create_man_id = #{createManId} - and o.status = #{status} - and o.stockout_source = #{stockoutSource} - and o.warehouse_id = #{warehouseId} - and o.class_now_id = #{classNowId} - and o.exit_id = #{exitId} - and o.car_number = #{carNumber} - and o.FID = #{FID} - and o.erp_stockout_id = #{erpStockoutId} + and o.stockout_guid like concat('%', #{stockoutGuid}, '%') + and o.stockout_id like concat('%', #{stockoutId}, '%') + and o.out_type like concat('%', #{outType}, '%') + and o.department_no like concat('%', #{departmentNo}, '%') + and o.customer_no like concat('%', #{customerNo}, '%') + and o.create_man_id like concat('%', #{createManId}, '%') + and o.status like concat('%', #{status}, '%') + and o.stockout_source like concat('%', #{stockoutSource}, '%') + and o.warehouse_id like concat('%', #{warehouseId}, '%') + and o.class_now_id like concat('%', #{classNowId}, '%') + and o.exit_id like concat('%', #{exitId}, '%') + and o.car_number like concat('%', #{carNumber}, '%') + and o.FID like concat('%', #{FID}, '%') + and o.erp_stockout_id like concat('%', #{erpStockoutId}, '%') and o.create_date >= #{startDate} and o.create_date <= #{finishDate} - and d.product_id = #{productId} + and d.spare4 like concat('%', #{spare4}, '%') + and d.product_id like concat('%', #{productId}, '%') and bp.product_name like concat('%', #{productName}, '%') and bc.customer_name like concat('%', #{customerName}, '%') order by o.create_date desc + diff --git a/ruoyi-admin/src/main/resources/mapper/out/OutStockoutMapper.xml b/ruoyi-admin/src/main/resources/mapper/out/OutStockoutMapper.xml index 84ac0fb..61c9efc 100644 --- a/ruoyi-admin/src/main/resources/mapper/out/OutStockoutMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/out/OutStockoutMapper.xml @@ -1,4 +1,4 @@ - + @@ -29,44 +29,50 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + - select stockout_guid, stockout_id, out_type, create_date, department_no, customer_no, create_man_id, status, stockout_source, warehouse_id, class_now_id, exit_id, car_number, FID, erp_stockout_id,start_date,finish_date,spare1,spare2,spare3,spare4,spare5 from out_stockout + select stockout_guid, stockout_id, out_type, create_date, department_no, customer_no, create_man_id, status, stockout_source, warehouse_id, class_now_id, exit_id, car_number, FID, erp_stockout_id,start_date,finish_date,spare1,spare2,spare3,spare4,spare5,spare6,spare7,spare8 from out_stockout @@ -192,10 +210,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{v_stockout_detail_id,mode=IN,jdbcType=VARCHAR}, #{v_stock_id,mode=IN,jdbcType=VARCHAR}, #{v_result,mode=OUT,jdbcType=VARCHAR}, - #{v_resultString,mode=OUT,jdbcType=VARCHAR} + #{v_resultmsg,mode=OUT,jdbcType=VARCHAR} ) } + + + update out_stockout + + stockout_id = #{stockoutId}, + out_type = #{outType}, + create_date = #{createDate}, + department_no = #{departmentNo}, + customer_no = #{customerNo}, + create_man_id = #{createManId}, + status = #{status}, + stockout_source = #{stockoutSource}, + warehouse_id = #{warehouseId}, + class_now_id = #{classNowId}, + exit_id = #{exitId}, + car_number = #{carNumber}, + FID = #{FID}, + erp_stockout_id = #{erpStockoutId}, + start_date = #{startDate}, + finish_date = #{finishDate}, + spare1 = #{spare1}, + spare2 = #{spare2}, + spare4 = #{spare4}, + spare3 = #{spare3}, + spare5 = #{spare5}, + company_short_name = #{companyShortName}, + account_set_no = #{accountSetNo}, + + where stockout_guid = #{stockoutGuid} + + + + + diff --git a/ruoyi-admin/src/main/resources/mapper/out/ViewHandAllotStockMapper.xml b/ruoyi-admin/src/main/resources/mapper/out/ViewHandAllotStockMapper.xml index efa1542..a5fc899 100644 --- a/ruoyi-admin/src/main/resources/mapper/out/ViewHandAllotStockMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/out/ViewHandAllotStockMapper.xml @@ -1,9 +1,9 @@ - + - + @@ -53,58 +53,88 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select stock_id, cargo_space_id, stock_status, product_status, lot_no, in_date, back_date, product_guid, quantity, job_id, tray_code, out_quantity, stockin_detail_id, stockin_id, in_type, in_class_id, warehouse_id, stacking_id, spare1, spare2, spare3, spare4, spare5, spare6, product_id, product_name, voltage, power, phase, net_weight, gross_weight, distribution, model, order_id, spare7, spare8, cargo_space_name, roadway_id, the_platoon, the_column, the_floor, status, locked from view_hand_allot_stock + + select stock_id, cargo_space_id, stock_status, product_status, lot_no, in_date, back_date, product_guid, quantity, job_id, tray_code, out_quantity, stockin_detail_id, stockin_id, in_type, in_class_id, warehouse_id, stacking_id, spare1, spare2, spare3, spare4, spare5, spare6, product_id, product_name, voltage, power, phase, net_weight, gross_weight, distribution, model, order_id, spare7, spare8 from view_hand_allot_stock_hc + - + @@ -256,9 +286,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from view_hand_allot_stock where stock_id in + delete from view_hand_allot_stock where stock_id in #{stockId} - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/resources/mapper/pda/PdaMapper.xml b/ruoyi-admin/src/main/resources/mapper/pda/PdaMapper.xml index 19d6112..d31df4a 100644 --- a/ruoyi-admin/src/main/resources/mapper/pda/PdaMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/pda/PdaMapper.xml @@ -8,6 +8,7 @@ {call proc_bind_tray_msg( #{v_tray_code,mode=IN,jdbcType=VARCHAR}, #{v_stockin_detail_id,mode=IN,jdbcType=VARCHAR}, + #{v_is_bound_accord,mode=IN,jdbcType=VARCHAR}, #{v_quantity,mode=IN,jdbcType=INTEGER}, #{v_result,mode=OUT,jdbcType=INTEGER}, #{v_resultmsg,mode=OUT,jdbcType=VARCHAR} @@ -17,6 +18,8 @@ {call proc_tp_out( - #{v_exit_id,mode=IN,jdbcType=VARCHAR}, + #{v_tray_type,mode=IN,jdbcType=VARCHAR}, #{v_result,mode=OUT,jdbcType=INTEGER}, #{v_resultmsg,mode=OUT,jdbcType=VARCHAR} )} @@ -142,4 +145,60 @@ #{v_resultmsg,mode=OUT,jdbcType=VARCHAR} )} + + + + + + + + + + + diff --git a/ruoyi-admin/src/main/resources/mapper/pda/TrayMsgMapper.xml b/ruoyi-admin/src/main/resources/mapper/pda/TrayMsgMapper.xml index d56e423..c133e74 100644 --- a/ruoyi-admin/src/main/resources/mapper/pda/TrayMsgMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/pda/TrayMsgMapper.xml @@ -1,4 +1,4 @@ - + @@ -25,9 +25,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" left join bas_product p on d.product_id=p.product_id left join bas_warehouse w on t.warehouse_id=w.warehouse_id - and t.tray_code = #{trayCode} - and t.stockin_detail_id = #{stockinDetailId} - and t.quantity = #{quantity} + and t.tray_code like concat('%', #{trayCode}, '%') + and t.stockin_detail_id like concat('%', #{stockinDetailId}, '%') + and t.quantity like concat('%', #{quantity}, '%') ${params.warehouseDataScope} @@ -78,4 +78,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/resources/mapper/productAndStock/ViewProductAndStockMapper.xml b/ruoyi-admin/src/main/resources/mapper/productAndStock/ViewProductAndStockMapper.xml index 8b9d313..d9378e5 100644 --- a/ruoyi-admin/src/main/resources/mapper/productAndStock/ViewProductAndStockMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/productAndStock/ViewProductAndStockMapper.xml @@ -1,4 +1,4 @@ - + @@ -33,22 +33,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -60,24 +60,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" resultMap="ViewProductAndStockResult"> - and only_identity = #{onlyIdentity} - and product_id = #{productId} - and lot_no = #{lotNo} + and only_identity like concat('%', #{onlyIdentity}, '%') + and product_id like concat('%', #{productId}, '%') + and lot_no like concat('%', #{lotNo}, '%') and product_name like concat('%', #{productName}, '%') - and quantity = #{quantity} - and warehouse_id = #{warehouseId} - and stacking_id = #{stackingId} - and spare1 = #{spare1} - and spare2 = #{spare2} - and spare3 = #{spare3} - and spare4 = #{spare4} - and spare5 = #{spare5} - and spare6 = #{spare6} - and voltage = #{voltage} - and power = #{power} - and phase = #{phase} + and quantity like concat('%', #{quantity}, '%') + and warehouse_id like concat('%', #{warehouseId}, '%') + and stacking_id like concat('%', #{stackingId}, '%') + and spare1 like concat('%', #{spare1}, '%') + and spare2 like concat('%', #{spare2}, '%') + and spare3 like concat('%', #{spare3}, '%') + and spare4 like concat('%', #{spare4}, '%') + and spare5 like concat('%', #{spare5}, '%') + and spare6 like concat('%', #{spare6}, '%') + and voltage like concat('%', #{voltage}, '%') + and power like concat('%', #{power}, '%') + and phase like concat('%', #{phase}, '%') @@ -154,3 +154,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + diff --git a/ruoyi-admin/src/main/resources/mapper/receive/ReceiveStockinDetailFinishMapper.xml b/ruoyi-admin/src/main/resources/mapper/receive/ReceiveStockinDetailFinishMapper.xml index c14cb0a..abbf8c2 100644 --- a/ruoyi-admin/src/main/resources/mapper/receive/ReceiveStockinDetailFinishMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/receive/ReceiveStockinDetailFinishMapper.xml @@ -1,4 +1,4 @@ - + @@ -87,31 +87,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -123,31 +123,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" resultMap="ReceiveStockinDetailResult"> - and stockin_guid = #{stockinGuid} - and stockin_id = #{stockinId} - and lot_no = #{lotNo} - and product_guid = #{productGuid} - and product_id = #{productId} - and quantity = #{quantity} - and quantity_x = #{quantityX} - and quantity_j = #{quantityJ} - and price = #{price} - and cargo_no = #{cargoNo} - and assign_num = #{assignNum} - and assign_num_x = #{assignNumX} - and assign_num_j = #{assignNumJ} - and print_date = #{printDate} - and stock_status = #{stockStatus} - and supplier_id = #{supplierId} - and customer_id = #{customerId} - and unit = #{unit} - and spec = #{spec} - and spare1 = #{spare1} - and spare2 = #{spare2} - and spare3 = #{spare3} - and spare4 = #{spare4} - and spare5 = #{spare5} - and spare6 = #{spare6} + and stockin_guid like concat('%', #{stockinGuid}, '%') + and stockin_id like concat('%', #{stockinId}, '%') + and lot_no like concat('%', #{lotNo}, '%') + and product_guid like concat('%', #{productGuid}, '%') + and product_id like concat('%', #{productId}, '%') + and quantity like concat('%', #{quantity}, '%') + and quantity_x like concat('%', #{quantityX}, '%') + and quantity_j like concat('%', #{quantityJ}, '%') + and price like concat('%', #{price}, '%') + and cargo_no like concat('%', #{cargoNo}, '%') + and assign_num like concat('%', #{assignNum}, '%') + and assign_num_x like concat('%', #{assignNumX}, '%') + and assign_num_j like concat('%', #{assignNumJ}, '%') + and print_date like concat('%', #{printDate}, '%') + and stock_status like concat('%', #{stockStatus}, '%') + and supplier_id like concat('%', #{supplierId}, '%') + and customer_id like concat('%', #{customerId}, '%') + and unit like concat('%', #{unit}, '%') + and spec like concat('%', #{spec}, '%') + and spare1 like concat('%', #{spare1}, '%') + and spare2 like concat('%', #{spare2}, '%') + and spare3 like concat('%', #{spare3}, '%') + and spare4 like concat('%', #{spare4}, '%') + and spare5 like concat('%', #{spare5}, '%') + and spare6 like concat('%', #{spare6}, '%') @@ -257,3 +257,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + diff --git a/ruoyi-admin/src/main/resources/mapper/receive/ReceiveStockinDetailMapper.xml b/ruoyi-admin/src/main/resources/mapper/receive/ReceiveStockinDetailMapper.xml index 7dd1219..bfb6770 100644 --- a/ruoyi-admin/src/main/resources/mapper/receive/ReceiveStockinDetailMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/receive/ReceiveStockinDetailMapper.xml @@ -1,4 +1,4 @@ - + @@ -58,31 +58,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -202,3 +202,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + diff --git a/ruoyi-admin/src/main/resources/mapper/receive/ReceiveStockinFinishMapper.xml b/ruoyi-admin/src/main/resources/mapper/receive/ReceiveStockinFinishMapper.xml index 5660555..1f847da 100644 --- a/ruoyi-admin/src/main/resources/mapper/receive/ReceiveStockinFinishMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/receive/ReceiveStockinFinishMapper.xml @@ -1,4 +1,4 @@ - + @@ -86,24 +86,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -114,24 +114,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - and rs.stockin_id = #{stockinId} - and rs.in_type = #{inType} - and rs.create_date = #{createDate} - and rs.create_man_id = #{createManId} - and rs.status = #{status} - and rs.warehouse_id = #{warehouseId} - and rs.spare5 = #{spare5} - and rs.spare4 = #{spare4} - and rs.spare3 = #{spare3} - and rs.finish_date = #{finishDate} - and rs.spare2 = #{spare2} - and rs.spare1 = #{spare1} - and rs.erp_bill = #{erpBill} - and rs.stock_source = #{stockSource} - and rs.department_no = #{departmentNo} - and rs.customer_no = #{customerNo} - and rs.class_no = #{classNo} - and rs.supplier_no = #{supplierNo} + and rs.stockin_id like concat('%', #{stockinId}, '%') + and rs.in_type like concat('%', #{inType}, '%') + and rs.create_date like concat('%', #{createDate}, '%') + and rs.create_man_id like concat('%', #{createManId}, '%') + and rs.status like concat('%', #{status}, '%') + and rs.warehouse_id like concat('%', #{warehouseId}, '%') + and rs.spare5 like concat('%', #{spare5}, '%') + and rs.spare4 like concat('%', #{spare4}, '%') + and rs.spare3 like concat('%', #{spare3}, '%') + and rs.finish_date like concat('%', #{finishDate}, '%') + and rs.spare2 like concat('%', #{spare2}, '%') + and rs.spare1 like concat('%', #{spare1}, '%') + and rs.erp_bill like concat('%', #{erpBill}, '%') + and rs.stock_source like concat('%', #{stockSource}, '%') + and rs.department_no like concat('%', #{departmentNo}, '%') + and rs.customer_no like concat('%', #{customerNo}, '%') + and rs.class_no like concat('%', #{classNo}, '%') + and rs.supplier_no like concat('%', #{supplierNo}, '%') and rs.stockin_id in ( select distinct stockin_id from receive_stockin_detail rsd @@ -195,3 +195,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + diff --git a/ruoyi-admin/src/main/resources/mapper/requestInterface/RequestLogMapper.xml b/ruoyi-admin/src/main/resources/mapper/requestInterface/RequestLogMapper.xml index 794571f..bae57b6 100644 --- a/ruoyi-admin/src/main/resources/mapper/requestInterface/RequestLogMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/requestInterface/RequestLogMapper.xml @@ -1,4 +1,4 @@ - + @@ -29,20 +29,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -112,10 +112,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" delete from request_log where request_id = #{requestId} + + + + + delete from request_log where request_id in #{requestId} - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/resources/mapper/search/ViewInJobFlowMapper.xml b/ruoyi-admin/src/main/resources/mapper/search/ViewInJobFlowMapper.xml index 60b2b8d..5ca5fde 100644 --- a/ruoyi-admin/src/main/resources/mapper/search/ViewInJobFlowMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/search/ViewInJobFlowMapper.xml @@ -1,4 +1,4 @@ - + @@ -64,50 +64,50 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and job_id like concat('%', #{jobId}, '%') - and status = #{status} - and on_line_type = #{onLineType} + and status like concat('%', #{status}, '%') + and on_line_type like concat('%', #{onLineType}, '%') and task_no like concat('%', #{taskNo}, '%') - and supplier_id = #{supplierId} - and customer_id = #{customerId} - and department_id = #{departmentId} + and supplier_id like concat('%', #{supplierId}, '%') + and customer_id like concat('%', #{customerId}, '%') + and department_id like concat('%', #{departmentId}, '%') and tray_code like concat('%', #{trayCode}, '%') - and roadway_id = #{roadwayId} - and cargo_space_id = #{cargoSpaceId} - and target_roadway_id = #{targetRoadwayId} - and target_cargo_space_id = #{targetCargoSpaceId} + and roadway_id like concat('%', #{roadwayId}, '%') + and cargo_space_id like concat('%', #{cargoSpaceId}, '%') + and target_roadway_id like concat('%', #{targetRoadwayId}, '%') + and target_cargo_space_id like concat('%', #{targetCargoSpaceId}, '%') and line_id like concat('%', #{lineId}, '%') - and workshop_id = #{workshopId} - and priority = #{priority} - and execution_phase = #{executionPhase} - and in_or_out = #{inOrOut} - and start_time = #{startTime} - and finish_time = #{finishTime} - and entrance_id = #{entranceId} - and exit_id = #{exitId} - and class_id = #{classId} - and warehouse_id = #{warehouseId} - and fault_flag = #{faultFlag} - and job_detail_id = #{jobDetailId} - and stock_id = #{stockId} - and lot_no = #{lotNo} - and in_date = #{inDate} - and in_or_out_id = #{inOrOutId} - and in_or_out_d_id = #{inOrOutDId} - and product_guid = #{productGuid} - and stock_status = #{stockStatus} - and in_quantity = #{inQuantity} - and stock_quantity = #{stockQuantity} - and out_quantity = #{outQuantity} - and stockin_id = #{stockinId} - and stacking_id = #{stackingId} - and spare1 = #{spare1} - and spare2 = #{spare2} - and spare3 = #{spare3} - and stockin_detail_id = #{stockinDetailId} - and spare5 = #{spare5} - and spare6 = #{spare6} - and spec = #{spec} - and unit = #{unit} + and workshop_id like concat('%', #{workshopId}, '%') + and priority like concat('%', #{priority}, '%') + and execution_phase like concat('%', #{executionPhase}, '%') + and in_or_out like concat('%', #{inOrOut}, '%') + and start_time like concat('%', #{startTime}, '%') + and finish_time like concat('%', #{finishTime}, '%') + and entrance_id like concat('%', #{entranceId}, '%') + and exit_id like concat('%', #{exitId}, '%') + and class_id like concat('%', #{classId}, '%') + and warehouse_id like concat('%', #{warehouseId}, '%') + and fault_flag like concat('%', #{faultFlag}, '%') + and job_detail_id like concat('%', #{jobDetailId}, '%') + and stock_id like concat('%', #{stockId}, '%') + and lot_no like concat('%', #{lotNo}, '%') + and in_date like concat('%', #{inDate}, '%') + and in_or_out_id like concat('%', #{inOrOutId}, '%') + and in_or_out_d_id like concat('%', #{inOrOutDId}, '%') + and product_guid like concat('%', #{productGuid}, '%') + and stock_status like concat('%', #{stockStatus}, '%') + and in_quantity like concat('%', #{inQuantity}, '%') + and stock_quantity like concat('%', #{stockQuantity}, '%') + and out_quantity like concat('%', #{outQuantity}, '%') + and stockin_id like concat('%', #{stockinId}, '%') + and stacking_id like concat('%', #{stackingId}, '%') + and spare1 like concat('%', #{spare1}, '%') + and spare2 like concat('%', #{spare2}, '%') + and spare3 like concat('%', #{spare3}, '%') + and stockin_detail_id like concat('%', #{stockinDetailId}, '%') + and spare5 like concat('%', #{spare5}, '%') + and spare6 like concat('%', #{spare6}, '%') + and spec like concat('%', #{spec}, '%') + and unit like concat('%', #{unit}, '%') and product_id like concat('%', #{productId}, '%') and product_name like concat('%', #{productName}, '%') and cargo_space_name like concat('%', #{cargoSpaceName}, '%') @@ -290,4 +290,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{jobId} - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/resources/mapper/search/ViewOutJobFlowMapper.xml b/ruoyi-admin/src/main/resources/mapper/search/ViewOutJobFlowMapper.xml index 69d3e3a..2522f3e 100644 --- a/ruoyi-admin/src/main/resources/mapper/search/ViewOutJobFlowMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/search/ViewOutJobFlowMapper.xml @@ -1,4 +1,4 @@ - + @@ -64,50 +64,50 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and job_id like concat('%', #{jobId}, '%') - and status = #{status} - and on_line_type = #{onLineType} + and status like concat('%', #{status}, '%') + and on_line_type like concat('%', #{onLineType}, '%') and task_no like concat('%', #{taskNo}, '%') - and supplier_id = #{supplierId} - and customer_id = #{customerId} - and department_id = #{departmentId} + and supplier_id like concat('%', #{supplierId}, '%') + and customer_id like concat('%', #{customerId}, '%') + and department_id like concat('%', #{departmentId}, '%') and tray_code like concat('%', #{trayCode}, '%') - and roadway_id = #{roadwayId} - and cargo_space_id = #{cargoSpaceId} - and target_roadway_id = #{targetRoadwayId} - and target_cargo_space_id = #{targetCargoSpaceId} + and roadway_id like concat('%', #{roadwayId}, '%') + and cargo_space_id like concat('%', #{cargoSpaceId}, '%') + and target_roadway_id like concat('%', #{targetRoadwayId}, '%') + and target_cargo_space_id like concat('%', #{targetCargoSpaceId}, '%') and line_id like concat('%', #{lineId}, '%') - and workshop_id = #{workshopId} - and priority = #{priority} - and execution_phase = #{executionPhase} - and in_or_out = #{inOrOut} - and start_time = #{startTime} - and finish_time = #{finishTime} - and entrance_id = #{entranceId} - and exit_id = #{exitId} - and class_id = #{classId} - and warehouse_id = #{warehouseId} - and fault_flag = #{faultFlag} - and job_detail_id = #{jobDetailId} - and stock_id = #{stockId} - and lot_no = #{lotNo} - and in_date = #{inDate} - and in_or_out_id = #{inOrOutId} - and in_or_out_d_id = #{inOrOutDId} - and product_guid = #{productGuid} - and stock_status = #{stockStatus} - and in_quantity = #{inQuantity} - and stock_quantity = #{stockQuantity} - and out_quantity = #{outQuantity} - and stockin_id = #{stockinId} - and stacking_id = #{stackingId} - and spare1 = #{spare1} - and spare2 = #{spare2} - and spare3 = #{spare3} - and stockin_detail_id = #{stockinDetailId} + and workshop_id like concat('%', #{workshopId}, '%') + and priority like concat('%', #{priority}, '%') + and execution_phase like concat('%', #{executionPhase}, '%') + and in_or_out like concat('%', #{inOrOut}, '%') + and start_time like concat('%', #{startTime}, '%') + and finish_time like concat('%', #{finishTime}, '%') + and entrance_id like concat('%', #{entranceId}, '%') + and exit_id like concat('%', #{exitId}, '%') + and class_id like concat('%', #{classId}, '%') + and warehouse_id like concat('%', #{warehouseId}, '%') + and fault_flag like concat('%', #{faultFlag}, '%') + and job_detail_id like concat('%', #{jobDetailId}, '%') + and stock_id like concat('%', #{stockId}, '%') + and lot_no like concat('%', #{lotNo}, '%') + and in_date like concat('%', #{inDate}, '%') + and in_or_out_id like concat('%', #{inOrOutId}, '%') + and in_or_out_d_id like concat('%', #{inOrOutDId}, '%') + and product_guid like concat('%', #{productGuid}, '%') + and stock_status like concat('%', #{stockStatus}, '%') + and in_quantity like concat('%', #{inQuantity}, '%') + and stock_quantity like concat('%', #{stockQuantity}, '%') + and out_quantity like concat('%', #{outQuantity}, '%') + and stockin_id like concat('%', #{stockinId}, '%') + and stacking_id like concat('%', #{stackingId}, '%') + and spare1 like concat('%', #{spare1}, '%') + and spare2 like concat('%', #{spare2}, '%') + and spare3 like concat('%', #{spare3}, '%') + and stockin_detail_id like concat('%', #{stockinDetailId}, '%') and spare5 like concat('%', #{spare5}, '%') - and spare6 = #{spare6} - and spec = #{spec} - and unit = #{unit} + and spare6 like concat('%', #{spare6}, '%') + and spec like concat('%', #{spec}, '%') + and unit like concat('%', #{unit}, '%') and product_id like concat('%', #{productId}, '%') and product_name like concat('%', #{productName}, '%') and cargo_space_name like concat('%', #{cargoSpaceName}, '%') @@ -290,4 +290,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{jobId} - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/resources/mapper/search/ViewStockDetailMapper.xml b/ruoyi-admin/src/main/resources/mapper/search/ViewStockDetailMapper.xml index 6881df7..ecb5e5d 100644 --- a/ruoyi-admin/src/main/resources/mapper/search/ViewStockDetailMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/search/ViewStockDetailMapper.xml @@ -1,4 +1,4 @@ - + @@ -54,46 +54,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -246,4 +246,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{onlyIdentity} - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/resources/mapper/search/ViewStockSecureMapper.xml b/ruoyi-admin/src/main/resources/mapper/search/ViewStockSecureMapper.xml index 3c958a5..2cc2774 100644 --- a/ruoyi-admin/src/main/resources/mapper/search/ViewStockSecureMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/search/ViewStockSecureMapper.xml @@ -1,4 +1,4 @@ - + @@ -103,8 +103,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and stock_id like concat('%', #{stockId}, '%') and cargo_space_id like concat('%', #{cargoSpaceId}, '%') - and stock_status = #{stockStatus} - and product_status = #{productStatus} + and stock_status like concat('%', #{stockStatus}, '%') + and product_status like concat('%', #{productStatus}, '%') and lot_no like concat('%', #{lotNo}, '%') and in_date like concat('%', #{inDate}, '%') and back_date like concat('%', #{backDate}, '%') @@ -114,7 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and out_quantity like concat('%', #{outQuantity}, '%') and stockin_detail_id like concat('%', #{stockinDetailId}, '%') and stockin_id like concat('%', #{stockinId}, '%') - and in_type = #{inType} + and in_type like concat('%', #{inType}, '%') and in_class_id like concat('%', #{inClassId}, '%') and warehouse_id like concat('%', #{warehouseId}, '%') and stacking_id like concat('%', #{stackingId}, '%') @@ -123,7 +123,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and c_desc like concat('%', #{cDesc}, '%') and warehouse_kind like concat('%', #{warehouseKind}, '%') and warehouse_type like concat('%', #{warehouseType}, '%') - and is_current = #{isCurrent} + and is_current like concat('%', #{isCurrent}, '%') and product_guid like concat('%', #{productGuid}, '%') and product_id like concat('%', #{productId}, '%') and parent_id like concat('%', #{parentId}, '%') @@ -180,8 +180,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and the_platoon like concat('%', #{thePlatoon}, '%') and the_column like concat('%', #{theColumn}, '%') and the_floor like concat('%', #{theFloor}, '%') - and cargo_status = #{cargoStatus} - and locked = #{locked} + and cargo_status like concat('%', #{cargoStatus}, '%') + and locked like concat('%', #{locked}, '%') and cargo_hight like concat('%', #{cargoHight}, '%') and iss_double like concat('%', #{issDouble}, '%') and group_coding_no like concat('%', #{groupCodingNo}, '%') @@ -481,4 +481,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{stockId} - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/resources/mapper/search/ViewStockWarningMapper.xml b/ruoyi-admin/src/main/resources/mapper/search/ViewStockWarningMapper.xml index abea5e6..a5d82bd 100644 --- a/ruoyi-admin/src/main/resources/mapper/search/ViewStockWarningMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/search/ViewStockWarningMapper.xml @@ -1,4 +1,4 @@ - + @@ -103,8 +103,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and stock_id like concat('%', #{stockId}, '%') and cargo_space_id like concat('%', #{cargoSpaceId}, '%') - and stock_status = #{stockStatus} - and product_status = #{productStatus} + and stock_status like concat('%', #{stockStatus}, '%') + and product_status like concat('%', #{productStatus}, '%') and lot_no like concat('%', #{lotNo}, '%') and in_date like concat('%', #{inDate}, '%') and back_date like concat('%', #{backDate}, '%') @@ -114,7 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and out_quantity like concat('%', #{outQuantity}, '%') and stockin_detail_id like concat('%', #{stockinDetailId}, '%') and stockin_id like concat('%', #{stockinId}, '%') - and in_type = #{inType} + and in_type like concat('%', #{inType}, '%') and in_class_id like concat('%', #{inClassId}, '%') and warehouse_id like concat('%', #{warehouseId}, '%') and stacking_id like concat('%', #{stackingId}, '%') @@ -180,8 +180,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and the_platoon like concat('%', #{thePlatoon}, '%') and the_column like concat('%', #{theColumn}, '%') and the_floor like concat('%', #{theFloor}, '%') - and cargo_status = #{cargoStatus} - and locked = #{locked} + and cargo_status like concat('%', #{cargoStatus}, '%') + and locked like concat('%', #{locked}, '%') and cargo_hight like concat('%', #{cargoHight}, '%') and iss_double like concat('%', #{issDouble}, '%') and group_coding_no like concat('%', #{groupCodingNo}, '%') @@ -481,4 +481,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{stockId} - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/resources/mapper/search/ViewStockinHistoryMapper.xml b/ruoyi-admin/src/main/resources/mapper/search/ViewStockinHistoryMapper.xml index ee6b8ca..87fdbf3 100644 --- a/ruoyi-admin/src/main/resources/mapper/search/ViewStockinHistoryMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/search/ViewStockinHistoryMapper.xml @@ -1,4 +1,4 @@ - + @@ -53,43 +53,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -240,4 +240,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{stockinGuid} - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/resources/mapper/search/ViewStockoutHistoryMapper.xml b/ruoyi-admin/src/main/resources/mapper/search/ViewStockoutHistoryMapper.xml index ba2e846..a200e57 100644 --- a/ruoyi-admin/src/main/resources/mapper/search/ViewStockoutHistoryMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/search/ViewStockoutHistoryMapper.xml @@ -1,4 +1,4 @@ - + @@ -45,36 +45,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -200,4 +200,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{stockoutGuid} - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/resources/mapper/stock/BasStockFreezeRecordMapper.xml b/ruoyi-admin/src/main/resources/mapper/stock/BasStockFreezeRecordMapper.xml index 33487a0..ac95dfb 100644 --- a/ruoyi-admin/src/main/resources/mapper/stock/BasStockFreezeRecordMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/stock/BasStockFreezeRecordMapper.xml @@ -1,4 +1,4 @@ - + @@ -37,22 +37,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - and stock_id = #{stockId} - and bsmr.cargo_space_id = #{cargoSpaceId} - and bsmr.tray_code = #{trayCode} - and product_id = #{productId} + and stock_id like concat('%', #{stockId}, '%') + and bsmr.cargo_space_id like concat('%', #{cargoSpaceId}, '%') + and bsmr.tray_code like concat('%', #{trayCode}, '%') + and product_id like concat('%', #{productId}, '%') and product_name like concat('%', #{productName}, '%') - and print_date = #{printDate} - and lot_no = #{lotNo} - and old_quantity = #{oldQuantity} - and quantity = #{quantity} - and method = #{method} - and bsmr.warehouse_id = #{warehouseId} - and stock_detail_id = #{stockDetailId} - and operating_target = #{operatingTarget} - and bar_code_old_quantity = #{barCodeOldQuantity} - and bar_code_quantity = #{barCodeQuantity} - and product_guid = #{productGuid} + and print_date like concat('%', #{printDate}, '%') + and lot_no like concat('%', #{lotNo}, '%') + and old_quantity like concat('%', #{oldQuantity}, '%') + and quantity like concat('%', #{quantity}, '%') + and method like concat('%', #{method}, '%') + and bsmr.warehouse_id like concat('%', #{warehouseId}, '%') + and stock_detail_id like concat('%', #{stockDetailId}, '%') + and operating_target like concat('%', #{operatingTarget}, '%') + and bar_code_old_quantity like concat('%', #{barCodeOldQuantity}, '%') + and bar_code_quantity like concat('%', #{barCodeQuantity}, '%') + and product_guid like concat('%', #{productGuid}, '%') ${params.warehouseDataScope} @@ -144,3 +144,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + diff --git a/ruoyi-admin/src/main/resources/mapper/stock/BasStockMapper.xml b/ruoyi-admin/src/main/resources/mapper/stock/BasStockMapper.xml index b24b53c..ffa78de 100644 --- a/ruoyi-admin/src/main/resources/mapper/stock/BasStockMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/stock/BasStockMapper.xml @@ -1,123 +1,283 @@ - + + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - select bs.stock_id, bs.cargo_space_id, bs.stock_status, bs.product_status, bs.lot_no, bs.in_date, - bs.back_date, bs.product_guid, bs.quantity, bs.job_id, bs.tray_code, bs.out_quantity, - bs.stockin_detail_id, bs.stockin_id, bs.in_type, bs.in_class_id, bs.warehouse_id, bs.stacking_id, - bs.spare1, bs.spare2, bs.spare3, bs.spare4, bs.spare5, bs.spare6 , - bs.voltage,bs.power,bs.phase,bs.net_weight,bs.gross_weight,bs.distribution,bs.model,bs.order_id, - bs.product_name,bp.spare1 as englishDesc, - bp.spare2 as netWeight,bp.spare5 as length,bp.spare6 as width,bp.spare7 as height,bp.spare8 as volume,bw.warehouse_name,bs.product_id, - bcs.locked,bcs.cargo_space_name,bcs.status as cargoSpaceStockStatus + select bs.stock_id, + bs.cargo_space_id, + bs.stock_status, + bs.product_status, + bs.lot_no, + bs.in_date, + bs.back_date, + bs.product_guid, + bs.quantity, + bs.job_id, + bs.tray_code, + bs.out_quantity, + bs.stockin_detail_id, + bs.stockin_id, + bs.in_type, + bs.in_class_id, + bs.warehouse_id, + bs.stacking_id, + bs.spare1, + bs.spare2, + bs.spare3, + bs.spare4, + bs.spare5, + bs.spare6, + bs.voltage, + bs.power, + bs.phase, + bs.net_weight, + bs.gross_weight, + bs.distribution, + bs.model, + bs.order_id, + bs.product_name, + bp.spare1 as englishDesc, + bp.spare2 as netWeight, + bp.spare5 as length, + bp.spare6 as width, + bp.spare7 as height, + bp.spare8 as volume, + bw.warehouse_name, + bs.product_id, + bcs.locked, + bcs.cargo_space_name, + bcs.status as cargoSpaceStockStatus from bas_stock bs - left join bas_product bp on bs.product_id = bp.product_id - left join bas_warehouse bw on bs.warehouse_id = bw.warehouse_id - left join bas_cargo_space bcs on bs.cargo_space_id = bcs.cargo_space_id + left join bas_product bp on bs.product_id = bp.product_id + left join bas_warehouse bw on bs.warehouse_id = bw.warehouse_id + left join bas_cargo_space bcs on bs.cargo_space_id = bcs.cargo_space_id + + + + + + + insert into bas_stock @@ -146,7 +306,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" spare5, spare6, product_id, - + #{stockId}, #{cargoSpaceId}, @@ -173,18 +333,62 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{spare5}, #{spare6}, #{productId}, - + INSERT INTO bas_stock - (stock_id,cargo_space_id,stock_status,product_status,lot_no,in_date,back_date,product_guid,quantity,job_id,tray_code,out_quantity,stockin_detail_id,stockin_id,in_type,in_class_id,warehouse_id,stacking_id,spare1,spare2,spare3,spare4,spare5,spare6,product_id,product_name,voltage,power,phase,net_weight,gross_weight,distribution,model,order_id,spare7) + (stock_id,cargo_space_id,stock_status,product_status,lot_no,in_date,back_date,product_guid,quantity,job_id,tray_code,out_quantity,stockin_detail_id,stockin_id,in_type,in_class_id,warehouse_id,stacking_id,spare1,spare2,spare3,spare4,spare5,spare6,product_id,product_name,voltage,power,phase,net_weight,gross_weight,distribution,model,order_id,spare7) VALUES - - (#{item.stockId},#{item.cargoSpaceId},#{item.stockStatus},#{item.productStatus},#{item.lotNo},#{item.inDate},#{item.backDate},#{item.productGuid},#{item.quantity},#{item.jobId},#{item.trayCode},#{item.outQuantity},#{item.stockinDetailId},#{item.stockinId},#{item.inType},#{item.inClassId},#{item.warehouseId},#{item.stackingId},#{item.spare1},#{item.spare2},#{item.spare3},#{item.spare4},#{item.spare5},#{item.spare6},#{item.productId} - ,#{item.productName},#{item.voltage},#{item.power},#{item.phase},#{item.netWeight},#{item.grossWeight},#{item.distribution},#{item.model},#{item.orderId},#{item.spare7}) - + + (#{item.stockId},#{item.cargoSpaceId},#{item.stockStatus},#{item.productStatus},#{item.lotNo},#{item.inDate},#{item.backDate},#{item.productGuid},#{item.quantity},#{item.jobId},#{item.trayCode},#{item.outQuantity},#{item.stockinDetailId},#{item.stockinId},#{item.inType},#{item.inClassId},#{item.warehouseId},#{item.stackingId},#{item.spare1},#{item.spare2},#{item.spare3},#{item.spare4},#{item.spare5},#{item.spare6},#{item.productId} + ,#{item.productName},#{item.voltage},#{item.power},#{item.phase},#{item.netWeight},#{item.grossWeight},#{item.distribution},#{item.model},#{item.orderId},#{item.spare7}) + + + + + update bas_stock + + + update bas_stock_hc + + + update bas_stock + + + + + cargo_space_id = #{cargoSpaceId}, + stock_status = #{stockStatus}, + product_status = #{productStatus}, + lot_no = #{lotNo}, + in_date = #{inDate}, + back_date = #{backDate}, + product_guid = #{productGuid}, + quantity = #{quantity}, + job_id = #{jobId}, + tray_code = #{trayCode}, + out_quantity = #{outQuantity}, + stockin_detail_id = #{stockinDetailId}, + stockin_id = #{stockinId}, + in_type = #{inType}, + in_class_id = #{inClassId}, + warehouse_id = #{warehouseId}, + stacking_id = #{stackingId}, + spare1 = #{spare1}, + spare2 = #{spare2}, + spare3 = #{spare3}, + spare4 = #{spare4}, + spare5 = #{spare5}, + spare6 = #{spare6}, + product_id = #{productId}, + + + WHERE stock_id = #{stockId} + + + update bas_stock @@ -216,14 +420,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where stock_id = #{stockId} - update bas_stock set stock_status = #{stockStatus} where tray_code = #{trayCode} + update bas_stock + set stock_status = #{stockStatus} + where tray_code = #{trayCode} - update bas_stock set spare7 = '0' + update bas_stock + set spare7 = '0' - delete from bas_stock where stock_id = #{stockId} + delete + from bas_stock + where stock_id = #{stockId} @@ -233,11 +442,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + delete from bas_stock where stock_id in + + + delete from bas_stock_hc where stock_id in + + + delete from bas_stock where stock_id in + + + + #{stockId} + + + + + + + + + + + + + + + select bs.stock_id, + bs.cargo_space_id, + bs.stock_status, + bs.product_status, + bs.lot_no, + bs.in_date, + bs.back_date, + bs.product_guid, + bs.quantity, + bs.job_id, + bs.tray_code, + bs.out_quantity, + bs.stockin_detail_id, + bs.stockin_id, + bs.in_type, + bs.in_class_id, + bs.warehouse_id, + bs.stacking_id, + bs.spare1, + bs.spare2, + bs.spare3, + bs.spare4, + bs.spare5, + bs.spare6, + bs.voltage, + bs.power, + bs.phase, + bs.net_weight, + bs.gross_weight, + bs.distribution, + bs.model, + bs.order_id, + bs.product_name, + bs.product_id + from bas_stock_hc bs + + + diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java index edd56ef..d53cf4e 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -100,7 +100,7 @@ public class SecurityConfig .authorizeHttpRequests((requests) -> { permitAllUrl.getUrls().forEach(url -> requests.requestMatchers(url).permitAll()); // 对于登录login 注册register 验证码captchaImage 允许匿名访问 - requests.requestMatchers("/login", "/register", "/captchaImage").permitAll() + requests.requestMatchers("/login", "/register", "/captchaImage", "/system/license/active").permitAll() // 静态资源,可匿名访问 .requestMatchers(HttpMethod.GET, "/", "/*.html", "/**.html", "/**.css", "/**.js", "/profile/**").permitAll() .requestMatchers("/swagger-ui.html", "/v3/api-docs/**", "/swagger-ui/**", "/druid/**").permitAll() diff --git a/ruoyi-ui/.env.development b/ruoyi-ui/.env.development index a8531ba..bae6a96 100644 --- a/ruoyi-ui/.env.development +++ b/ruoyi-ui/.env.development @@ -1,5 +1,5 @@ # 页面标题 -VUE_APP_TITLE = "ForTucky WMS system" +VUE_APP_TITLE = "艾度 WMS system" # 开发环境配置 ENV = 'development' diff --git a/ruoyi-ui/.env.production b/ruoyi-ui/.env.production index 8074604..061cea2 100644 --- a/ruoyi-ui/.env.production +++ b/ruoyi-ui/.env.production @@ -1,5 +1,5 @@ # 页面标题 -VUE_APP_TITLE = "ForTucky WMS system" +VUE_APP_TITLE = "艾度 WMS system" # 生产环境配置 ENV = 'production' diff --git a/ruoyi-ui/.env.staging b/ruoyi-ui/.env.staging index dbe8edd..ae39ce6 100644 --- a/ruoyi-ui/.env.staging +++ b/ruoyi-ui/.env.staging @@ -1,5 +1,5 @@ # 页面标题 -VUE_APP_TITLE = "ForTucky WMS system" +VUE_APP_TITLE = "艾度 WMS system" BABEL_ENV = production diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index c98ae7c..dee870a 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -44,6 +44,7 @@ "sortablejs": "1.10.2", "splitpanes": "2.4.1", "vue": "2.6.12", + "vue-barcode": "^1.3.0", "vue-count-to": "1.0.13", "vue-cropper": "0.5.5", "vue-easy-print": "^0.0.8", diff --git a/ruoyi-ui/src/api/requestInterface/log.js b/ruoyi-ui/src/api/requestInterface/log.js index 123dca1..39ba634 100644 --- a/ruoyi-ui/src/api/requestInterface/log.js +++ b/ruoyi-ui/src/api/requestInterface/log.js @@ -9,6 +9,30 @@ export function listLog(query) { }) } + +export function getMethod() { + return request({ + url: '/requestInterface/log/getMethod', + method: 'get' + + }) +} + +export function getSource() { + return request({ + url: '/requestInterface/log/getSource', + method: 'get' + + }) +} + +export function getTarget() { + return request({ + url: '/requestInterface/log/getTarget', + method: 'get' + + }) +} // 查询接口记录详细 export function getLog(requestId) { return request({ diff --git a/ruoyi-ui/src/api/stock/management.js b/ruoyi-ui/src/api/stock/management.js index a1873b6..3add5d7 100644 --- a/ruoyi-ui/src/api/stock/management.js +++ b/ruoyi-ui/src/api/stock/management.js @@ -10,10 +10,11 @@ export function listManagement(query) { } // 查询库存信息详细 -export function getManagement(stockId) { +export function getManagement(stockId, warehouseCode) { return request({ url: '/stock/management/' + stockId, - method: 'get' + method: 'get', + params: {"warehouseCode": warehouseCode} }) } @@ -45,12 +46,14 @@ export function updateManagement(data) { } // 删除库存信息 -export function delManagement(stockId) { +export function delManagement(stockId, warehouseCode) { return request({ url: '/stock/management/' + stockId, - method: 'delete' + method: 'delete', + params: {"warehouseCode": warehouseCode} }) } + //重置盘点记录 export function resetPdRecord() { return request({ diff --git a/ruoyi-ui/src/components/Pagination/index.vue b/ruoyi-ui/src/components/Pagination/index.vue index 08ac487..eda541b 100644 --- a/ruoyi-ui/src/components/Pagination/index.vue +++ b/ruoyi-ui/src/components/Pagination/index.vue @@ -36,7 +36,7 @@ export default { pageSizes: { type: Array, default() { - return [10, 20, 30, 50] + return [10, 50, 100, 1000] } }, // 移动端页码按钮的数量端默认值5 diff --git a/ruoyi-ui/src/layout/components/Navbar.vue b/ruoyi-ui/src/layout/components/Navbar.vue index 8b51fc4..a210626 100644 --- a/ruoyi-ui/src/layout/components/Navbar.vue +++ b/ruoyi-ui/src/layout/components/Navbar.vue @@ -5,6 +5,11 @@ +
+ + 系统授权将于 {{ licenseExpireText }} 后过期,请及时联系管理员续期 +
+