Compare commits

...

153 Commits

Author SHA1 Message Date
0e2cd55fbd refactor(消息通知): 通知内容增加“订单号” 2025-01-07 14:24:02 +08:00
888335a5bc feat(消息通知): 增加agv小车到达通知 2025-01-07 14:22:32 +08:00
a425fd5ea4 refactor(出库计划): 消息提示 2025-01-06 17:24:27 +08:00
9736e66955 feat(消息): 增加“新增消息提示”方法 2025-01-06 17:22:19 +08:00
60357038df refactor(入库计划明细实体): 增加入库计划校验 2025-01-06 17:19:53 +08:00
55b1024f4d refactor(消息通知): 设置lombok 2025-01-06 10:02:32 +08:00
c10fd69aa3 refactor(组刀任务): 设置lombok 2025-01-06 10:02:14 +08:00
039b84258b refactor(入库计划): 实体类方法名修改,移除无用依赖 2025-01-05 20:41:33 +08:00
6536b1c7c3 refactor(入库计划): 实体类方法名修改,移除无用依赖 2025-01-05 20:39:42 +08:00
76252a3479 feat(入库计划): 根据订单生成入库计划并执行 2025-01-04 15:39:02 +08:00
3b5dcf7bbf refactor(入库任务): 执行任务方法,优化对入库类型的判断 2025-01-04 15:19:11 +08:00
99de619c66 feat(出库计划): 订单出库计划,设置备注 2025-01-04 15:01:15 +08:00
89b03eb93b feat(台账): 根据rfid查询台账信息 2025-01-04 11:51:59 +08:00
7a518435b4 refactor(入库计划): 封装自动分配库位 2025-01-04 11:33:23 +08:00
5e391eca1d refactor(台账): lombok 2025-01-04 11:31:22 +08:00
9c9e637002 refactor(入库计划): 重命名 2025-01-04 10:38:03 +08:00
b33f19488d refactor(出库任务): try 2025-01-04 10:11:42 +08:00
96792d32c0 feat(入库计划): 增加 插入并运行入库计划 服务,优化事务 2025-01-04 10:11:13 +08:00
aaf54b032e refactor(小型刀具库): 借领退还服务,移除无用引入 2025-01-04 10:10:03 +08:00
f52b014aa0 refactor(入库计划详情): 实体类重命名 2025-01-04 10:09:09 +08:00
005be7233a feat(出库): 新增根据订单号出库接口-开放 2025-01-04 08:52:44 +08:00
6c7aed9e16 doc: 格式化 2025-01-04 08:51:46 +08:00
57e6046dc6 refactor: 设置lombok 2025-01-03 21:49:40 +08:00
f5908f1ce4 refactor: 设置lombok 2025-01-03 16:07:33 +08:00
fbe60c4e25 refactor: 出入库类型,设置lombok;增加根据编码查询类型service;typeID类型修改 2025-01-03 16:03:54 +08:00
89eeea78a5 refactor: lombok 2025-01-03 14:56:22 +08:00
eaf2b3ee82 台账出入库明细解开注释 2024-12-20 15:13:10 +08:00
d5904db69a 组装任务生成出库任务绑定明细ID 2024-12-20 10:54:51 +08:00
7c3a232e11 预订表查询物料为空返回空集合 2024-12-20 10:30:57 +08:00
3d9d42019f 生产准备优化 2024-12-19 16:57:23 +08:00
d2ec3f0d79 入库执行解绑订单 2024-12-19 10:27:47 +08:00
8423154873 refactor: 入库计划注释 2024-12-19 10:10:24 +08:00
55ecf2a407 refactor: 入库任务lombok 2024-12-19 10:08:50 +08:00
1ab8185446 refactor: 入库任务查询增加实体 2024-12-19 10:04:54 +08:00
2b39cf8531 Merge remote-tracking branch 'origin/master' 2024-12-19 10:00:04 +08:00
3e1d3f95d1 入库任务执行触发给产线控制系统发生产准备完成请求 2024-12-19 09:58:21 +08:00
c75117d693 fix: 出库任务修复 2024-12-18 17:38:03 +08:00
6622be6dc6 Merge remote-tracking branch 'origin/master' 2024-12-18 11:24:46 +08:00
a17bd18444 修正算法BUG 2024-12-18 11:24:38 +08:00
7a7a809d4d Merge remote-tracking branch 'origin/master' 2024-12-18 10:09:32 +08:00
a6ef663686 refactor: 完善webservice服务 2024-12-18 10:09:16 +08:00
b8a861c5c1 完成入库计划显示库位物料信息,完成整刀rfid根据物料编码加序号自动生成,完成开放更新整刀寿命接口 2024-12-17 17:47:46 +08:00
43bb62dbdc Merge remote-tracking branch 'origin/master' 2024-12-17 11:47:54 +08:00
c6d436526d 初步完成整刀入库机制 2024-12-17 11:47:36 +08:00
ef88d6829e feat: 新增webservice库,同步主数据平台数据 2024-12-17 10:30:28 +08:00
5358dcca31 重命名函数 2024-12-17 10:16:27 +08:00
2e2ff79029 增加限制 2024-12-17 10:15:19 +08:00
2e81d77dee 编写获取一个库位接口 2024-12-17 09:39:31 +08:00
2b8219d01e 修正错误 2024-12-16 17:17:06 +08:00
2ea01a7fff 完善大号物料字段 2024-12-16 16:15:53 +08:00
38bf3825c7 完善注释 2024-12-16 16:03:28 +08:00
29d94ed120 完善注释 2024-12-16 15:36:41 +08:00
f778310a0d 格式化代码 2024-12-16 15:19:29 +08:00
2ccb15dd98 增加注释 2024-12-16 14:41:30 +08:00
c35381b6f6 完成出库任务公开列表增加台账实体数据 2024-12-16 10:44:37 +08:00
655f0ab225 完成出库计划新增接口,并自动执行出库计划,在数量等条件满足的情况下生成相应的出库任务 2024-12-16 10:04:30 +08:00
8fad8ba16c refactor: 完善小型刀具库同步 2024-12-16 08:48:06 +08:00
19ffe615e5 refactor: 系统说明文档补充项目启动问题 2024-12-15 22:19:23 +08:00
68e6158ab0 完善提示信息 2024-12-13 16:50:16 +08:00
c0fc567b10 完善同步代码 2024-12-13 15:57:59 +08:00
e19e5f36be 领料单 2024-12-13 15:41:41 +08:00
998d37e2a2 Merge remote-tracking branch 'origin/master' 2024-12-13 15:15:16 +08:00
3f81411d3e 修正问题 2024-12-13 15:15:04 +08:00
e9daa6b8fb refactor: 小型刀具库,出入库记录mapper优化 2024-12-13 15:06:23 +08:00
8b6f402634 Merge remote-tracking branch 'origin/master' 2024-12-13 14:44:37 +08:00
6632585c52 refactor: lombok 2024-12-13 14:44:22 +08:00
c3587c2b7e 删除多余 2024-12-13 14:42:55 +08:00
5d7374e50a Merge remote-tracking branch 'origin/master' 2024-12-13 14:39:13 +08:00
e9a45fe507 完善 2024-12-13 14:39:03 +08:00
b608fcb2bf refactor(物料管理): 同步小型刀具库功能完善 2024-12-13 14:38:48 +08:00
36fdaa5687 refactor(入库任务): 批量执行任务,优化 2024-12-13 14:37:58 +08:00
ec39dfceb7 refactor(出库计划): 语法优化 2024-12-13 14:37:25 +08:00
093aa1aeb4 fix(出库任务): 修复缺少库位信息问题 2024-12-13 14:34:02 +08:00
f30694d725 解除某些限制 2024-12-13 11:14:44 +08:00
8401995c8c 完善Mapper 2024-12-13 11:14:20 +08:00
9ec7cf67d9 编写库存调整AP0AD实体类 2024-12-13 10:53:24 +08:00
78494b7370 Merge remote-tracking branch 'origin/master' 2024-12-12 16:16:09 +08:00
d66f5d21dc 绑定料箱包含隐藏物料 2024-12-12 16:13:20 +08:00
c44cd027c5 feat(小型刀具库): 物料信息表 2024-12-12 15:17:37 +08:00
5d9a9a71a8 refactor: lombok 2024-12-12 15:17:09 +08:00
69ddf38364 refactor: 配置文件修改,sqlserver连接密码修改 2024-12-12 14:42:21 +08:00
3029b48259 refactor: 配置文件修改 2024-12-12 11:28:03 +08:00
ffb885d0aa 初步完成生产准备中检索出其他订单中正在使用的刀具 2024-12-11 17:24:43 +08:00
009fbbf04d Merge remote-tracking branch 'origin/master' 2024-12-10 16:31:42 +08:00
42de681012 完成出库计划执行时自动匹配库位 2024-12-10 16:31:30 +08:00
b8133c3704 refactor: 注入优化 2024-12-10 16:30:05 +08:00
80c16a4ff5 feat: 新增lombok插件 2024-12-10 15:30:53 +08:00
a70e8f4c9b refactor(小型刀具库同步方法): 注入优化,方法名修改 2024-12-10 15:30:36 +08:00
1626935c8d refactor(出库计划): 自动生成计划编码 2024-12-09 14:55:23 +08:00
6e5da0821b Merge remote-tracking branch 'origin/master' 2024-12-09 14:05:59 +08:00
35f3067343 完善物料绑定前校验 2024-12-09 11:23:41 +08:00
9c3eb9d90e Merge remote-tracking branch 'origin/master'
# Conflicts:
#	ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInPlanServiceImpl.java
2024-12-09 11:22:55 +08:00
b588d1467c refactor(入库计划): 编码优化 2024-12-09 11:22:18 +08:00
431f1090a4 出库计划增加联查台账信息 2024-12-06 09:19:26 +08:00
1b549a52d1 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml
2024-12-05 17:41:58 +08:00
4eec2db42d 物料数量统计优化 2024-12-05 17:37:43 +08:00
c44c3b2b81 Merge remote-tracking branch 'origin/master' 2024-12-05 17:32:24 +08:00
d652822695 增加统计限制 2024-12-05 17:32:15 +08:00
aa38a0c6fb feat: 配置文件 2024-12-05 14:39:27 +08:00
2ddddd64ae feat: 同步小型刀具库数据 接口 2024-12-05 14:39:03 +08:00
dab1cc8caa 读取远程共享文件并监听 2024-12-05 14:23:46 +08:00
a6af0835ab feat: 新配置文件 2024-12-05 10:14:53 +08:00
ecfad3d012 自动同步改为手动同步 2024-12-05 09:36:06 +08:00
888ec3d875 Merge remote-tracking branch 'origin/master' 2024-12-04 10:41:03 +08:00
d14b1db70a 修正手持设备入库BUG 2024-12-04 10:39:13 +08:00
5c9ab8087b fix(入库任务): 通过rfid入库修复 2024-12-04 09:57:54 +08:00
ecc4090ec6 Merge remote-tracking branch 'origin/master' 2024-12-03 17:23:23 +08:00
8b451fe282 组装任务联调WCS优化,新增读取对刀仪代码,联调数据大屏接口 2024-12-03 17:19:51 +08:00
d5bf5f2999 feat(入库任务): 根据rfid查询入库任务 2024-12-02 17:01:54 +08:00
a80458d488 refactor(入库计划): 自动生成计划编码 2024-11-29 14:31:30 +08:00
a7021a27f4 feat(入库计划): 对接小型刀具库 2024-11-29 11:41:12 +08:00
50f434954f fix(入库计划): 语法错误修改 2024-11-29 11:29:59 +08:00
42ce332dbe Merge remote-tracking branch 'origin/master' 2024-11-29 09:39:39 +08:00
0de94143cd feat(入库计划): 执行任务方法,临时 2024-11-29 09:30:39 +08:00
42b1f93f4b feat(入库): 同步小型刀具库 2024-11-29 09:28:15 +08:00
72dac19897 Merge remote-tracking branch 'origin/master' 2024-11-29 09:27:04 +08:00
cf0e3d0739 Merge remote-tracking branch 'origin/master' 2024-11-29 09:16:50 +08:00
5fb40915c3 tjk 2024-11-29 09:16:50 +08:00
603aea2567 调试 2024-11-28 18:08:22 +08:00
24ed0ed36e 编写小型货柜出库表相关实体类与MAPPER 2024-11-28 17:32:16 +08:00
3e4b8929ca 关闭事务 2024-11-28 16:55:57 +08:00
528a8463f3 增加设置已读代码 2024-11-28 16:47:07 +08:00
8e210b75d6 Merge remote-tracking branch 'origin/master' 2024-11-28 16:45:38 +08:00
ada2cb73ac 编写同步出库计划代码 2024-11-28 16:45:01 +08:00
9705df6be2 改变校验方法 2024-11-28 16:05:30 +08:00
78a51123b6 refactor: 字段数据类型修改 2024-11-28 15:50:35 +08:00
262ffdd50c refactor: 字段数据类型修改 2024-11-28 15:49:25 +08:00
de37f12a8d feat: 增加 执行入库计划 2024-11-28 15:49:02 +08:00
a56d6c5752 Merge remote-tracking branch 'origin/master' 2024-11-28 14:43:48 +08:00
1d97037059 开放接口 2024-11-28 14:43:36 +08:00
bc55fd4e83 配置 2024-11-28 14:38:17 +08:00
9ae9de272d 忽略空数据 2024-11-28 14:25:34 +08:00
a1c16f0be6 增加异常抛出 2024-11-28 14:20:18 +08:00
a988e974d6 Merge remote-tracking branch 'origin/master' 2024-11-28 14:14:07 +08:00
256b910f14 忽略数量为0的记录 2024-11-28 14:14:00 +08:00
e96e1e21a1 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	ktg-mes/src/main/java/com/ktg/mes/md/controller/WmsOutPlanController.java
2024-11-28 11:05:30 +08:00
e407905d3c 完成技术验证代码 2024-11-28 11:02:34 +08:00
c2d5dbff3d Merge remote-tracking branch 'origin/master' 2024-11-28 11:01:11 +08:00
2739b0c695 将切换数据代码移动到MAPPER层 2024-11-28 10:59:40 +08:00
f06d14b301 修改服务层接口名称 2024-11-28 10:53:17 +08:00
467b1e1548 组装任务基础物料出库流程拆分 2024-11-28 10:52:31 +08:00
fede5e6540 完善接口 2024-11-28 10:40:23 +08:00
d1d2c72fbe 增加啊更新接口 2024-11-28 10:36:21 +08:00
17872182ea Merge remote-tracking branch 'origin/master' 2024-11-28 10:24:13 +08:00
39908d6b79 refactor: sqlserver 适配成功 2024-11-28 10:23:50 +08:00
bcfc66611f 开放执行接口 2024-11-28 09:40:21 +08:00
9ac0574f20 读取对刀xml文件 2024-11-28 09:08:31 +08:00
e21e66b291 refactor: sqlserver 适配 2024-11-27 20:41:39 +08:00
4941a50de5 SQLSERVER测试 2024-11-27 19:58:14 +08:00
d9992854e6 feat: 增加sqlserver数据源 2024-11-27 17:07:23 +08:00
bc00c4380c Merge remote-tracking branch 'origin/master' 2024-11-27 15:20:26 +08:00
a6dcee2ef3 增加手持设备新增料箱功能 2024-11-27 15:20:18 +08:00
152fc5d042 Revert "refactor: POM修改"
This reverts commit a73166c2
2024-11-27 10:06:53 +08:00
121 changed files with 6284 additions and 3050 deletions

View File

@ -1,2 +1,10 @@
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">工刀具库WMS</h1>
<p align="center">
# 项目启动
## 1. 拉取Maven依赖
## 2. 手动添加DM依赖
### Hibernate5.4
`mvn install:install-file -Dfile=[jar包路径] -DgroupId=com.dm.dialect -DartifactId=hibernate5 -Dversion=5.4 -Dpackaging=jar`
### DmJdbc
`mvn install:install-file -Dfile=[jar包路径] -DgroupId=com.dm -DartifactId=DmJdbcDriver -Dversion=1.8 -Dpackaging=jar`

View File

@ -30,6 +30,41 @@
<artifactId>springfox-boot-starter</artifactId>
</dependency>
<!-- 测试 -->
<!-- 测试所需 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<!--去除内嵌tomcat-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.tomcat.embed/tomcat-embed-websocket -->
<!--websocket依赖包-->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-websocket</artifactId>
<version>8.5.23</version>
</dependency>
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>
<!-- 防止进入swagger页面报类型转换错误排除3.0.0中的引用手动增加1.6.2版本 -->
<dependency>
<groupId>io.swagger</groupId>
@ -72,15 +107,22 @@
<groupId>com.dm</groupId>
<artifactId>DmJdbcDriver</artifactId>
<version>1.8</version>
<scope>system</scope>
<systemPath>${basedir}/lib/DmJdbcDriver18.jar</systemPath>
</dependency>
<dependency>
<groupId>com.dm.dialect</groupId>
<artifactId>hibernate5</artifactId>
<version>5.4</version>
<scope>system</scope>
<systemPath>${basedir}/lib/DmDialect-for-hibernate5.4.jar</systemPath>
</dependency>
<!--sqlServer-->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>7.4.1.jre8</version>
</dependency>
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<version>1.3.1</version>
</dependency>
</dependencies>

View File

@ -7,6 +7,7 @@ import com.ktg.common.constant.UserConstants;
import com.ktg.common.core.domain.entity.SysUser;
import com.ktg.common.utils.StringUtils;
import com.ktg.framework.message.MessageProvider;
import com.ktg.system.domain.dto.AgvArrivedDto;
import com.ktg.system.service.ISysUserService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
@ -35,8 +36,7 @@ import com.ktg.common.core.page.TableDataInfo;
*/
@RestController
@RequestMapping("/system/message")
public class SysMessageController extends BaseController
{
public class SysMessageController extends BaseController {
@Autowired
private ISysMessageService sysMessageService;
@Autowired
@ -49,8 +49,7 @@ public class SysMessageController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('system:message:list')")
@GetMapping("/list")
public TableDataInfo list(SysMessage sysMessage)
{
public TableDataInfo list(SysMessage sysMessage) {
startPage();
List<SysMessage> list = sysMessageService.selectSysMessageList(sysMessage);
return getDataTable(list);
@ -62,8 +61,7 @@ public class SysMessageController extends BaseController
@PreAuthorize("@ss.hasPermi('system:message:export')")
@Log(title = "消息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SysMessage sysMessage)
{
public void export(HttpServletResponse response, SysMessage sysMessage) {
List<SysMessage> list = sysMessageService.selectSysMessageList(sysMessage);
ExcelUtil<SysMessage> util = new ExcelUtil<SysMessage>(SysMessage.class);
util.exportExcel(response, list, "消息数据");
@ -74,8 +72,7 @@ public class SysMessageController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('system:message:query')")
@GetMapping(value = "/{messageId}")
public AjaxResult getInfo(@PathVariable("messageId") Long messageId)
{
public AjaxResult getInfo(@PathVariable("messageId") Long messageId) {
return AjaxResult.success(sysMessageService.selectSysMessageByMessageId(messageId));
}
@ -85,20 +82,28 @@ public class SysMessageController extends BaseController
@PreAuthorize("@ss.hasPermi('system:message:add')")
@Log(title = "消息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysMessage sysMessage)
{
public AjaxResult add(@RequestBody SysMessage sysMessage) {
messageProvider.sendMessage(sysMessage);
return AjaxResult.success();
}
/**
* 通知用户agv小车到达
*/
@Log(title = "消息", businessType = BusinessType.INSERT)
@PostMapping("/open/agv-arrived")
public AjaxResult addAgv(@RequestBody AgvArrivedDto agvArrivedDto) {
sysMessageService.insertSysPromptMessage("AGV小车已到达", "订单号: " + agvArrivedDto.getOrderNo());
return AjaxResult.success();
}
/**
* 修改消息
*/
@PreAuthorize("@ss.hasPermi('system:message:edit')")
@Log(title = "消息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysMessage sysMessage)
{
public AjaxResult edit(@RequestBody SysMessage sysMessage) {
return toAjax(sysMessageService.updateSysMessage(sysMessage));
}
@ -108,8 +113,7 @@ public class SysMessageController extends BaseController
@PreAuthorize("@ss.hasPermi('system:message:remove')")
@Log(title = "消息", businessType = BusinessType.DELETE)
@DeleteMapping("/{messageIds}")
public AjaxResult remove(@PathVariable Long[] messageIds)
{
public AjaxResult remove(@PathVariable Long[] messageIds) {
for (Long messageId : messageIds
) {
SysMessage sysMessage = sysMessageService.selectSysMessageByMessageId(messageId);

View File

@ -59,7 +59,7 @@ public class SwaggerConfig
// 扫描所有有注解的api用这种方式更灵活
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
// 扫描指定包中的swagger注解
// .apis(RequestHandlerSelectors.basePackage("com.ktg.project.tool.swagger"))
// .apis(RequestHandlerSelectors.basePackage("com.ktg.project.Tool.swagger"))
// 扫描所有 .apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build()

View File

@ -0,0 +1,116 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
druid:
# 主库数据源
dm:
driverClassName: dm.jdbc.driver.DmDriver
url: jdbc:dm://192.168.8.60:5236/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: SYSDBA
password: SYSDBA
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
# 从库数据源
sqlserver:
# 从数据源开关/默认关闭
enabled: true
driverClassName: net.sourceforge.jtds.jdbc.Driver
url: jdbc:jtds:sqlserver://192.168.8.68:1433/DPG_RH_YQ_20240711
username: sa
password: rh123456
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
# redis 配置
redis:
# 地址
host: 192.168.8.60
# 端口默认为6379
port: 6379
# 数据库索引
database: 2
# 密码
password: 123456
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
#Mino配置
minio:
url: http://192.168.8.60:9000
accessKey: seBsDKT7Ss8B4aGiNiNn
secretKey: IYvTR63NZE3EemLfIHGTXu72O7svMEiNHG2OoOWI
bucketName: wms-dj
# 远程读取文件
globalConfig:
toolSettingXml:
localPath: E:\xml_wjj\
remoteUrl: smb://DBJGJG24/ddy/
remoteUser: share
remotePass: share
productionControl:
path: http://172.16.99.10:5005/api

View File

@ -0,0 +1,116 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
druid:
# 主库数据源
dm:
driverClassName: dm.jdbc.driver.DmDriver
url: jdbc:dm://abca.xin:7069/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: SYSDBA
password: SYSDBA001
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
# 从库数据源
sqlserver:
# 从数据源开关/默认关闭
enabled: true
driverClassName: net.sourceforge.jtds.jdbc.Driver
url: jdbc:jtds:sqlserver://abca.xin:7070/DPG_RH_YQ_20240711
username: sa
password: mssql_MBkPb5
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
# redis 配置
redis:
# 地址
host: abca.xin
# 端口默认为6379
port: 7067
# 数据库索引
database: 2
# 密码
password: redis_HtWAZW
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
#Mino配置
minio:
url: http://abca.xin:7068
accessKey: seBsDKT7Ss8B4aGiNiNn
secretKey: IYvTR63NZE3EemLfIHGTXu72O7svMEiNHG2OoOWI
bucketName: wms-dj
# 远程读取文件
globalConfig:
toolSettingXml:
localPath: E:\xml_wjj\
remoteUrl: smb://DBJGJG24/ddy/
remoteUser: share
remotePass: share
productionControl:
path: http://172.16.99.10:5005/api

View File

@ -1,59 +0,0 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: dm.jdbc.driver.DmDriver
druid:
# 主库数据源
master:
# url: jdbc:dm://30.30.2.24:5237/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:dm://localhost:5236/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# url: jdbc:dm://192.168.8.60:5236/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: SYSDBA
password: SYSDBA
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true

View File

@ -0,0 +1,116 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
druid:
# 主库数据源
dm:
driverClassName: dm.jdbc.driver.DmDriver
url: jdbc:dm://8.218.31.53:7069/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: SYSDBA
password: SYSDBA001
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
# 从库数据源
sqlserver:
# 从数据源开关/默认关闭
enabled: true
driverClassName: net.sourceforge.jtds.jdbc.Driver
url: jdbc:jtds:sqlserver://192.168.8.68:1433/DPG_RH_YQ_20240711
username: sa
password: rh123456
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
# redis 配置
redis:
# 地址
host: 8.218.31.53
# 端口默认为6379
port: 7067
# 数据库索引
database: 2
# 密码
password: redis_HtWAZW
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
#Mino配置
minio:
url: http://8.218.31.53:7068
accessKey: seBsDKT7Ss8B4aGiNiNn
secretKey: IYvTR63NZE3EemLfIHGTXu72O7svMEiNHG2OoOWI
bucketName: wms-dj
# 远程读取文件
globalConfig:
toolSettingXml:
localPath: E:\xml_wjj\
remoteUrl: smb://DBJGJG24/ddy/
remoteUser: share
remotePass: share
productionControl:
path: http://172.16.99.10:5005/api

View File

@ -0,0 +1,116 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
druid:
# 主库数据源
dm:
driverClassName: dm.jdbc.driver.DmDriver
url: jdbc:dm://8.218.31.53:7069/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: SYSDBA
password: SYSDBA001
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
# 从库数据源
sqlserver:
# 从数据源开关/默认关闭
enabled: true
driverClassName: net.sourceforge.jtds.jdbc.Driver
url: jdbc:jtds:sqlserver://192.168.8.68:1433/DPG_RH_YQ_20240711
username: sa
password: rh123456
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
# redis 配置
redis:
# 地址
host: 8.218.31.53
# 端口默认为6379
port: 7067
# 数据库索引
database: 2
# 密码
password: redis_HtWAZW
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
#Mino配置
minio:
url: http://8.218.31.53:7068
accessKey: seBsDKT7Ss8B4aGiNiNn
secretKey: IYvTR63NZE3EemLfIHGTXu72O7svMEiNHG2OoOWI
bucketName: wms-dj
# 远程读取文件
globalConfig:
toolSettingXml:
localPath: E:\xml_wjj\
remoteUrl: smb://DBJGJG24/ddy/
remoteUser: share
remotePass: share
productionControl:
path: http://172.16.99.10:5005/api

View File

@ -47,7 +47,7 @@ spring:
# 国际化资源文件路径
basename: i18n/messages
profiles:
active: druid
active: dev
# 文件上传
servlet:
multipart:
@ -60,30 +60,6 @@ spring:
restart:
# 热部署开关
enabled: true
# redis 配置
redis:
# 地址
# host: 192.168.8.60
host: 127.0.0.1
# 端口默认为6379
port: 6379
# 数据库索引
database: 4
# 密码
# password: 123456
password:
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
# token配置
token:
@ -125,10 +101,3 @@ xss:
excludes: /system/notice
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*
#Mino配置
minio:
url: http://192.168.8.60:9000
accessKey: seBsDKT7Ss8B4aGiNiNn
secretKey: IYvTR63NZE3EemLfIHGTXu72O7svMEiNHG2OoOWI
bucketName: wms-dj

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 日志存放路径 -->
<property name="log.path" value="/home/ktg/logs" />
<property name="log.path" value="./logs" />
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />

View File

@ -157,6 +157,12 @@
<version>2.2.9</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>annotationProcessor</scope>
</dependency>
</dependencies>
</project>

View File

@ -24,5 +24,5 @@ public @interface DataSource
/**
* 切换数据源名称
*/
public DataSourceType value() default DataSourceType.MASTER;
public DataSourceType value() default DataSourceType.DM;
}

View File

@ -10,10 +10,10 @@ public enum DataSourceType
/**
* 主库
*/
MASTER,
DM,
/**
* 从库
*/
SLAVE
SQLSERVER,
}

View File

@ -9,6 +9,10 @@ import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.sql.DataSource;
import com.ktg.framework.config.properties.DmDruidProperties;
import com.ktg.framework.config.properties.SqlserverDruidProperties;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
@ -21,7 +25,6 @@ import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatPropertie
import com.alibaba.druid.util.Utils;
import com.ktg.common.enums.DataSourceType;
import com.ktg.common.utils.spring.SpringUtils;
import com.ktg.framework.config.properties.DruidProperties;
import com.ktg.framework.datasource.DynamicDataSource;
/**
@ -33,17 +36,17 @@ import com.ktg.framework.datasource.DynamicDataSource;
public class DruidConfig
{
@Bean
@ConfigurationProperties("spring.datasource.druid.master")
public DataSource masterDataSource(DruidProperties druidProperties)
@ConfigurationProperties("spring.datasource.druid.dm")
public DataSource dmDataSource(DmDruidProperties druidProperties)
{
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
return druidProperties.dataSource(dataSource);
}
@Bean
@ConfigurationProperties("spring.datasource.druid.slave")
@ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true")
public DataSource slaveDataSource(DruidProperties druidProperties)
@ConfigurationProperties("spring.datasource.druid.sqlserver")
@ConditionalOnProperty(prefix = "spring.datasource.druid.sqlserver", name = "enabled", havingValue = "true")
public DataSource sqlServerDataSource(SqlserverDruidProperties druidProperties)
{
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
return druidProperties.dataSource(dataSource);
@ -51,12 +54,20 @@ public class DruidConfig
@Bean(name = "dynamicDataSource")
@Primary
public DynamicDataSource dataSource(DataSource masterDataSource)
{
public DynamicDataSource dataSource(@Qualifier("dmDataSource") DataSource dmDataSource) {
Map<Object, Object> targetDataSources = new HashMap<>();
targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
return new DynamicDataSource(masterDataSource, targetDataSources);
targetDataSources.put(DataSourceType.DM.name(), dmDataSource);
// 尝试获取 slaveDataSource如果存在则添加到数据源中
try {
DataSource sqlServerDataSource = SpringUtils.getBean("sqlServerDataSource");
targetDataSources.put(DataSourceType.SQLSERVER.name(), sqlServerDataSource);
} catch (Exception e) {
// 这里可以记录日志表示未启用 SQLServer 数据源
System.out.println("SQLServer DataSource is not enabled or configured.");
}
return new DynamicDataSource(dmDataSource, targetDataSources);
}
/**

View File

@ -0,0 +1,77 @@
package com.ktg.framework.config.properties;
import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
/**
* druid 配置属性
*
* @author ruoyi
*/
@Configuration
public class DmDruidProperties
{
@Value("${spring.datasource.druid.dm.initialSize}")
private int initialSize;
@Value("${spring.datasource.druid.dm.minIdle}")
private int minIdle;
@Value("${spring.datasource.druid.dm.maxActive}")
private int maxActive;
@Value("${spring.datasource.druid.dm.maxWait}")
private int maxWait;
@Value("${spring.datasource.druid.dm.timeBetweenEvictionRunsMillis}")
private int timeBetweenEvictionRunsMillis;
@Value("${spring.datasource.druid.dm.minEvictableIdleTimeMillis}")
private int minEvictableIdleTimeMillis;
@Value("${spring.datasource.druid.dm.maxEvictableIdleTimeMillis}")
private int maxEvictableIdleTimeMillis;
@Value("${spring.datasource.druid.dm.validationQuery}")
private String validationQuery;
@Value("${spring.datasource.druid.dm.testWhileIdle}")
private boolean testWhileIdle;
@Value("${spring.datasource.druid.dm.testOnBorrow}")
private boolean testOnBorrow;
@Value("${spring.datasource.druid.dm.testOnReturn}")
private boolean testOnReturn;
public DruidDataSource dataSource(DruidDataSource datasource)
{
/** 配置初始化大小、最小、最大 */
datasource.setInitialSize(initialSize);
datasource.setMaxActive(maxActive);
datasource.setMinIdle(minIdle);
/** 配置获取连接等待超时的时间 */
datasource.setMaxWait(maxWait);
/** 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 */
datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
/** 配置一个连接在池中最小、最大生存的时间,单位是毫秒 */
datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
datasource.setMaxEvictableIdleTimeMillis(maxEvictableIdleTimeMillis);
/**
* 用来检测连接是否有效的sql要求是一个查询语句常用select 'x'如果validationQuery为nulltestOnBorrowtestOnReturntestWhileIdle都不会起作用
*/
datasource.setValidationQuery(validationQuery);
/** 建议配置为true不影响性能并且保证安全性。申请连接的时候检测如果空闲时间大于timeBetweenEvictionRunsMillis执行validationQuery检测连接是否有效。 */
datasource.setTestWhileIdle(testWhileIdle);
/** 申请连接时执行validationQuery检测连接是否有效做了这个配置会降低性能。 */
datasource.setTestOnBorrow(testOnBorrow);
/** 归还连接时执行validationQuery检测连接是否有效做了这个配置会降低性能。 */
datasource.setTestOnReturn(testOnReturn);
return datasource;
}
}

View File

@ -1,77 +1,77 @@
package com.ktg.framework.config.properties;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import com.alibaba.druid.pool.DruidDataSource;
/**
* druid 配置属性
*
* @author ruoyi
*/
@Configuration
public class DruidProperties
{
@Value("${spring.datasource.druid.initialSize}")
private int initialSize;
@Value("${spring.datasource.druid.minIdle}")
private int minIdle;
@Value("${spring.datasource.druid.maxActive}")
private int maxActive;
@Value("${spring.datasource.druid.maxWait}")
private int maxWait;
@Value("${spring.datasource.druid.timeBetweenEvictionRunsMillis}")
private int timeBetweenEvictionRunsMillis;
@Value("${spring.datasource.druid.minEvictableIdleTimeMillis}")
private int minEvictableIdleTimeMillis;
@Value("${spring.datasource.druid.maxEvictableIdleTimeMillis}")
private int maxEvictableIdleTimeMillis;
@Value("${spring.datasource.druid.validationQuery}")
private String validationQuery;
@Value("${spring.datasource.druid.testWhileIdle}")
private boolean testWhileIdle;
@Value("${spring.datasource.druid.testOnBorrow}")
private boolean testOnBorrow;
@Value("${spring.datasource.druid.testOnReturn}")
private boolean testOnReturn;
public DruidDataSource dataSource(DruidDataSource datasource)
{
/** 配置初始化大小、最小、最大 */
datasource.setInitialSize(initialSize);
datasource.setMaxActive(maxActive);
datasource.setMinIdle(minIdle);
/** 配置获取连接等待超时的时间 */
datasource.setMaxWait(maxWait);
/** 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 */
datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
/** 配置一个连接在池中最小、最大生存的时间,单位是毫秒 */
datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
datasource.setMaxEvictableIdleTimeMillis(maxEvictableIdleTimeMillis);
/**
* 用来检测连接是否有效的sql要求是一个查询语句常用select 'x'如果validationQuery为nulltestOnBorrowtestOnReturntestWhileIdle都不会起作用
*/
datasource.setValidationQuery(validationQuery);
/** 建议配置为true不影响性能并且保证安全性。申请连接的时候检测如果空闲时间大于timeBetweenEvictionRunsMillis执行validationQuery检测连接是否有效。 */
datasource.setTestWhileIdle(testWhileIdle);
/** 申请连接时执行validationQuery检测连接是否有效做了这个配置会降低性能。 */
datasource.setTestOnBorrow(testOnBorrow);
/** 归还连接时执行validationQuery检测连接是否有效做了这个配置会降低性能。 */
datasource.setTestOnReturn(testOnReturn);
return datasource;
}
}
//package com.ktg.framework.config.properties;
//
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Configuration;
//import com.alibaba.druid.pool.DruidDataSource;
//
///**
// * druid 配置属性
// *
// * @author ruoyi
// */
//@Configuration
//public class DruidProperties
//{
// @Value("${spring.datasource.druid.initialSize}")
// private int initialSize;
//
// @Value("${spring.datasource.druid.minIdle}")
// private int minIdle;
//
// @Value("${spring.datasource.druid.maxActive}")
// private int maxActive;
//
// @Value("${spring.datasource.druid.maxWait}")
// private int maxWait;
//
// @Value("${spring.datasource.druid.timeBetweenEvictionRunsMillis}")
// private int timeBetweenEvictionRunsMillis;
//
// @Value("${spring.datasource.druid.minEvictableIdleTimeMillis}")
// private int minEvictableIdleTimeMillis;
//
// @Value("${spring.datasource.druid.maxEvictableIdleTimeMillis}")
// private int maxEvictableIdleTimeMillis;
//
// @Value("${spring.datasource.druid.validationQuery}")
// private String validationQuery;
//
// @Value("${spring.datasource.druid.testWhileIdle}")
// private boolean testWhileIdle;
//
// @Value("${spring.datasource.druid.testOnBorrow}")
// private boolean testOnBorrow;
//
// @Value("${spring.datasource.druid.testOnReturn}")
// private boolean testOnReturn;
//
// public DruidDataSource dataSource(DruidDataSource datasource)
// {
// /** 配置初始化大小、最小、最大 */
// datasource.setInitialSize(initialSize);
// datasource.setMaxActive(maxActive);
// datasource.setMinIdle(minIdle);
//
// /** 配置获取连接等待超时的时间 */
// datasource.setMaxWait(maxWait);
//
// /** 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 */
// datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
//
// /** 配置一个连接在池中最小、最大生存的时间,单位是毫秒 */
// datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
// datasource.setMaxEvictableIdleTimeMillis(maxEvictableIdleTimeMillis);
//
// /**
// * 用来检测连接是否有效的sql要求是一个查询语句常用select 'x'如果validationQuery为nulltestOnBorrowtestOnReturntestWhileIdle都不会起作用
// */
// datasource.setValidationQuery(validationQuery);
// /** 建议配置为true不影响性能并且保证安全性。申请连接的时候检测如果空闲时间大于timeBetweenEvictionRunsMillis执行validationQuery检测连接是否有效。 */
// datasource.setTestWhileIdle(testWhileIdle);
// /** 申请连接时执行validationQuery检测连接是否有效做了这个配置会降低性能。 */
// datasource.setTestOnBorrow(testOnBorrow);
// /** 归还连接时执行validationQuery检测连接是否有效做了这个配置会降低性能。 */
// datasource.setTestOnReturn(testOnReturn);
// return datasource;
// }
//}

View File

@ -0,0 +1,77 @@
package com.ktg.framework.config.properties;
import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
/**
* druid 配置属性
*
* @author ruoyi
*/
@Configuration
public class SqlserverDruidProperties
{
@Value("${spring.datasource.druid.sqlserver.initialSize}")
private int initialSize;
@Value("${spring.datasource.druid.sqlserver.minIdle}")
private int minIdle;
@Value("${spring.datasource.druid.sqlserver.maxActive}")
private int maxActive;
@Value("${spring.datasource.druid.sqlserver.maxWait}")
private int maxWait;
@Value("${spring.datasource.druid.sqlserver.timeBetweenEvictionRunsMillis}")
private int timeBetweenEvictionRunsMillis;
@Value("${spring.datasource.druid.sqlserver.minEvictableIdleTimeMillis}")
private int minEvictableIdleTimeMillis;
@Value("${spring.datasource.druid.sqlserver.maxEvictableIdleTimeMillis}")
private int maxEvictableIdleTimeMillis;
@Value("${spring.datasource.druid.sqlserver.validationQuery}")
private String validationQuery;
@Value("${spring.datasource.druid.sqlserver.testWhileIdle}")
private boolean testWhileIdle;
@Value("${spring.datasource.druid.sqlserver.testOnBorrow}")
private boolean testOnBorrow;
@Value("${spring.datasource.druid.sqlserver.testOnReturn}")
private boolean testOnReturn;
public DruidDataSource dataSource(DruidDataSource datasource)
{
/** 配置初始化大小、最小、最大 */
datasource.setInitialSize(initialSize);
datasource.setMaxActive(maxActive);
datasource.setMinIdle(minIdle);
/** 配置获取连接等待超时的时间 */
datasource.setMaxWait(maxWait);
/** 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 */
datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
/** 配置一个连接在池中最小、最大生存的时间,单位是毫秒 */
datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
datasource.setMaxEvictableIdleTimeMillis(maxEvictableIdleTimeMillis);
/**
* 用来检测连接是否有效的sql要求是一个查询语句常用select 'x'如果validationQuery为nulltestOnBorrowtestOnReturntestWhileIdle都不会起作用
*/
datasource.setValidationQuery(validationQuery);
/** 建议配置为true不影响性能并且保证安全性。申请连接的时候检测如果空闲时间大于timeBetweenEvictionRunsMillis执行validationQuery检测连接是否有效。 */
datasource.setTestWhileIdle(testWhileIdle);
/** 申请连接时执行validationQuery检测连接是否有效做了这个配置会降低性能。 */
datasource.setTestOnBorrow(testOnBorrow);
/** 归还连接时执行validationQuery检测连接是否有效做了这个配置会降低性能。 */
datasource.setTestOnReturn(testOnReturn);
return datasource;
}
}

View File

@ -53,10 +53,25 @@
<artifactId>swagger-models</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>jcifs</groupId>
<artifactId>jcifs</artifactId>
<version>1.3.17</version>
</dependency>
<dependency>
<groupId>com.ktg</groupId>
<artifactId>ktg-generator</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!--CXF webservices-->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
<version>3.4.4</version>
</dependency>
</dependencies>
</project>

View File

@ -91,6 +91,15 @@ public class CalendarUtil {
return format(new Date(), DATETIME_PATTERN);
}
/**
* 获取当前日期和时间字符串.
*
* @return String 日期时间字符串例如 2015/08/11
*/
public static String getDateTimeStrForFile() {
return format(new Date(), DATE_PATTERN_WITH_SLASH);
}
/**
* 时间戳转换为日期时间字符串
*

View File

@ -0,0 +1,36 @@
package com.ktg.mes.md.config;
import com.ktg.mes.md.service.IMasterDataSyncService;
import lombok.RequiredArgsConstructor;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.xml.ws.Endpoint;
@Configuration
@RequiredArgsConstructor
public class WebServiceConfig {
private final IMasterDataSyncService masterDataSyncService;
@Bean(name = Bus.DEFAULT_BUS_ID)
public SpringBus springBus() {
return new SpringBus();
}
@Bean
public ServletRegistrationBean<CXFServlet> cxfServlet() {
return new ServletRegistrationBean<>(new CXFServlet(), "/WebServices/open/*");
}
@Bean
public Endpoint endpoint() {
EndpointImpl endpoint = new EndpointImpl(springBus(), masterDataSyncService);
endpoint.publish("/MasterDataSyncService");
return endpoint;
}
}

View File

@ -1,5 +1,6 @@
package com.ktg.mes.md.controller;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import javax.servlet.http.HttpServletResponse;
@ -7,7 +8,9 @@ import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSON;
import com.ktg.common.utils.DateUtils;
import com.ktg.generator.util.MultiModuleCodeGenerator;
import com.ktg.mes.cal.utils.CalendarUtil;
import com.ktg.mes.md.domain.*;
import com.ktg.mes.md.mapper.BaseKnifeLockedMapper;
import com.ktg.mes.md.mapper.WmsOutPlanDetailEntityMapper;
import com.ktg.mes.md.mapper.WmsOutPlanMapper;
import com.ktg.mes.md.mapper.WmsOutTaskMapper;
@ -20,6 +23,10 @@ import com.ktg.mes.wm.service.IWmsInTaskService;
import com.ktg.mes.wm.service.IWmsZdTaskService;
import com.ktg.system.domain.SysOperLog;
import com.ktg.system.service.ISysOperLogService;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
@ -31,7 +38,6 @@ import com.ktg.common.enums.BusinessType;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.common.core.page.TableDataInfo;
import static com.ktg.common.utils.SecurityUtils.getUsername;
import static com.ktg.generator.util.MultiModuleCodeGenerator.generateTaskCode;
/**
@ -82,6 +88,12 @@ public class BaseKnifeController extends BaseController {
@Autowired
private ProductionArrangementsMapper productionArrangementsMapper;
@Autowired
private BaseKnifeLockedMapper baseKnifeLockedMapper;
@Autowired
private MyConfig myConfig;
/**
* 列表查询
@ -133,6 +145,31 @@ public class BaseKnifeController extends BaseController {
return getDataTable(list);
}
/**
* 列表查询
*
* @return
*/
@PostMapping("/open/life")
public AjaxResult life(@RequestBody BaseKnife baseKnife) {
// 检查台账是否存在
BaseKnife baseKnifeOrigin = baseKnifeService.selectBaseKnifeByBaseKnifeId(baseKnife.getBaseKnifeId());
if (baseKnifeOrigin == null) return AjaxResult.error();
// 计算消耗寿命
int currentLife = baseKnifeOrigin.getKnifeLife() + baseKnifeOrigin.getResetCount() * 100 - baseKnife.getKnifeLife();
if (currentLife > 0){
baseKnifeOrigin.setKnifeLife(currentLife % 100);
baseKnifeOrigin.setResetCount(currentLife / 100);
} else {
baseKnifeOrigin.setKnifeLife(0);
baseKnifeOrigin.setResetCount(0);
}
baseKnifeService.updateBaseKnife(baseKnifeOrigin);
return AjaxResult.success();
}
@PostMapping("/open/checkForAlignment/{technologyCode}")
@ResponseBody
public AjaxResult checkForAlignment(@PathVariable String technologyCode) {
@ -142,7 +179,7 @@ public class BaseKnifeController extends BaseController {
// List<BaseTechnologyBom> technologyBomList = baseTechnologyBomService.selectBaseTechnologyBomListByProcessCodeList(productionArrangements.getProcessCodes());
List<BaseTechnologyBom> technologyBomList = baseTechnologyBomService.selectBaseTechnologyBomList(baseTechnologyBomWrapper);
if (technologyBomList.isEmpty() || technologyBomList.size() == 1 && technologyBomList.get(0).getKnifeCode() == null)
return AjaxResult.error("未检测到工艺bom项");
throw new RuntimeException("未检测到工艺bom项");
// 构建日志
SysOperLog operLog = new SysOperLog();
@ -174,7 +211,7 @@ public class BaseKnifeController extends BaseController {
if (mdItemTemp == null) {
operLog.setJsonResult("物料台账查询错误:" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("物料台账查询错误", techBom.getKnifeCode());
throw new RuntimeException("物料台账查询错误" + techBom.getKnifeCode());
}
baseKnifeWrapper.setMbbBdMrlId(mdItemTemp.getItemId());
@ -192,7 +229,7 @@ public class BaseKnifeController extends BaseController {
if (bomRouteList.isEmpty()) {
operLog.setJsonResult("Bom头查询错误" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("Bom头查询错误", techBom.getKnifeCode());
throw new RuntimeException("Bom头查询错误" + techBom.getKnifeCode());
}
BomRoute bomRoute = bomRouteService.selectBomRouteByBomRouteId(bomRouteList.get(0).getBomRouteId());
@ -208,14 +245,14 @@ public class BaseKnifeController extends BaseController {
if (sitmTempList.isEmpty()) {
operLog.setJsonResult("基础物料不足进行组装工具:" + bom.getMdItemCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
throw new RuntimeException("基础物料不足进行组装工具" + bom.getMdItemCode());
} else if (countMap.get(sitmTempList.get(0).getKnifeCode()) == null) {
if (sitmTempList.size() >= bom.getStandardDosage() * knifeCount.get()) {
countMap.put(sitmTempList.get(0).getKnifeCode(), bom.getStandardDosage() * knifeCount.get());
} else {
operLog.setJsonResult("基础物料不足进行组装工具:" + bom.getMdItemCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
throw new RuntimeException("基础物料不足进行组装工具" + bom.getMdItemCode());
}
} else {
countMap.put(sitmTempList.get(0).getKnifeCode(), countMap.get(sitmTempList.get(0).getKnifeCode()) + bom.getStandardDosage() * knifeCount.get());
@ -225,18 +262,18 @@ public class BaseKnifeController extends BaseController {
if (sitmTempList.size() < countMap.get(sitmTempList.get(0).getKnifeCode()) && countMap.get(sitmTempList.get(0).getKnifeCode()) > bom.getStandardDosage() * knifeCount.get()) {
operLog.setJsonResult("基础物料不足进行组装工具:" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
throw new RuntimeException("基础物料不足进行组装工具" + bom.getMdItemCode());
}
}
} else {
operLog.setJsonResult("暂无记录整刀bom项" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("暂无记录整刀bom项", techBom.getKnifeCode());
throw new RuntimeException("暂无记录整刀bom项" + techBom.getKnifeCode());
}
} else {
operLog.setJsonResult("基础物料不足:" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足", techBom.getKnifeCode());
throw new RuntimeException("基础物料不足" + techBom.getKnifeCode());
}
} else {
// 将物料填入集合
@ -256,7 +293,7 @@ public class BaseKnifeController extends BaseController {
if (bomRouteList.isEmpty()) {
operLog.setJsonResult("Bom头查询错误" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("Bom头查询错误", techBom.getKnifeCode());
throw new RuntimeException("Bom头查询错误" + techBom.getKnifeCode());
}
BomRoute bomRoute = bomRouteService.selectBomRouteByBomRouteId(bomRouteList.get(0).getBomRouteId());
@ -272,14 +309,14 @@ public class BaseKnifeController extends BaseController {
if (sitmTempList.isEmpty()) {
operLog.setJsonResult("基础物料不足进行组装工具:" + bom.getMdItemCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
throw new RuntimeException("基础物料不足进行组装工具" + bom.getMdItemCode());
} else if (countMap.get(sitmTempList.get(0).getKnifeCode()) == null) {
if (sitmTempList.size() >= bom.getStandardDosage() * knifeCount.get()) {
countMap.put(sitmTempList.get(0).getKnifeCode(), bom.getStandardDosage() * knifeCount.get());
} else {
operLog.setJsonResult("基础物料不足进行组装工具:" + bom.getMdItemCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
throw new RuntimeException("基础物料不足进行组装工具" + bom.getMdItemCode());
}
} else {
countMap.put(sitmTempList.get(0).getKnifeCode(), countMap.get(sitmTempList.get(0).getKnifeCode()) + bom.getStandardDosage() * knifeCount.get());
@ -289,18 +326,18 @@ public class BaseKnifeController extends BaseController {
if (sitmTempList.size() < countMap.get(sitmTempList.get(0).getKnifeCode()) && countMap.get(sitmTempList.get(0).getKnifeCode()) > bom.getStandardDosage() * knifeCount.get()) {
operLog.setJsonResult("基础物料不足进行组装工具:" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
throw new RuntimeException("基础物料不足进行组装工具" + bom.getMdItemCode());
}
}
} else {
operLog.setJsonResult("暂无记录整刀bom项" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("暂无记录整刀bom项", techBom.getKnifeCode());
throw new RuntimeException("暂无记录整刀bom项" + techBom.getKnifeCode());
}
} else {
operLog.setJsonResult("基础物料不足:" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足", techBom.getKnifeCode());
throw new RuntimeException("基础物料不足" + techBom.getKnifeCode());
}
}
}
@ -316,32 +353,31 @@ public class BaseKnifeController extends BaseController {
@PostMapping("/open/productionArrangements")
@ResponseBody
@Transactional
public AjaxResult productionArrangements(@RequestBody ProductionArrangements productionArrangements) {
// 检查计划单是否已存在
public AjaxResult productionArrangements(@RequestBody ProductionArrangements productionArrangements) throws IOException {
// 检查计划单是否已存在 从台账表中寻找
BaseKnife baseKnifePlan = new BaseKnife();
baseKnifePlan.setPlanSheet(productionArrangements.getPlanSheet());
if (!baseKnifeService.selectBaseKnifeList(baseKnifePlan).isEmpty())
return AjaxResult.error("该计划单已存在,请更换重试");
// 检查计划单是否已存在 从组装任务表中寻找
WmsZdTask wmsZdTaskValid = new WmsZdTask();
wmsZdTaskValid.setPlanSheet(productionArrangements.getPlanSheet());
if (!zdTaskService.selectWmsZdTaskList(wmsZdTaskValid).isEmpty())
return AjaxResult.error("该计划单已存在,请更换重试");
// 检查计划单是否已存在 从物料预订表中寻找
BaseKnifeLocked baseKnifeLockedValid = new BaseKnifeLocked();
baseKnifeLockedValid.setPlanSheet(productionArrangements.getPlanSheet());
if (!baseKnifeLockedMapper.selectBaseKnifeLockedList(baseKnifeLockedValid).isEmpty())
return AjaxResult.error("该计划单已存在,请更换重试");
// 齐套性检查
AjaxResult ajaxResult = this.checkForAlignment(productionArrangements.getTechnologyCode());
if (Integer.parseInt(String.valueOf(ajaxResult.get("code"))) != 200) {
return AjaxResult.error(ajaxResult.get("msg").toString(), ajaxResult.get("data"));
}
// 验证bom工艺
// 验证工艺BOM是否存在
BaseTechnologyBom baseTechnologyBomWrapper = new BaseTechnologyBom();
baseTechnologyBomWrapper.setTechnologyCode(productionArrangements.getTechnologyCode());
// List<BaseTechnologyBom> technologyBomList = baseTechnologyBomService.selectBaseTechnologyBomListByProcessCodeList(productionArrangements.getProcessCodes());
List<BaseTechnologyBom> technologyBomList = baseTechnologyBomService.selectBaseTechnologyBomList(baseTechnologyBomWrapper);
if (technologyBomList.isEmpty() || technologyBomList.size() == 1 && technologyBomList.get(0).getKnifeCode() == null)
return AjaxResult.error("未检测到工艺bom项");
// 记录数据修改
// 记录已经列入订单需求的物料数据
List<BaseKnife> baseKnifeOriginList = new ArrayList<>();
// 参数列表
@ -366,8 +402,9 @@ public class BaseKnifeController extends BaseController {
// 接口返回信息
String msg = "生产准备验证成功!";
// 记录所需物料数量的map
// 记录所符合需求的物料数量 map 需要组装的物料数量
Map<String, Integer> countMap = new HashMap<>();
Map<String, Integer> zdTaskMap = new HashMap<>();
BaseKnife baseKnifeWrapper = new BaseKnife();
BomRoute bomRouteTemp = new BomRoute();
MdItem mdItemTemp = new MdItem();
@ -376,21 +413,23 @@ public class BaseKnifeController extends BaseController {
for (BaseTechnologyBom techBom : technologyBomList) {
// 空则0
countMap.putIfAbsent(techBom.getKnifeCode(), 0);
zdTaskMap.putIfAbsent(techBom.getKnifeCode(), 0);
// 台账表中查询工具 并记录数量
// 查询物料编码是否存在
mdItemTemp = mdItemService.selectMdItemByCode(techBom.getKnifeCode());
if (mdItemTemp == null) {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("物料台账查询错误:" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("物料台账查询错误", techBom.getKnifeCode());
throw new RuntimeException("物料台账查询错误" + techBom.getKnifeCode());
}
// 查询复合条件的台账
// 查询符合条件的台账 锁定状态为 0 空闲中
baseKnifeWrapper.setMbbBdMrlId(mdItemTemp.getItemId());
baseKnifeWrapper.setIsLocked(0);
List<BaseKnife> tempList = this.baseKnifeService.selectBaseKnifeList(baseKnifeWrapper);
tempList.removeIf(baseKnife -> baseKnife.getKnifeLife() + baseKnife.getResetCount() * 100 < techBom.getExpendLife());
// 过滤不符合需求的物料 当前寿命小于工艺消耗定额
if (Objects.equals("PRODUCT", mdItemTemp.getItemOrProduct())) tempList.removeIf(baseKnife -> baseKnife.getKnifeLife() + baseKnife.getResetCount() * 100 < techBom.getExpendLife());
// 记录此项工艺需要的物料数量
AtomicInteger knifeCount = new AtomicInteger(techBom.getKnifeCount());
// 如果台账表中不存在尝试组刀任务查询
@ -400,59 +439,64 @@ public class BaseKnifeController extends BaseController {
bomRouteTemp.setMdItemId(mdItemTemp.getItemId());
List<BomRoute> bomRouteList = bomRouteService.selectBomRouteList(bomRouteTemp);
if (bomRouteList.isEmpty()) {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("Bom头查询错误" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("Bom头查询错误", techBom.getKnifeCode());
throw new RuntimeException("Bom头查询错误" + techBom.getKnifeCode());
}
// 获取整刀BOM 进行子项遍历
BomRoute bomRoute = bomRouteService.selectBomRouteByBomRouteId(bomRouteList.get(0).getBomRouteId());
if (!bomRoute.getMbbProduBomList().isEmpty()) {
// 遍历bom项 从台账表中筛选对应基础物料
for (MbbProduBom bom : bomRoute.getMbbProduBomList()) {
// 查询基础物料不包含已锁定的
baseKnifeWrapper.setMbbBdMrlId(bom.getMdItemId());
baseKnifeWrapper.setIsLocked(0);
List<BaseKnife> sitmTempList = baseKnifeService.selectBaseKnifeList(baseKnifeWrapper);
if (sitmTempList.isEmpty()) {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("基础物料不足进行组装工具:" + bom.getMdItemCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
} else if (countMap.get(sitmTempList.get(0).getKnifeCode()) == null) {
if (sitmTempList.size() >= bom.getStandardDosage() * knifeCount.get()) {
countMap.put(sitmTempList.get(0).getKnifeCode(), bom.getStandardDosage() * knifeCount.get());
} else {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("基础物料不足进行组装工具:" + bom.getMdItemCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
}
} else {
countMap.put(sitmTempList.get(0).getKnifeCode(), countMap.get(sitmTempList.get(0).getKnifeCode()) + bom.getStandardDosage() * knifeCount.get());
}
// 记录需要组装的数量 能够组装的数量
int knifeNeedQuantity = zdTaskMap.get(techBom.getKnifeCode()) + techBom.getKnifeCount();
int knifeHaveQuantity = this.getBomZdTaskQuantity(bomRoute, knifeNeedQuantity);
// 判断基础物料是否充足
if (sitmTempList.size() < countMap.get(sitmTempList.get(0).getKnifeCode()) && countMap.get(sitmTempList.get(0).getKnifeCode()) > bom.getStandardDosage() * knifeCount.get()) {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
// 如果组装出来的数量不够 去预订其他订单中的
if (knifeHaveQuantity < knifeNeedQuantity) {
// 当前库内无符合需求的物料 尝试查询已经在订单中的刀但作业时间不同
List<Long> lockedBaseKnifeIds = this.getLockedBaseKnifeId(mdItemTemp.getItemCode(), productionArrangements, knifeNeedQuantity - knifeHaveQuantity, techBom.getExpendLife());
if (!lockedBaseKnifeIds.isEmpty()) {
lockedBaseKnifeIds.forEach(lockedBaseKnifeId -> {
BaseKnife lockedBaseKnife = baseKnifeService.selectBaseKnifeByBaseKnifeId(lockedBaseKnifeId);
// 新增一条台账锁定记录 预订台账
BaseKnifeLocked baseKnifeLocked = new BaseKnifeLocked();
baseKnifeLocked.setPlanSheet(productionArrangements.getPlanSheet());
baseKnifeLocked.setStatus(0); // 状态未完成
baseKnifeLocked.setLockedStartTime(productionArrangements.getStartTime());
baseKnifeLocked.setLockedEndTime(productionArrangements.getEndTime());
baseKnifeLocked.setItemCode(lockedBaseKnife.getKnifeCode());
baseKnifeLocked.setBaseKnifeId(lockedBaseKnife.getBaseKnifeId());
baseKnifeLocked.setExpendLife(techBom.getExpendLife()); // 消耗定额提供给预订时计算寿命是否符合需求
baseKnifeLockedMapper.insertBaseKnifeLocked(baseKnifeLocked);
});
// 更新需要组装的数量 生产准备中已准备好的数量
zdTaskMap.put(techBom.getKnifeCode(), knifeHaveQuantity);
countMap.put(techBom.getKnifeCode(), countMap.get(techBom.getKnifeCode()) + lockedBaseKnifeIds.size());
msg = msg + "【已预订" + lockedBaseKnifeIds.size() + "把整刀】";
} else {
operLog.setJsonResult("基础物料不足进行组装工具:" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
}
throw new RuntimeException("基础物料不足进行组装工具" + techBom.getKnifeCode());
}
} else {
// 更新需要组装的数量 生产准备中已准备好的数量
zdTaskMap.put(techBom.getKnifeCode(), knifeHaveQuantity);
countMap.put(techBom.getKnifeCode(), countMap.get(techBom.getKnifeCode()) + knifeNeedQuantity);
}
} else {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("暂无记录整刀bom项" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("暂无记录整刀bom项", techBom.getKnifeCode());
throw new RuntimeException("暂无记录整刀bom项" + techBom.getKnifeCode());
}
} else {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("基础物料不足:" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足", techBom.getKnifeCode());
throw new RuntimeException("基础物料不足" + techBom.getKnifeCode());
}
} else {
// 将物料填入集合
@ -461,13 +505,18 @@ public class BaseKnifeController extends BaseController {
// 更新数量
knifeCount.getAndDecrement();
countMap.put(item.getKnifeCode(), countMap.get(item.getKnifeCode()) + 1);
// 记录源数据然后锁定
baseKnifeOriginList.add(item);
// 锁定
item.setPlanSheet(productionArrangements.getPlanSheet());
item.setIsLocked(1);
item.setLockedStartTime(techBom.getLockedStartTime());
item.setLockedEndTime(techBom.getLockedEndTime());
item.setIsLocked(1); // 锁定整刀台账
item.setLockedStartTime(productionArrangements.getStartTime());
item.setLockedEndTime(productionArrangements.getEndTime());
baseKnifeService.updateBaseKnife(item);
// 利用预留字段来记录锁定的整刀的消耗定额
item.setAttr1(Long.valueOf(techBom.getExpendLife()));
// 记录锁定记录
baseKnifeOriginList.add(item);
}
});
if (knifeCount.get() > 0) {
@ -477,126 +526,101 @@ public class BaseKnifeController extends BaseController {
List<BomRoute> bomRouteList = bomRouteService.selectBomRouteList(bomRouteTemp);
if (bomRouteList.isEmpty()) {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("Bom头查询错误" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("Bom头查询错误", techBom.getKnifeCode());
throw new RuntimeException("Bom头查询错误" + techBom.getKnifeCode());
}
// 获取整刀BOM 进行子项遍历
BomRoute bomRoute = bomRouteService.selectBomRouteByBomRouteId(bomRouteList.get(0).getBomRouteId());
if (!bomRoute.getMbbProduBomList().isEmpty()) {
// 遍历bom项 从台账表中筛选对应基础物料
for (MbbProduBom bom : bomRoute.getMbbProduBomList()) {
// 查询基础物料不包含已锁定的
baseKnifeWrapper.setMbbBdMrlId(bom.getMdItemId());
baseKnifeWrapper.setIsLocked(0);
List<BaseKnife> sitmTempList = baseKnifeService.selectBaseKnifeList(baseKnifeWrapper);
if (sitmTempList.isEmpty()) {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("基础物料不足进行组装工具:" + bom.getMdItemCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
} else if (countMap.get(sitmTempList.get(0).getKnifeCode()) == null) {
if (sitmTempList.size() >= bom.getStandardDosage() * knifeCount.get()) {
countMap.put(sitmTempList.get(0).getKnifeCode(), bom.getStandardDosage() * knifeCount.get());
} else {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("基础物料不足进行组装工具:" + bom.getMdItemCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
}
} else {
countMap.put(sitmTempList.get(0).getKnifeCode(), countMap.get(sitmTempList.get(0).getKnifeCode()) + bom.getStandardDosage() * knifeCount.get());
}
// 记录需要组装的数量 能够组装的数量
int knifeNeedQuantity = zdTaskMap.get(techBom.getKnifeCode()) + knifeCount.get();
int knifeHaveQuantity = this.getBomZdTaskQuantity(bomRoute, knifeNeedQuantity);
// 判断基础物料是否充足
if (sitmTempList.size() < countMap.get(sitmTempList.get(0).getKnifeCode()) && countMap.get(sitmTempList.get(0).getKnifeCode()) > bom.getStandardDosage() * knifeCount.get()) {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
// 如果组装出来的数量不够 去预订其他订单中的
if (knifeHaveQuantity < knifeNeedQuantity) {
// 当前库内无符合需求的物料 尝试查询已经在订单中的刀但作业时间不同
List<Long> lockedBaseKnifeIds = this.getLockedBaseKnifeId(mdItemTemp.getItemCode(), productionArrangements, knifeNeedQuantity - knifeHaveQuantity, techBom.getExpendLife());
if (!lockedBaseKnifeIds.isEmpty()) {
lockedBaseKnifeIds.forEach(lockedBaseKnifeId -> {
BaseKnife lockedBaseKnife = baseKnifeService.selectBaseKnifeByBaseKnifeId(lockedBaseKnifeId);
// 新增一条台账锁定记录 预订台账
BaseKnifeLocked baseKnifeLocked = new BaseKnifeLocked();
baseKnifeLocked.setPlanSheet(productionArrangements.getPlanSheet());
baseKnifeLocked.setStatus(0);
baseKnifeLocked.setLockedStartTime(productionArrangements.getStartTime());
baseKnifeLocked.setLockedEndTime(productionArrangements.getEndTime());
baseKnifeLocked.setItemCode(lockedBaseKnife.getKnifeCode());
baseKnifeLocked.setBaseKnifeId(lockedBaseKnife.getBaseKnifeId());
baseKnifeLocked.setExpendLife(techBom.getExpendLife());
baseKnifeLockedMapper.insertBaseKnifeLocked(baseKnifeLocked);
});
// 更新需要组装的数量 生产准备中已准备好的数量
zdTaskMap.put(techBom.getKnifeCode(), knifeHaveQuantity);
countMap.put(techBom.getKnifeCode(), countMap.get(techBom.getKnifeCode()) + lockedBaseKnifeIds.size());
msg = msg + "【已预订" + lockedBaseKnifeIds.size() + "把整刀】";
} else {
operLog.setJsonResult("基础物料不足进行组装工具:" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
}
throw new RuntimeException("基础物料不足进行组装工具" + techBom.getKnifeCode());
}
} else {
// 更新需要组装的数量 生产准备中已准备好的数量
zdTaskMap.put(techBom.getKnifeCode(), knifeHaveQuantity);
countMap.put(techBom.getKnifeCode(), countMap.get(techBom.getKnifeCode()) + knifeNeedQuantity);
}
} else {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("暂无记录整刀bom项" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("暂无记录整刀bom项", techBom.getKnifeCode());
throw new RuntimeException("暂无记录整刀bom项" + techBom.getKnifeCode());
}
} else {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("基础物料不足:" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足", techBom.getKnifeCode());
throw new RuntimeException("基础物料不足" + techBom.getKnifeCode());
}
}
}
}
// 组刀
MdItem mdItem;
List<BaseKnife> baseKnifeList;
int count;
List<MbbProduBom> bomList;
for (BaseTechnologyBom techBom : technologyBomList) {
mdItem = mdItemService.selectMdItemByCode(techBom.getKnifeCode());
count = techBom.getKnifeCount() - countMap.get(techBom.getKnifeCode());
// 先从台账表找
baseKnifeWrapper.setMbbBdMrlId(mdItem.getItemId());
baseKnifeWrapper.setIsLocked(0);
baseKnifeList = baseKnifeService.selectBaseKnifeList(baseKnifeWrapper);
baseKnifeList.removeIf(baseKnife -> baseKnife.getKnifeLife() + baseKnife.getResetCount() * 100 < techBom.getExpendLife());
for (BaseKnife wmsBaseKnife : baseKnifeList) {
if (wmsBaseKnife.getKnifeLife() >= techBom.getExpendLife() && count > 0) {
count--;
}
}
// 整刀不足进行组装
if (count > 0) {
if ("PRODUCT".equals(mdItem.getItemOrProduct())) {
// 查询整刀bom项 如果不存在说明 为基础物料或者没有记录此整刀的组装
bomRouteTemp.setMdItemId(mdItem.getItemId());
List<BomRoute> bomRouteList = bomRouteService.selectBomRouteList(bomRouteTemp);
if (bomRouteList.isEmpty()) {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("Bom头查询错误" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("Bom头查询错误", techBom.getKnifeCode());
}
for (Map.Entry<String, Integer> zdTaskItem : zdTaskMap.entrySet()){
if (zdTaskItem.getValue() != 0){
MdItem mdItem = mdItemService.selectMdItemByCode(zdTaskItem.getKey());
BomRoute bomRouteWrapper = new BomRoute();
bomRouteWrapper.setMdItemId(mdItem.getItemId());
List<BomRoute> bomRouteList = bomRouteService.selectBomRouteList(bomRouteWrapper);
// 生成组装任务
WmsZdTask wmsZdTask = new WmsZdTask();
wmsZdTask.setmProductId(mdItem.getItemId());
wmsZdTask.setPlanSheet(productionArrangements.getPlanSheet());
wmsZdTask.setCode(generateTaskCode(techBom.getProcessCode()));
wmsZdTask.setName(techBom.getProcessName());
wmsZdTask.setProductIdQty(count);
wmsZdTask.setCode(generateTaskCode(productionArrangements.getTechnologyCode()));
wmsZdTask.setName(productionArrangements.getPlanSheet());
wmsZdTask.setProductIdQty(zdTaskItem.getValue());
wmsZdTask.setBomId(bomRouteList.get(0).getBomRouteId());
wmsZdTask.setCreateTime(DateUtils.getNowDate());
zdTaskService.insertWmsZdTask(wmsZdTask);
msg = "生产准备验证成功!缺少物料已生成组装任务!";
} else {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("缺少BOM项" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("缺少BOM项", techBom.getKnifeCode());
}
}
}
// 添加生产准备记录
// productionArrangements.setProcessCode(productionArrangements.getProcessCodes().toString());
productionArrangements.setTechnologyCode(productionArrangements.getTechnologyCode());
productionArrangements.setProcessUnit(productionArrangements.getProcessUnit());
productionArrangements.setStatus(0);
productionArrangements.setStartTime(productionArrangements.getStartTime());
productionArrangements.setEndTime(productionArrangements.getEndTime());
productionArrangements.setCreateTime(DateUtils.getNowDate());
productionArrangementsMapper.insertProductionArrangements(productionArrangements);
if (!msg.contains("缺少物料已生成组装任务!")) {
if (!msg.contains("缺少物料已生成组装任务!") && !msg.contains("已预订")) {
// 生成出库计划单
WmsOutPlan outPlan = new WmsOutPlan();
outPlan.setPlanCode(productionArrangements.getPlanSheet());
@ -621,9 +645,17 @@ public class BaseKnifeController extends BaseController {
// 对当前台账对象进行收录
baseKnifeHashMapMap.get(item.getMbbBdMrlId()).get(item.getAreaCode()).add(item);
// 出库
item.setKnifeFineState(2);
baseKnifeService.updateBaseKnife(item);
// 新增一条台账锁定记录 预订台账
BaseKnifeLocked baseKnifeLocked = new BaseKnifeLocked();
baseKnifeLocked.setPlanSheet(productionArrangements.getPlanSheet());
baseKnifeLocked.setStatus(0);
baseKnifeLocked.setLockedStartTime(productionArrangements.getStartTime());
baseKnifeLocked.setLockedEndTime(productionArrangements.getEndTime());
baseKnifeLocked.setItemCode(item.getKnifeCode());
baseKnifeLocked.setBaseKnifeId(item.getBaseKnifeId());
// 利用隐藏字段记录整刀的消耗定额
baseKnifeLocked.setExpendLife(Math.toIntExact(item.getAttr1()));
baseKnifeLockedMapper.insertBaseKnifeLocked(baseKnifeLocked);
});
// 生成出库计划明细
@ -696,6 +728,7 @@ public class BaseKnifeController extends BaseController {
productionArrangements.setStatus(1);
productionArrangementsMapper.updateProductionArrangements(productionArrangements);
this.productionArrangementsIsOk(productionArrangements);
}
operLog.setJsonResult(msg);
@ -704,6 +737,154 @@ public class BaseKnifeController extends BaseController {
return AjaxResult.success(msg);
}
// 调用生产准备完成接口
public void productionArrangementsIsOk(ProductionArrangements productionArrangements) throws IOException {
// 产线控制系统生产准备完成接口
String url = myConfig.getProductionControlPath() + "/cutterapi/cutComplete";
// 请求客户端
OkHttpClient client = new OkHttpClient();
// 构建请求数据
Map<String, Object> requestMap = new HashMap<>();
requestMap.put("prodordercode", productionArrangements.getPlanSheet());
requestMap.put("result", "0");
requestMap.put("completetime", CalendarUtil.getDateTimeStr());
// 获取工艺信息
BaseTechnologyBom technologyBomWrapper = new BaseTechnologyBom();
technologyBomWrapper.setTechnologyCode(productionArrangements.getTechnologyCode());
List<BaseTechnologyBom> technologyBomList = baseTechnologyBomService.selectBaseTechnologyBomList(technologyBomWrapper);
BaseKnife baseKnifeWrapper = new BaseKnife();
baseKnifeWrapper.setPlanSheet(productionArrangements.getPlanSheet());
// 获取刀具信息
List<Map<String, String>> cutterList = new ArrayList<>();
technologyBomList.forEach(baseTechnologyBom -> {
baseKnifeWrapper.setKnifeCode(baseTechnologyBom.getKnifeCode());
List<BaseKnife> baseKnifeList = baseKnifeService.selectBaseKnifeList(baseKnifeWrapper);
baseKnifeList.forEach(baseKnife -> {
Map<String, String> map = new HashMap<>();
map.put("specno", baseTechnologyBom.getProcessCode());
map.put("code", baseKnife.getKnifeCode());
map.put("name", baseKnife.getKnifeName());
map.put("life", baseKnife.getKnifeLife().toString());
cutterList.add(map);
});
});
requestMap.put("cutterinfo", cutterList);
// 构建请求数据
MediaType mediaType = MediaType.parse("application/json; charset=utf-8");
okhttp3.RequestBody requestBody = okhttp3.RequestBody.create(mediaType, JSON.toJSONString(requestMap));
// 请求体
Request request = new Request.Builder()
.url(url)
.post(requestBody)
.build();
// 发送请求
try(Response response = client.newCall(request).execute()) {
if (!response.isSuccessful())
throw new IOException("Unexpected code " + response);
// 请求响应
String responseBody = response.body().string();
System.out.println(responseBody);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public int getBomZdTaskQuantity(BomRoute bomRoute, Integer knifeCount){
// 记录基础物料数量的map
Map<String, Integer> baseKnifeItemCount = new HashMap<>();
// 遍历bom项 从台账表中筛选对应基础物料
for (MbbProduBom bom : bomRoute.getMbbProduBomList()) {
// 查询基础物料不包含已锁定的
BaseKnife baseKnifeWrapper = new BaseKnife();
baseKnifeWrapper.setMbbBdMrlId(bom.getMdItemId());
baseKnifeWrapper.setIsLocked(0);
List<BaseKnife> sitmTempList = baseKnifeService.selectBaseKnifeList(baseKnifeWrapper);
// 填充基础物料数量
baseKnifeItemCount.put(bom.getMdItemCode(), sitmTempList.size());
}
// 更具需要的物料数量计算基础物料能组装多少
for (int i = 0; i < knifeCount; i++){
// 遍历bom项 并减去数量
for (MbbProduBom bom : bomRoute.getMbbProduBomList()) {
if (baseKnifeItemCount.get(bom.getMdItemCode()) - bom.getStandardDosage() >= 0){
baseKnifeItemCount.put(bom.getMdItemCode(), baseKnifeItemCount.get(bom.getMdItemCode()) - bom.getStandardDosage());
} else return i;
}
}
return knifeCount;
}
public List<Long> getLockedBaseKnifeId(String mdItemCode, ProductionArrangements productionArrangements, int count, int expendLife){
// 查询该物料编码的锁定记录
BaseKnifeLocked baseKnifeLockedWrapper = new BaseKnifeLocked();
baseKnifeLockedWrapper.setItemCode(mdItemCode);
baseKnifeLockedWrapper.setStatus(0);
List<BaseKnifeLocked> baseKnifeLockedList = baseKnifeLockedMapper.selectBaseKnifeLockedList(baseKnifeLockedWrapper);
if (baseKnifeLockedList.isEmpty()) return new ArrayList<>();
// 根据台账ID进行分组
Map<Long, List<BaseKnifeLocked>> groupBaseKnifeLocked = new HashMap<>();
for (BaseKnifeLocked item : baseKnifeLockedList){
Long key = item.getBaseKnifeId();
// 判断是否已经锁定, 未锁定则跳过
BaseKnife baseKnife = baseKnifeService.selectBaseKnifeByBaseKnifeId(key);
if (baseKnife.getIsLocked() == 0 || ((baseKnife.getKnifeLife() + baseKnife.getResetCount() * 100) - item.getExpendLife()) < expendLife) continue;
// 进行分组
if (groupBaseKnifeLocked.containsKey(key)){
groupBaseKnifeLocked.get(key).add(item);
} else {
List<BaseKnifeLocked> tempList = new ArrayList<>();
tempList.add(item);
groupBaseKnifeLocked.put(key, tempList);
}
}
// 遍历获取锁定时间不吻合的项
List<Long> lockedBaseKnifeIds = new ArrayList<>();
for (Map.Entry<Long, List<BaseKnifeLocked>> entry : groupBaseKnifeLocked.entrySet()){
if (count > 0){
boolean flag = true;
for (BaseKnifeLocked baseKnifeLocked : entry.getValue()){
// 如果已经锁定的开始时间在生产计划开始时间之后并且结束时间在生产计划开始时间之后则不符合
if (baseKnifeLocked.getLockedStartTime().getTime() < productionArrangements.getStartTime().getTime()){
if (baseKnifeLocked.getLockedEndTime().getTime() > productionArrangements.getStartTime().getTime()) {
flag = false;
break;
}
} else { // 如果已经锁定的开始时间在生产计划开始时间之前并且开始时间在生产计划结束时间之前则不符合
if (baseKnifeLocked.getLockedStartTime().getTime() < productionArrangements.getEndTime().getTime()) {
flag = false;
break;
}
}
}
if (flag) {
lockedBaseKnifeIds.add(entry.getKey());
count--;
}
} else return lockedBaseKnifeIds;
}
// 数量是否足够
if (count > 0) return new ArrayList<>();
else return lockedBaseKnifeIds;
}
/**
* 修改工具台账
@ -728,7 +909,7 @@ public class BaseKnifeController extends BaseController {
// 如果未锁定的物料不足所需数量
if (baseKnifeList.size() < mbbProduBom.getStandardDosage() * zdTask.getProductIdQty())
return AjaxResult.error("bom物料不足进行组装" + mbbProduBom.getMdItemCode());
throw new RuntimeException("bom物料不足进行组装" + mbbProduBom.getMdItemCode());
}
List<WmsOutPlanDetail> wmsOutPlanDetailList = new ArrayList<>();
@ -816,6 +997,7 @@ public class BaseKnifeController extends BaseController {
outPlanDetail.setWmStorageAreaCode(wmStorageArea.getAreaCode());
outPlanDetail.setWmStorageAreaName(wmStorageArea.getAreaName());
outPlanDetail.setDetailState("1");
outPlanDetail.setCreateTime(DateUtils.getNowDate());
wmsOutPlanDetailList.add(outPlanDetail);
}
@ -905,36 +1087,36 @@ public class BaseKnifeController extends BaseController {
wmsInPlanTemp.setCellCode(zdTask.getAttr3());
wmsInPlanTemp.setPlanCode(zdTask.getAttr4() == null ? zdTask.getCode() : zdTask.getAttr4());
wmsInPlanTemp.setRelBillCode("组装单据");
wmsInPlanTemp.setPlanTypeId(13L);
wmsInPlanTemp.setPlanTypeCode("ZDRK");
wmsInPlanTemp.setPlanTypeId(9L);
wmsInPlanTemp.setPlanTypeCode("ZDHK");
wmsInPlanTemp.setCreateBy(getUsername());
wmsInPlanTemp.setCreateTime(DateUtils.getNowDate());
// 入库任务明细
List<WmsInPlanDetails> wmsInPlanDetailsList = new ArrayList<>();
WmsInPlanDetails wmsInPlanDetails = new WmsInPlanDetails();
wmsInPlanDetails.setMaterialId(zdTask.getmProductId().toString());
wmsInPlanDetails.setBatch(batchNum);
wmsInPlanDetails.setCellId(1L);
wmsInPlanDetails.setQuantity(zdTask.getProductIdQty().toString());
wmsInPlanDetails.setQuantityIn(zdTask.getProductIdQty().toString());
wmsInPlanDetails.setPlanInStatus("0");
wmsInPlanDetailsList.add(wmsInPlanDetails);
wmsInPlanTemp.setWmsInPlanDetailsList(wmsInPlanDetailsList);
List<WmsInPlanDetail> wmsInPlanDetailList = new ArrayList<>();
WmsInPlanDetail wmsInPlanDetail = new WmsInPlanDetail();
wmsInPlanDetail.setMaterialId(zdTask.getmProductId().toString());
wmsInPlanDetail.setBatch(batchNum);
wmsInPlanDetail.setCellId(1L);
wmsInPlanDetail.setQuantity(zdTask.getProductIdQty().toString());
wmsInPlanDetail.setQuantityIn(zdTask.getProductIdQty().toString());
wmsInPlanDetail.setPlanInStatus("0");
wmsInPlanDetailList.add(wmsInPlanDetail);
wmsInPlanTemp.setWmsInPlanDetailList(wmsInPlanDetailList);
wmsInPlanService.insertWmsInPlan(wmsInPlanTemp);
wmsInPlan = wmsInPlanTemp;
} else {
// 入库任务明细
List<WmsInPlanDetails> wmsInPlanDetailsList = wmsInPlan.getWmsInPlanDetailsList();
WmsInPlanDetails wmsInPlanDetails = new WmsInPlanDetails();
wmsInPlanDetails.setMaterialId(zdTask.getmProductId().toString());
wmsInPlanDetails.setBatch(batchNum);
wmsInPlanDetails.setCellId(1L);
wmsInPlanDetails.setQuantity(zdTask.getProductIdQty().toString());
wmsInPlanDetails.setQuantityIn(zdTask.getProductIdQty().toString());
wmsInPlanDetails.setPlanInStatus("0");
wmsInPlanDetailsList.add(wmsInPlanDetails);
wmsInPlan.setWmsInPlanDetailsList(wmsInPlanDetailsList);
List<WmsInPlanDetail> wmsInPlanDetailList = wmsInPlan.getWmsInPlanDetailList();
WmsInPlanDetail wmsInPlanDetail = new WmsInPlanDetail();
wmsInPlanDetail.setMaterialId(zdTask.getmProductId().toString());
wmsInPlanDetail.setBatch(batchNum);
wmsInPlanDetail.setCellId(1L);
wmsInPlanDetail.setQuantity(zdTask.getProductIdQty().toString());
wmsInPlanDetail.setQuantityIn(zdTask.getProductIdQty().toString());
wmsInPlanDetail.setPlanInStatus("0");
wmsInPlanDetailList.add(wmsInPlanDetail);
wmsInPlan.setWmsInPlanDetailList(wmsInPlanDetailList);
wmsInPlanService.updateWmsInPlan(wmsInPlan);
}
@ -944,7 +1126,7 @@ public class BaseKnifeController extends BaseController {
// 生成任务号
String taskInCode = MultiModuleCodeGenerator.generateTaskCode("RKT");
wmsInTask.setTaskInCode(taskInCode);
wmsInTask.setPlanInId(wmsInPlan.getPlanId().toString());
wmsInTask.setPlanInId(wmsInPlan.getPlanId());
wmsInTask.setPlanInCode(wmsInPlan.getPlanCode());
wmsInTask.setMaterialCode(mdItem.getItemCode());
wmsInTask.setTaskInQuantity(zdTask.getProductIdQty());
@ -954,6 +1136,7 @@ public class BaseKnifeController extends BaseController {
wmsInTask.setBatch(batchNum);
wmsInTask.setMaterialId(zdTask.getmProductId().toString());
wmsInTask.setPlanTypeId("9");
wmsInTask.setPlanTypeCode("ZDHK");
wmsInTask.setPlanInStatus("1");
wmsInTaskService.insertWmsInTask(wmsInTask);
@ -1020,6 +1203,7 @@ public class BaseKnifeController extends BaseController {
@Log(title = "工具台账", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BaseKnife baseKnife) {
baseKnife.setCreateBy(getUsername());
return toAjax(baseKnifeService.insertBaseKnife(baseKnife));
}
@ -1030,6 +1214,7 @@ public class BaseKnifeController extends BaseController {
@Log(title = "工具台账", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BaseKnife baseKnife) {
baseKnife.setUpdateBy(getUsername());
return toAjax(baseKnifeService.updateBaseKnife(baseKnife));
}

View File

@ -0,0 +1,104 @@
package com.ktg.mes.md.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ktg.common.annotation.Log;
import com.ktg.common.core.controller.BaseController;
import com.ktg.common.core.domain.AjaxResult;
import com.ktg.common.enums.BusinessType;
import com.ktg.mes.md.domain.BaseKnifeLocked;
import com.ktg.mes.md.service.IBaseKnifeLockedService;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.common.core.page.TableDataInfo;
/**
* 台账锁定Controller
*
* @author yinjinlu
* @date 2024-12-09
*/
@RestController
@RequestMapping("/md/LOCKED")
public class BaseKnifeLockedController extends BaseController
{
@Autowired
private IBaseKnifeLockedService baseKnifeLockedService;
/**
* 查询台账锁定列表
*/
@PreAuthorize("@ss.hasPermi('md:LOCKED:list')")
@GetMapping("/list")
public TableDataInfo list(BaseKnifeLocked baseKnifeLocked)
{
startPage();
List<BaseKnifeLocked> list = baseKnifeLockedService.selectBaseKnifeLockedList(baseKnifeLocked);
return getDataTable(list);
}
/**
* 导出台账锁定列表
*/
@PreAuthorize("@ss.hasPermi('md:LOCKED:export')")
@Log(title = "台账锁定", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BaseKnifeLocked baseKnifeLocked)
{
List<BaseKnifeLocked> list = baseKnifeLockedService.selectBaseKnifeLockedList(baseKnifeLocked);
ExcelUtil<BaseKnifeLocked> util = new ExcelUtil<BaseKnifeLocked>(BaseKnifeLocked.class);
util.exportExcel(response, list, "台账锁定数据");
}
/**
* 获取台账锁定详细信息
*/
@PreAuthorize("@ss.hasPermi('md:LOCKED:query')")
@GetMapping(value = "/{baseKnifeLockedId}")
public AjaxResult getInfo(@PathVariable("baseKnifeLockedId") String baseKnifeLockedId)
{
return AjaxResult.success(baseKnifeLockedService.selectBaseKnifeLockedByBaseKnifeLockedId(baseKnifeLockedId));
}
/**
* 新增台账锁定
*/
@PreAuthorize("@ss.hasPermi('md:LOCKED:add')")
@Log(title = "台账锁定", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BaseKnifeLocked baseKnifeLocked)
{
return toAjax(baseKnifeLockedService.insertBaseKnifeLocked(baseKnifeLocked));
}
/**
* 修改台账锁定
*/
@PreAuthorize("@ss.hasPermi('md:LOCKED:edit')")
@Log(title = "台账锁定", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BaseKnifeLocked baseKnifeLocked)
{
return toAjax(baseKnifeLockedService.updateBaseKnifeLocked(baseKnifeLocked));
}
/**
* 删除台账锁定
*/
@PreAuthorize("@ss.hasPermi('md:LOCKED:remove')")
@Log(title = "台账锁定", businessType = BusinessType.DELETE)
@DeleteMapping("/{baseKnifeLockedIds}")
public AjaxResult remove(@PathVariable String[] baseKnifeLockedIds)
{
return toAjax(baseKnifeLockedService.deleteBaseKnifeLockedByBaseKnifeLockedIds(baseKnifeLockedIds));
}
}

View File

@ -77,9 +77,7 @@ public class InventoryBatchController extends BaseController
@GetMapping("/list")
public TableDataInfo list(InventoryBatch inventoryBatch) {
startPage();
List<InventoryBatch> result = inventoryBatchService.selectInventoryBatchList(inventoryBatch);
return getDataTable(result);
}

View File

@ -18,6 +18,7 @@ import com.ktg.mes.md.service.IMdUnitMeasureService;
import com.ktg.mes.wm.utils.WmBarCodeUtil;
import com.ktg.system.domain.SysOperLog;
import com.ktg.system.service.ISysOperLogService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
@ -29,22 +30,13 @@ import java.util.*;
@RestController
@RequestMapping("/mes/md/mditem")
@RequiredArgsConstructor
public class MdItemController extends BaseController {
@Autowired
private IMdItemService mdItemService;
@Autowired
private IItemTypeService iItemTypeService;
@Autowired
private IMdUnitMeasureService mdUnitMeasureService;
@Autowired
private WmBarCodeUtil barcodeUtil;
@Autowired
private ISysOperLogService operLogService;
private final IMdItemService mdItemService;
private final IItemTypeService iItemTypeService;
private final IMdUnitMeasureService mdUnitMeasureService;
private final WmBarCodeUtil barcodeUtil;
private final ISysOperLogService operLogService;
/**
* 列表查询
@ -140,6 +132,15 @@ public class MdItemController extends BaseController {
return getDataTable(list);
}
/**
* 同步小型刀具库 物料数据
* @return
*/
@GetMapping("/asyncSmallKnife")
public AjaxResult asyncSmallKnifeData() {
return AjaxResult.success(mdItemService.asyncSmallKnifeData());
}
/**
* 导出物料列表
*/

View File

@ -1,20 +1,31 @@
package com.ktg.mes.md.controller;
import com.alibaba.fastjson.JSON;
import com.ktg.common.annotation.Log;
import com.ktg.common.constant.UserConstants;
import com.ktg.common.core.controller.BaseController;
import com.ktg.common.core.domain.AjaxResult;
import com.ktg.common.core.page.TableDataInfo;
import com.ktg.common.enums.BusinessType;
import com.ktg.common.utils.StringUtils;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.mes.md.domain.WmsOutPlan;
import com.ktg.mes.md.domain.WmsOutPlanDetailEntity;
import com.ktg.generator.util.MultiModuleCodeGenerator;
import com.ktg.mes.md.domain.*;
import com.ktg.mes.md.domain.dto.WmsOutboundOrderDto;
import com.ktg.mes.md.service.IAP0AEService;
import com.ktg.mes.md.service.IMdItemService;
import com.ktg.mes.md.service.IWmsBusinessTypeService;
import com.ktg.mes.md.service.IWmsOutPlanService;
import com.ktg.system.domain.SysMessage;
import com.ktg.system.service.ISysMessageService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -26,9 +37,12 @@ import java.util.List;
*/
@RestController
@RequestMapping("/md/PLAN")
@RequiredArgsConstructor
public class WmsOutPlanController extends BaseController {
@Autowired
private IWmsOutPlanService wmsOutPlanService;
private final IWmsOutPlanService wmsOutPlanService;
private final IWmsBusinessTypeService wmsBusinessTypeService;
private final IMdItemService mdItemService;
private final ISysMessageService sysMessageService;
/**
* 查询出库计划管理列表
@ -40,12 +54,85 @@ public class WmsOutPlanController extends BaseController {
return getDataTable(list);
}
@PostMapping("/open/add")
public AjaxResult openAdd(@RequestBody WmsOutPlan wmsOutPlan) {
// 出库计划编码自动生成
if (wmsOutPlan.getPlanCode() == null || wmsOutPlan.getPlanCode().isEmpty()) {
wmsOutPlan.setPlanCode(MultiModuleCodeGenerator.generateTaskCode("CKP"));
}
return toAjax(wmsOutPlanService.insertWmsOutPlanAndRun(wmsOutPlan));
}
/**
* 订单生成出库计划
* @param wmsOutboundOrderDto
* @return
*/
@PostMapping("/open/order/add")
public AjaxResult openOrderAdd(@RequestBody @Valid WmsOutboundOrderDto wmsOutboundOrderDto) {
// 查询业务类型
WmsBusinessType wmsBusinessType = wmsBusinessTypeService.selectWmsBusinessTypeByCode(wmsOutboundOrderDto.getTypeCode());
if (wmsBusinessType == null) {
return AjaxResult.error("出库类型编码错误:" + wmsOutboundOrderDto.getTypeCode());
}
// 查询物料信息
MdItem mdItem = mdItemService.selectMdItemByCode(wmsOutboundOrderDto.getMaterialCode());
if (mdItem == null) {
return AjaxResult.error("物料编码错误:" + wmsOutboundOrderDto.getMaterialCode());
}
// 创建出库计划
WmsOutPlan wmsOutPlan = new WmsOutPlan();
wmsOutPlan.setPlanCode(MultiModuleCodeGenerator.generateTaskCode("CKP"));
wmsOutPlan.setWmsBusinessTypeId(wmsBusinessType.getTypeId());
wmsOutPlan.setWmsBusinessType(wmsBusinessType);
wmsOutPlan.setPlanType("SGLR");
wmsOutPlan.setPlanState("0");
wmsOutPlan.setRemark("订单号: " + wmsOutboundOrderDto.getOrderId());
// 创建出库计划明细
ArrayList<WmsOutPlanDetail> wmsOutPlanDetails = getWmsOutPlanDetails(wmsOutboundOrderDto, mdItem);
wmsOutPlan.setWmsOutPlanDetailList(wmsOutPlanDetails);
// 插入出库计划并执行
try {
int i = wmsOutPlanService.insertWmsOutPlanAndRun(wmsOutPlan);
if (i > 0) {
// 创建消息通知
sysMessageService.insertSysPromptMessage("出库任务","整刀出库: " + wmsOutboundOrderDto.getMaterialCode());
return AjaxResult.success("出库任务创建成功");
} else {
return AjaxResult.error("出库任务创建失败,原因:数据库插入失败");
}
} catch (Exception e) {
return AjaxResult.error("出库任务创建失败,原因:" + e.getMessage());
}
}
private static ArrayList<WmsOutPlanDetail> getWmsOutPlanDetails(WmsOutboundOrderDto wmsOutboundOrderDto, MdItem mdItem) {
WmsOutPlanDetail wmsOutPlanDetail = new WmsOutPlanDetail();
wmsOutPlanDetail.setMdItemId(mdItem.getItemId());
wmsOutPlanDetail.setMdItemName(mdItem.getItemName());
wmsOutPlanDetail.setMdItemCode(mdItem.getItemCode());
wmsOutPlanDetail.setMdItemUnit(mdItem.getUnitName());
wmsOutPlanDetail.setPlannedQuantity(wmsOutboundOrderDto.getQuantity());
wmsOutPlanDetail.setRealQuantity(wmsOutboundOrderDto.getQuantity());
wmsOutPlanDetail.setDetailBatchNum(wmsOutboundOrderDto.getOrderId());
wmsOutPlanDetail.setDetailState("0");
ArrayList<WmsOutPlanDetail> wmsOutPlanDetails = new ArrayList<>();
wmsOutPlanDetails.add(wmsOutPlanDetail);
return wmsOutPlanDetails;
}
/**
* 查询出库计划管理列表
*/
@PreAuthorize("@ss.hasPermi('md:PLAN:list')")
@GetMapping("/list")
public TableDataInfo list(WmsOutPlan wmsOutPlan) {
// wmsOutPlanService.synchronizationMiniBox(getUsername());
startPage();
List<WmsOutPlan> list = wmsOutPlanService.selectWmsOutPlanList(wmsOutPlan);
return getDataTable(list);
@ -79,8 +166,12 @@ public class WmsOutPlanController extends BaseController {
@Log(title = "出库计划管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WmsOutPlan wmsOutPlan) {
if (UserConstants.NOT_UNIQUE.equals(wmsOutPlanService.checkPlanCodeUnique(wmsOutPlan))) {
return AjaxResult.error("新增出库计划失败,出库计划编码“" + wmsOutPlan.getPlanCode() + "”已存在");
// if (UserConstants.NOT_UNIQUE.equals(wmsOutPlanService.checkPlanCodeUnique(wmsOutPlan))) {
// return AjaxResult.error("新增出库计划失败,出库计划编码“" + wmsOutPlan.getPlanCode() + "”已存在");
// }
// 出库计划编码自动生成
if (wmsOutPlan.getPlanCode() == null || wmsOutPlan.getPlanCode().isEmpty()) {
wmsOutPlan.setPlanCode(MultiModuleCodeGenerator.generateTaskCode("CKP"));
}
wmsOutPlan.setCreateBy(getUsername());
return toAjax(wmsOutPlanService.insertWmsOutPlan(wmsOutPlan));
@ -104,7 +195,14 @@ public class WmsOutPlanController extends BaseController {
return toAjax(wmsOutPlanService.runWmsOutPlan(wmsOutPlanIds));
}
@PreAuthorize("@ss.hasPermi('md:PLAN:edit')")
@PreAuthorize("@ss.hasPermi('md:PLAN:add')")
@Log(title = "出库计划管理", businessType = BusinessType.UPDATE)
@PutMapping("/synchronization-mini-box")
public AjaxResult synchronizationMiniBox() {
return AjaxResult.success(wmsOutPlanService.synchronizationMiniBox(getUsername()));
}
@PreAuthorize("@ss.hasPermi('md:PLAN:add')")
@Log(title = "出库计划管理", businessType = BusinessType.UPDATE)
@PutMapping("/auto-scrap-out")
public AjaxResult autoScrapOut() {

View File

@ -6,15 +6,34 @@ import com.ktg.common.core.domain.AjaxResult;
import com.ktg.common.core.page.TableDataInfo;
import com.ktg.common.enums.BusinessType;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.mes.md.domain.MyConfig;
import com.ktg.mes.md.domain.ParamXml;
import com.ktg.mes.md.domain.WmsOutPlan;
import com.ktg.mes.md.domain.WmsOutTask;
import com.ktg.mes.md.service.IWmsOutTaskService;
import com.ktg.mes.wm.domain.WmsInPlan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.w3c.dom.Node;
import org.xml.sax.SAXException;
import java.io.File;
import java.io.IOException;
import java.util.List;
/**
@ -29,6 +48,9 @@ public class WmsOutTaskController extends BaseController {
@Autowired
private IWmsOutTaskService wmsOutTaskService;
@Autowired
private MyConfig myConfig;
/**
* 开放 查询出库任务列表
@ -40,11 +62,19 @@ public class WmsOutTaskController extends BaseController {
return getDataTable(list);
}
@PutMapping("/open/run/{wmsOutTaskIds}")
public AjaxResult openRun(@PathVariable Long[] wmsOutTaskIds) throws JAXBException {
try {
return toAjax(wmsOutTaskService.runWmsOutTask(wmsOutTaskIds));
} catch (JAXBException e) {
throw new RuntimeException(e);
}
}
/**
* 开放 查询出库任务列表
*/
@GetMapping("/open/incomplete/{planSheet}")
@GetMapping("/open/incompleteList/{planSheet}")
public TableDataInfo openList(@PathVariable String planSheet) {
startPage();
List<WmsOutTask> list = wmsOutTaskService.selectWmsOutTaskIncompleteList(planSheet);
@ -62,6 +92,23 @@ public class WmsOutTaskController extends BaseController {
return getDataTable(list);
}
/**
* 查询出库任务列表
*/
@PreAuthorize("@ss.hasPermi('md:TASK:query')")
@GetMapping("/xmlParam")
public void list() throws IOException, SAXException, ParserConfigurationException, JAXBException {
// 读取xml配置文件
File xmlFile = new File(myConfig.getToolSettingXmlPath());
JAXBContext jaxbContext = JAXBContext.newInstance(ParamXml.class);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
ParamXml paramXml = (ParamXml) unmarshaller.unmarshal(xmlFile);
System.out.println(paramXml.getRfid());
System.out.println(paramXml.getName());
System.out.println(paramXml.getParam());
}
/**
* 导出出库任务列表
*/
@ -106,7 +153,7 @@ public class WmsOutTaskController extends BaseController {
@PreAuthorize("@ss.hasPermi('md:TASK:edit')")
@Log(title = "手动出库", businessType = BusinessType.UPDATE)
@PutMapping("/run/{wmsOutTaskIds}")
public AjaxResult run(@PathVariable Long[] wmsOutTaskIds) {
public AjaxResult run(@PathVariable Long[] wmsOutTaskIds) throws JAXBException {
return toAjax(wmsOutTaskService.runWmsOutTask(wmsOutTaskIds));
}

View File

@ -0,0 +1,360 @@
package com.ktg.mes.md.domain;
import java.util.Date;
public class AP0AD {
private String AD001 = null;
private String AD002 = null;
private Date AD003 = null;
private String AD004 = null;
private String AD005 = null;
private String AD006 = null;
private String AD007 = null;
private Double AD008 = null;
private Double AD009 = null;
private Double AD010 = null;
private String AD011 = null;
private String AD012 = null;
private String AD013 = null;
private String AD014 = null;
private String AD015 = null;
private String AD016 = null;
private String AD017 = null;
private String UDF01 = null;
private String UDF02 = null;
private String UDF03 = null;
private String UDF04 = null;
private String UDF05 = null;
private Double UDF51 = null;
private Double UDF52 = null;
private Double UDF53 = null;
private Double UDF54 = null;
private Double UDF55 = null;
private String USER01 = null;
private String USER02 = null;
private Date DATE01 = null;
private Date DATE02 = null;
public AP0AD() {
super();
}
public AP0AD(String AD001, String AD002, Date AD003, String AD004, String AD005, String AD006, String AD007, Double AD008, Double AD009, Double AD010, String AD011, String AD012, String AD013, String AD014, String AD015, String AD016, String AD017, String UDF01, String UDF02, String UDF03, String UDF04, String UDF05, Double UDF51, Double UDF52, Double UDF53, Double UDF54, Double UDF55, String USER01, String USER02, Date DATE01, Date DATE02) {
this.AD001 = AD001;
this.AD002 = AD002;
this.AD003 = AD003;
this.AD004 = AD004;
this.AD005 = AD005;
this.AD006 = AD006;
this.AD007 = AD007;
this.AD008 = AD008;
this.AD009 = AD009;
this.AD010 = AD010;
this.AD011 = AD011;
this.AD012 = AD012;
this.AD013 = AD013;
this.AD014 = AD014;
this.AD015 = AD015;
this.AD016 = AD016;
this.AD017 = AD017;
this.UDF01 = UDF01;
this.UDF02 = UDF02;
this.UDF03 = UDF03;
this.UDF04 = UDF04;
this.UDF05 = UDF05;
this.UDF51 = UDF51;
this.UDF52 = UDF52;
this.UDF53 = UDF53;
this.UDF54 = UDF54;
this.UDF55 = UDF55;
this.USER01 = USER01;
this.USER02 = USER02;
this.DATE01 = DATE01;
this.DATE02 = DATE02;
}
public String getAD001() {
return AD001;
}
public void setAD001(String AD001) {
this.AD001 = AD001;
}
public String getAD002() {
return AD002;
}
public void setAD002(String AD002) {
this.AD002 = AD002;
}
public Date getAD003() {
return AD003;
}
public void setAD003(Date AD003) {
this.AD003 = AD003;
}
public String getAD004() {
return AD004;
}
public void setAD004(String AD004) {
this.AD004 = AD004;
}
public String getAD005() {
return AD005;
}
public void setAD005(String AD005) {
this.AD005 = AD005;
}
public String getAD006() {
return AD006;
}
public void setAD006(String AD006) {
this.AD006 = AD006;
}
public String getAD007() {
return AD007;
}
public void setAD007(String AD007) {
this.AD007 = AD007;
}
public Double getAD008() {
return AD008;
}
public void setAD008(Double AD008) {
this.AD008 = AD008;
}
public Double getAD009() {
return AD009;
}
public void setAD009(Double AD009) {
this.AD009 = AD009;
}
public Double getAD010() {
return AD010;
}
public void setAD010(Double AD010) {
this.AD010 = AD010;
}
public String getAD011() {
return AD011;
}
public void setAD011(String AD011) {
this.AD011 = AD011;
}
public String getAD012() {
return AD012;
}
public void setAD012(String AD012) {
this.AD012 = AD012;
}
public String getAD013() {
return AD013;
}
public void setAD013(String AD013) {
this.AD013 = AD013;
}
public String getAD014() {
return AD014;
}
public void setAD014(String AD014) {
this.AD014 = AD014;
}
public String getAD015() {
return AD015;
}
public void setAD015(String AD015) {
this.AD015 = AD015;
}
public String getAD016() {
return AD016;
}
public void setAD016(String AD016) {
this.AD016 = AD016;
}
public String getAD017() {
return AD017;
}
public void setAD017(String AD017) {
this.AD017 = AD017;
}
public String getUDF01() {
return UDF01;
}
public void setUDF01(String UDF01) {
this.UDF01 = UDF01;
}
public String getUDF02() {
return UDF02;
}
public void setUDF02(String UDF02) {
this.UDF02 = UDF02;
}
public String getUDF03() {
return UDF03;
}
public void setUDF03(String UDF03) {
this.UDF03 = UDF03;
}
public String getUDF04() {
return UDF04;
}
public void setUDF04(String UDF04) {
this.UDF04 = UDF04;
}
public String getUDF05() {
return UDF05;
}
public void setUDF05(String UDF05) {
this.UDF05 = UDF05;
}
public Double getUDF51() {
return UDF51;
}
public void setUDF51(Double UDF51) {
this.UDF51 = UDF51;
}
public Double getUDF52() {
return UDF52;
}
public void setUDF52(Double UDF52) {
this.UDF52 = UDF52;
}
public Double getUDF53() {
return UDF53;
}
public void setUDF53(Double UDF53) {
this.UDF53 = UDF53;
}
public Double getUDF54() {
return UDF54;
}
public void setUDF54(Double UDF54) {
this.UDF54 = UDF54;
}
public Double getUDF55() {
return UDF55;
}
public void setUDF55(Double UDF55) {
this.UDF55 = UDF55;
}
public String getUSER01() {
return USER01;
}
public void setUSER01(String USER01) {
this.USER01 = USER01;
}
public String getUSER02() {
return USER02;
}
public void setUSER02(String USER02) {
this.USER02 = USER02;
}
public Date getDATE01() {
return DATE01;
}
public void setDATE01(Date DATE01) {
this.DATE01 = DATE01;
}
public Date getDATE02() {
return DATE02;
}
public void setDATE02(Date DATE02) {
this.DATE02 = DATE02;
}
@Override
public String toString() {
return "AP0AD{" +
"AD001='" + AD001 + '\'' +
", AD002='" + AD002 + '\'' +
", AD003=" + AD003 +
", AD004='" + AD004 + '\'' +
", AD005='" + AD005 + '\'' +
", AD006='" + AD006 + '\'' +
", AD007='" + AD007 + '\'' +
", AD008=" + AD008 +
", AD009=" + AD009 +
", AD010=" + AD010 +
", AD011='" + AD011 + '\'' +
", AD012='" + AD012 + '\'' +
", AD013='" + AD013 + '\'' +
", AD014='" + AD014 + '\'' +
", AD015='" + AD015 + '\'' +
", AD016='" + AD016 + '\'' +
", AD017='" + AD017 + '\'' +
", UDF01='" + UDF01 + '\'' +
", UDF02='" + UDF02 + '\'' +
", UDF03='" + UDF03 + '\'' +
", UDF04='" + UDF04 + '\'' +
", UDF05='" + UDF05 + '\'' +
", UDF51=" + UDF51 +
", UDF52=" + UDF52 +
", UDF53=" + UDF53 +
", UDF54=" + UDF54 +
", UDF55=" + UDF55 +
", USER01='" + USER01 + '\'' +
", USER02='" + USER02 + '\'' +
", DATE01=" + DATE01 +
", DATE02=" + DATE02 +
'}';
}
}

View File

@ -0,0 +1,168 @@
package com.ktg.mes.md.domain;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
/**
* @author luo26
*/
@Setter
@Getter
public class AP0AE {
private String AE001 = null;
private String AE002 = null;
private Date AE003 = null;
private String AE004 = null;
private String AE005 = null;
private String AE006 = null;
private String AE007 = null;
private String AE008 = null;
private String AE009 = null;
private String AE010 = null;
private String AE011 = null;
private String AE012 = null;
private String AE013 = null;
private String AE014 = null;
private String AE015 = null;
private String AE016 = null;
private Double AE017 = null;
private Double AE018 = null;
private Double AE019 = null;
private String AE020 = null;
private String AE021 = null;
private Double AE022 = null;
private String AE023 = null;
private String AE024 = null;
private String AE025 = null;
private String AE026 = null;
private String AE027 = null;
private String AE028 = null;
private String UDF01 = null;
private String UDF02 = null;
private String UDF03 = null;
private String UDF04 = null;
private String UDF05 = null;
private String UDF06 = null;
private String UDF07 = null;
private String UDF08 = null;
private String UDF09 = null;
private String UDF10 = null;
private Double UDF51 = null;
private Double UDF52 = null;
private Double UDF53 = null;
private Double UDF54 = null;
private Double UDF55 = null;
private String USER01 = null;
private String USER02 = null;
private Date DATE01 = null;
private Date DATE02 = null;
public AP0AE() {
super();
}
public AP0AE(String AE001, String AE002, Date AE003, String AE004, String AE005, String AE006, String AE007, String AE008, String AE009, String AE010, String AE011, String AE012, String AE013, String AE014, String AE015, String AE016, Double AE017, Double AE018, Double AE019, String AE020, String AE021, Double AE022, String AE023, String AE024, String AE025, String AE026, String AE027, String AE028, String UDF01, String UDF02, String UDF03, String UDF04, String UDF05, String UDF06, String UDF07, String UDF08, String UDF09, String UDF10, Double UDF51, Double UDF52, Double UDF53, Double UDF54, Double UDF55, String USER01, String USER02, Date DATE01, Date DATE02) {
this.AE001 = AE001;
this.AE002 = AE002;
this.AE003 = AE003;
this.AE004 = AE004;
this.AE005 = AE005;
this.AE006 = AE006;
this.AE007 = AE007;
this.AE008 = AE008;
this.AE009 = AE009;
this.AE010 = AE010;
this.AE011 = AE011;
this.AE012 = AE012;
this.AE013 = AE013;
this.AE014 = AE014;
this.AE015 = AE015;
this.AE016 = AE016;
this.AE017 = AE017;
this.AE018 = AE018;
this.AE019 = AE019;
this.AE020 = AE020;
this.AE021 = AE021;
this.AE022 = AE022;
this.AE023 = AE023;
this.AE024 = AE024;
this.AE025 = AE025;
this.AE026 = AE026;
this.AE027 = AE027;
this.AE028 = AE028;
this.UDF01 = UDF01;
this.UDF02 = UDF02;
this.UDF03 = UDF03;
this.UDF04 = UDF04;
this.UDF05 = UDF05;
this.UDF06 = UDF06;
this.UDF07 = UDF07;
this.UDF08 = UDF08;
this.UDF09 = UDF09;
this.UDF10 = UDF10;
this.UDF51 = UDF51;
this.UDF52 = UDF52;
this.UDF53 = UDF53;
this.UDF54 = UDF54;
this.UDF55 = UDF55;
this.USER01 = USER01;
this.USER02 = USER02;
this.DATE01 = DATE01;
this.DATE02 = DATE02;
}
@Override
public String toString() {
return "AP0AE{" +
"AE001='" + AE001 + '\'' +
", AE002='" + AE002 + '\'' +
", AE003=" + AE003 +
", AE004='" + AE004 + '\'' +
", AE005='" + AE005 + '\'' +
", AE006='" + AE006 + '\'' +
", AE007='" + AE007 + '\'' +
", AE008='" + AE008 + '\'' +
", AE009='" + AE009 + '\'' +
", AE010='" + AE010 + '\'' +
", AE011='" + AE011 + '\'' +
", AE012='" + AE012 + '\'' +
", AE013='" + AE013 + '\'' +
", AE014='" + AE014 + '\'' +
", AE015='" + AE015 + '\'' +
", AE016='" + AE016 + '\'' +
", AE017=" + AE017 +
", AE018=" + AE018 +
", AE019=" + AE019 +
", AE020='" + AE020 + '\'' +
", AE021='" + AE021 + '\'' +
", AE022=" + AE022 +
", AE023='" + AE023 + '\'' +
", AE024='" + AE024 + '\'' +
", AE025='" + AE025 + '\'' +
", AE026='" + AE026 + '\'' +
", AE027='" + AE027 + '\'' +
", AE028='" + AE028 + '\'' +
", UDF01='" + UDF01 + '\'' +
", UDF02='" + UDF02 + '\'' +
", UDF03='" + UDF03 + '\'' +
", UDF04='" + UDF04 + '\'' +
", UDF05='" + UDF05 + '\'' +
", UDF06='" + UDF06 + '\'' +
", UDF07='" + UDF07 + '\'' +
", UDF08='" + UDF08 + '\'' +
", UDF09='" + UDF09 + '\'' +
", UDF10='" + UDF10 + '\'' +
", UDF51=" + UDF51 +
", UDF52=" + UDF52 +
", UDF53=" + UDF53 +
", UDF54=" + UDF54 +
", UDF55=" + UDF55 +
", USER01='" + USER01 + '\'' +
", USER02='" + USER02 + '\'' +
", DATE01=" + DATE01 +
", DATE02=" + DATE02 +
'}';
}
}

View File

@ -4,6 +4,8 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;
import com.ktg.mes.wm.domain.WmsInPlanDetailEntity;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
import java.util.HashMap;
@ -15,6 +17,8 @@ import java.util.List;
* @author yinjinlu
* @date 2024-10-31
*/
@Setter
@Getter
public class BaseKnife extends BaseEntity {
private static final long serialVersionUID = 1L;
@ -177,254 +181,6 @@ public class BaseKnife extends BaseEntity {
*/
private List<BaseKnife> baseKnifeList;
public Long getBaseKnifeId() {
return baseKnifeId;
}
public void setBaseKnifeId(Long baseKnifeId) {
this.baseKnifeId = baseKnifeId;
}
public Long getMbbBdMrlId() {
return mbbBdMrlId;
}
public void setMbbBdMrlId(Long mbbBdMrlId) {
this.mbbBdMrlId = mbbBdMrlId;
}
public String getRfid() {
return rfid;
}
public void setRfid(String rfid) {
this.rfid = rfid;
}
public String getKnifeCode() {
return knifeCode;
}
public List<BaseKnife> getBaseKnifeList() {
return baseKnifeList;
}
public void setBaseKnifeList(List<BaseKnife> baseKnifeList) {
this.baseKnifeList = baseKnifeList;
}
public Integer getIsLocked() {
return isLocked;
}
public void setIsLocked(Integer isLocked) {
this.isLocked = isLocked;
}
public Date getLockedStartTime() {
return lockedStartTime;
}
public void setLockedStartTime(Date lockedStartTime) {
this.lockedStartTime = lockedStartTime;
}
public Date getLockedEndTime() {
return lockedEndTime;
}
public void setLockedEndTime(Date lockedEndTime) {
this.lockedEndTime = lockedEndTime;
}
public String getPlanSheet() {
return planSheet;
}
public void setPlanSheet(String planSheet) {
this.planSheet = planSheet;
}
public Integer getResetCount() {
return resetCount;
}
public void setResetCount(Integer resetCount) {
this.resetCount = resetCount;
}
public void setKnifeCode(String knifeCode) {
this.knifeCode = knifeCode;
}
public String getKnifeName() {
return knifeName;
}
public void setKnifeName(String knifeName) {
this.knifeName = knifeName;
}
public String getKnifeUnit() {
return knifeUnit;
}
public void setKnifeUnit(String knifeUnit) {
this.knifeUnit = knifeUnit;
}
public String getKnifeType() {
return knifeType;
}
public void setKnifeType(String knifeType) {
this.knifeType = knifeType;
}
public Integer getSafeStock() {
return safeStock;
}
public String getItemOrProduct() {
return itemOrProduct;
}
public void setItemOrProduct(String itemOrProduct) {
this.itemOrProduct = itemOrProduct;
}
public void setSafeStock(Integer safeStock) {
this.safeStock = safeStock;
}
public String getStandardQuantity() {
return standardQuantity;
}
public void setStandardQuantity(String standardQuantity) {
this.standardQuantity = standardQuantity;
}
public String getAreaCode() {
return areaCode;
}
public void setAreaCode(String areaCode) {
this.areaCode = areaCode;
}
public Integer getKnifeLife() {
return knifeLife;
}
public void setKnifeLife(Integer knifeLife) {
this.knifeLife = knifeLife;
}
public Integer getKnifeFineState() {
return knifeFineState;
}
public void setKnifeFineState(Integer knifeFineState) {
this.knifeFineState = knifeFineState;
}
public Long getAttr1() {
return attr1;
}
public void setAttr1(Long attr1) {
this.attr1 = attr1;
}
public String getAttr2() {
return attr2;
}
public void setAttr2(String attr2) {
this.attr2 = attr2;
}
public String getAttr3() {
return attr3;
}
public void setAttr3(String attr3) {
this.attr3 = attr3;
}
public String getAttr4() {
return attr4;
}
public void setAttr4(String attr4) {
this.attr4 = attr4;
}
public List<MdItem> getMdItemList() {
return mdItemList;
}
public void setMdItemList(List<MdItem> mdItemList) {
this.mdItemList = mdItemList;
}
public Date getScrapTime() {
return scrapTime;
}
public void setScrapTime(Date scrapTime) {
this.scrapTime = scrapTime;
}
public List<HashMap<String, Object>> getOutInfoList() {
return outInfoList;
}
public void setOutInfoList(List<HashMap<String, Object>> outInfoList) {
this.outInfoList = outInfoList;
}
public List<WmsInPlanDetailEntity> getInInfoList() {
return inInfoList;
}
public void setInInfoList(List<WmsInPlanDetailEntity> inInfoList) {
this.inInfoList = inInfoList;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public Integer getIsValid() {
return isValid;
}
public void setIsValid(Integer isValid) {
this.isValid = isValid;
}
public Long getZdTaskId() {
return zdTaskId;
}
public void setZdTaskId(Long zdTaskId) {
this.zdTaskId = zdTaskId;
}
public String getAreaName() {
return areaName;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
@Override
public String toString() {
return "BaseKnife{" +

View File

@ -0,0 +1,134 @@
package com.ktg.mes.md.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;
import java.util.Date;
/**
* 台账锁定对象 BASE_KNIFE_LOCKED
*
* @author yinjinlu
* @date 2024-12-09
*/
public class BaseKnifeLocked extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 刀具台账 */
@Excel(name = "刀具台账")
private Long baseKnifeId;
/** 计划单 */
@Excel(name = "计划单")
private String planSheet;
/** 计划单 */
@Excel(name = "物料编码")
private String itemCode;
/** 锁定开始时间 */
@Excel(name = "锁定开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date lockedStartTime;
/** 锁定结束时间 */
@Excel(name = "锁定结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date lockedEndTime;
/** 消耗定额 */
@Excel(name = "消耗定额")
private Integer expendLife;
/** 状态 */
@Excel(name = "状态")
private Integer status;
/** 主键ID */
private Long baseKnifeLockedId;
public void setBaseKnifeId(Long baseKnifeId)
{
this.baseKnifeId = baseKnifeId;
}
public Long getBaseKnifeId()
{
return baseKnifeId;
}
public void setPlanSheet(String planSheet)
{
this.planSheet = planSheet;
}
public String getPlanSheet()
{
return planSheet;
}
public void setLockedStartTime(Date lockedStartTime)
{
this.lockedStartTime = lockedStartTime;
}
public Date getLockedStartTime()
{
return lockedStartTime;
}
public void setLockedEndTime(Date lockedEndTime)
{
this.lockedEndTime = lockedEndTime;
}
public Date getLockedEndTime()
{
return lockedEndTime;
}
public void setBaseKnifeLockedId(Long baseKnifeLockedId)
{
this.baseKnifeLockedId = baseKnifeLockedId;
}
public Long getBaseKnifeLockedId()
{
return baseKnifeLockedId;
}
public String getItemCode() {
return itemCode;
}
public void setItemCode(String itemCode) {
this.itemCode = itemCode;
}
public Integer getExpendLife() {
return expendLife;
}
public void setExpendLife(Integer expendLife) {
this.expendLife = expendLife;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("baseKnifeId", getBaseKnifeId())
.append("planSheet", getPlanSheet())
.append("lockedStartTime", getLockedStartTime())
.append("lockedEndTime", getLockedEndTime())
.append("baseKnifeLockedId", getBaseKnifeLockedId())
.toString();
}
}

View File

@ -14,7 +14,7 @@ import java.util.List;
* @author yinjinlu
* @date 2024-11-02
*/
public class InventoryBatch {
public class InventoryBatch extends BaseEntity {
private static final long serialVersionUID = 1L;
/**

View File

@ -1,9 +1,9 @@
package com.ktg.mes.md.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import lombok.Data;
import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;
import lombok.EqualsAndHashCode;
/**
* 客户对象 md_client
@ -11,6 +11,8 @@ import com.ktg.common.core.domain.BaseEntity;
* @author yinjinlu
* @date 2022-05-06
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class MdClient extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ -102,256 +104,4 @@ public class MdClient extends BaseEntity
/** 预留字段4 */
private Long attr4;
public void setClientId(Long clientId)
{
this.clientId = clientId;
}
public Long getClientId()
{
return clientId;
}
public void setClientCode(String clientCode)
{
this.clientCode = clientCode;
}
public String getClientCode()
{
return clientCode;
}
public void setClientName(String clientName)
{
this.clientName = clientName;
}
public String getClientName()
{
return clientName;
}
public void setClientNick(String clientNick)
{
this.clientNick = clientNick;
}
public String getClientNick()
{
return clientNick;
}
public void setClientEn(String clientEn)
{
this.clientEn = clientEn;
}
public String getClientEn()
{
return clientEn;
}
public void setClientDes(String clientDes)
{
this.clientDes = clientDes;
}
public String getClientDes()
{
return clientDes;
}
public void setClientLogo(String clientLogo)
{
this.clientLogo = clientLogo;
}
public String getClientLogo()
{
return clientLogo;
}
public void setClientType(String clientType)
{
this.clientType = clientType;
}
public String getClientType()
{
return clientType;
}
public void setAddress(String address)
{
this.address = address;
}
public String getAddress()
{
return address;
}
public void setWebsite(String website)
{
this.website = website;
}
public String getWebsite()
{
return website;
}
public void setEmail(String email)
{
this.email = email;
}
public String getEmail()
{
return email;
}
public void setTel(String tel)
{
this.tel = tel;
}
public String getTel()
{
return tel;
}
public void setContact1(String contact1)
{
this.contact1 = contact1;
}
public String getContact1()
{
return contact1;
}
public void setContact1Tel(String contact1Tel)
{
this.contact1Tel = contact1Tel;
}
public String getContact1Tel()
{
return contact1Tel;
}
public void setContact1Email(String contact1Email)
{
this.contact1Email = contact1Email;
}
public String getContact1Email()
{
return contact1Email;
}
public void setContact2(String contact2)
{
this.contact2 = contact2;
}
public String getContact2()
{
return contact2;
}
public void setContact2Tel(String contact2Tel)
{
this.contact2Tel = contact2Tel;
}
public String getContact2Tel()
{
return contact2Tel;
}
public void setContact2Email(String contact2Email)
{
this.contact2Email = contact2Email;
}
public String getContact2Email()
{
return contact2Email;
}
public void setCreditCode(String creditCode)
{
this.creditCode = creditCode;
}
public String getCreditCode()
{
return creditCode;
}
public void setEnableFlag(String enableFlag)
{
this.enableFlag = enableFlag;
}
public String getEnableFlag()
{
return enableFlag;
}
public void setAttr1(String attr1)
{
this.attr1 = attr1;
}
public String getAttr1()
{
return attr1;
}
public void setAttr2(String attr2)
{
this.attr2 = attr2;
}
public String getAttr2()
{
return attr2;
}
public void setAttr3(Long attr3)
{
this.attr3 = attr3;
}
public Long getAttr3()
{
return attr3;
}
public void setAttr4(Long attr4)
{
this.attr4 = attr4;
}
public Long getAttr4()
{
return attr4;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("clientId", getClientId())
.append("clientCode", getClientCode())
.append("clientName", getClientName())
.append("clientNick", getClientNick())
.append("clientEn", getClientEn())
.append("clientDes", getClientDes())
.append("clientLogo", getClientLogo())
.append("clientType", getClientType())
.append("address", getAddress())
.append("website", getWebsite())
.append("email", getEmail())
.append("tel", getTel())
.append("contact1", getContact1())
.append("contact1Tel", getContact1Tel())
.append("contact1Email", getContact1Email())
.append("contact2", getContact2())
.append("contact2Tel", getContact2Tel())
.append("contact2Email", getContact2Email())
.append("creditCode", getCreditCode())
.append("enableFlag", getEnableFlag())
.append("remark", getRemark())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -36,11 +36,15 @@ public class MdItem extends BaseEntity {
private String safeStockFlag;
private Integer minStock;
private Double maxStock;
private Double length;
private Double width;
private Double height;
private String highValue;
private Integer attr1;
private Integer attr2;
private String attr3;
private String attr4;
/* 预留字段3 - 为空或者0表示普通物料-1表示大物料 */
private Integer attr3;
private Integer attr4;
private Long count;
@ -203,19 +207,19 @@ public class MdItem extends BaseEntity {
this.attr2 = attr2;
}
public String getAttr3() {
public Integer getAttr3() {
return attr3;
}
public void setAttr3(String attr3) {
public void setAttr3(Integer attr3) {
this.attr3 = attr3;
}
public String getAttr4() {
public Integer getAttr4() {
return attr4;
}
public void setAttr4(String attr4) {
public void setAttr4(Integer attr4) {
this.attr4 = attr4;
}
@ -227,6 +231,30 @@ public class MdItem extends BaseEntity {
this.count = count;
}
public Double getLength() {
return length;
}
public void setLength(Double length) {
this.length = length;
}
public Double getWidth() {
return width;
}
public void setWidth(Double width) {
this.width = width;
}
public Double getHeight() {
return height;
}
public void setHeight(Double height) {
this.height = height;
}
@Override
public String toString() {
return "MdItem{" +
@ -248,9 +276,9 @@ public class MdItem extends BaseEntity {
", maxStock=" + maxStock +
", highValue='" + highValue + '\'' +
", attr1=" + attr1 +
", attr2='" + attr2 + '\'' +
", attr3='" + attr3 + '\'' +
", attr4='" + attr4 + '\'' +
", attr2=" + attr2 +
", attr3=" + attr3 +
", attr4=" + attr4 +
", count=" + count +
'}';
}

View File

@ -0,0 +1,63 @@
package com.ktg.mes.md.domain;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class MyConfig {
@Value("${globalConfig.toolSettingXml.localPath}")
private String toolSettingXmlPath;
@Value("${globalConfig.toolSettingXml.remoteUrl}")
private String remoteUrl;
@Value("${globalConfig.toolSettingXml.remoteUser}")
private String remoteUser;
@Value("${globalConfig.toolSettingXml.remotePass}")
private String remotePass;
@Value("${globalConfig.productionControl.path}")
private String productionControlPath;
public String getToolSettingXmlPath() {
return toolSettingXmlPath;
}
public void setToolSettingXmlPath(String toolSettingXmlPath) {
this.toolSettingXmlPath = toolSettingXmlPath;
}
public String getProductionControlPath() {
return productionControlPath;
}
public void setProductionControlPath(String productionControlPath) {
this.productionControlPath = productionControlPath;
}
public String getRemoteUrl() {
return remoteUrl;
}
public void setRemoteUrl(String remoteUrl) {
this.remoteUrl = remoteUrl;
}
public String getRemoteUser() {
return remoteUser;
}
public void setRemoteUser(String remoteUser) {
this.remoteUser = remoteUser;
}
public String getRemotePass() {
return remotePass;
}
public void setRemotePass(String remotePass) {
this.remotePass = remotePass;
}
}

View File

@ -0,0 +1,39 @@
package com.ktg.mes.md.domain;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class ParamXml {
private String rfid;
private String name;
private String param;
public String getRfid() {
return rfid;
}
@XmlElement
public void setRfid(String rfid) {
this.rfid = rfid;
}
public String getName() {
return name;
}
@XmlElement
public void setName(String name) {
this.name = name;
}
public String getParam() {
return param;
}
@XmlElement
public void setParam(String param) {
this.param = param;
}
}

View File

@ -0,0 +1,40 @@
package com.ktg.mes.md.domain;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class Tool {
private String name;
private String diameter;
private String length;
public String getName() {
return name;
}
@XmlElement
public void setName(String name) {
this.name = name;
}
public String getDiameter() {
return diameter;
}
@XmlElement
public void setDiameter(String diameter) {
this.diameter = diameter;
}
public String getLength() {
return length;
}
@XmlElement
public void setLength(String length) {
this.length = length;
}
}

View File

@ -0,0 +1,20 @@
package com.ktg.mes.md.domain;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class Tools {
private Tool tool;
public Tool getTool() {
return tool;
}
@XmlElement
public void setTool(Tool tool) {
this.tool = tool;
}
}

View File

@ -1,5 +1,7 @@
package com.ktg.mes.md.domain;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
@ -11,13 +13,15 @@ import com.ktg.common.core.domain.BaseEntity;
* @author yinjinlu
* @date 2024-10-31
*/
@Getter
@Setter
public class WmsBusinessType extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String typeId;
private Long typeId;
/**
* 修改日期
@ -120,190 +124,6 @@ public class WmsBusinessType extends BaseEntity {
@Excel(name = "是否记录入库时间:0否1是")
private String isRecordInboundTime;
public void setTypeId(String typeId) {
this.typeId = typeId;
}
public String getTypeId() {
return typeId;
}
public void setModifyDate(String modifyDate) {
this.modifyDate = modifyDate;
}
public String getModifyDate() {
return modifyDate;
}
public void setIsActive(String isActive) {
this.isActive = isActive;
}
public String getIsActive() {
return isActive;
}
public void setIsDelete(String isDelete) {
this.isDelete = isDelete;
}
public String getIsDelete() {
return isDelete;
}
public void setCode(String code) {
this.code = code;
}
public String getCode() {
return code;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setFlag(String flag) {
this.flag = flag;
}
public String getFlag() {
return flag;
}
public void setType(String type) {
this.type = type;
}
public String getType() {
return type;
}
public void setIsDefault(String isDefault) {
this.isDefault = isDefault;
}
public String getIsDefault() {
return isDefault;
}
public void setIsGlobal(String isGlobal) {
this.isGlobal = isGlobal;
}
public String getIsGlobal() {
return isGlobal;
}
public void setIsNeedUp(String isNeedUp) {
this.isNeedUp = isNeedUp;
}
public String getIsNeedUp() {
return isNeedUp;
}
public void setQualityType(String qualityType) {
this.qualityType = qualityType;
}
public String getQualityType() {
return qualityType;
}
public void setIsOutboundReview(String isOutboundReview) {
this.isOutboundReview = isOutboundReview;
}
public String getIsOutboundReview() {
return isOutboundReview;
}
public void setWaveStrategy(String waveStrategy) {
this.waveStrategy = waveStrategy;
}
public String getWaveStrategy() {
return waveStrategy;
}
public void setIsMultipleAllowed(String isMultipleAllowed) {
this.isMultipleAllowed = isMultipleAllowed;
}
public String getIsMultipleAllowed() {
return isMultipleAllowed;
}
public void setIsShortageAllowed(String isShortageAllowed) {
this.isShortageAllowed = isShortageAllowed;
}
public String getIsShortageAllowed() {
return isShortageAllowed;
}
public void setIsExcessAllowed(String isExcessAllowed) {
this.isExcessAllowed = isExcessAllowed;
}
public String getIsExcessAllowed() {
return isExcessAllowed;
}
public void setIsWholeOrderPost(String isWholeOrderPost) {
this.isWholeOrderPost = isWholeOrderPost;
}
public String getIsWholeOrderPost() {
return isWholeOrderPost;
}
public void setIsManuallyCreate(String isManuallyCreate) {
this.isManuallyCreate = isManuallyCreate;
}
public String getIsManuallyCreate() {
return isManuallyCreate;
}
public void setIsNoTask(String isNoTask) {
this.isNoTask = isNoTask;
}
public String getIsNoTask() {
return isNoTask;
}
public void setIsNegativeInv(String isNegativeInv) {
this.isNegativeInv = isNegativeInv;
}
public String getIsNegativeInv() {
return isNegativeInv;
}
public void setIsCheckSafetyStock(String isCheckSafetyStock) {
this.isCheckSafetyStock = isCheckSafetyStock;
}
public String getIsCheckSafetyStock() {
return isCheckSafetyStock;
}
public void setIsRecordInboundTime(String isRecordInboundTime) {
this.isRecordInboundTime = isRecordInboundTime;
}
public String getIsRecordInboundTime() {
return isRecordInboundTime;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -2,6 +2,8 @@ package com.ktg.mes.md.domain;
import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@ -11,6 +13,8 @@ import java.util.List;
* @author yinjinlu
* @date 2024-11-01
*/
@Setter
@Getter
public class WmsOutPlan extends BaseEntity {
private static final long serialVersionUID = 1L;
@ -76,102 +80,6 @@ public class WmsOutPlan extends BaseEntity {
*/
private List<WmsOutPlanDetail> wmsOutPlanDetailList;
public Long getWmsOutPlanId() {
return wmsOutPlanId;
}
public void setWmsOutPlanId(Long wmsOutPlanId) {
this.wmsOutPlanId = wmsOutPlanId;
}
public String getPlanCode() {
return planCode;
}
public void setPlanCode(String planCode) {
this.planCode = planCode;
}
public Long getWmsBusinessTypeId() {
return wmsBusinessTypeId;
}
public void setWmsBusinessTypeId(Long wmsBusinessTypeId) {
this.wmsBusinessTypeId = wmsBusinessTypeId;
}
public String getPlanState() {
return planState;
}
public void setPlanState(String planState) {
this.planState = planState;
}
public String getPlanType() {
return planType;
}
public void setPlanType(String planType) {
this.planType = planType;
}
public String getRecipientUsername() {
return recipientUsername;
}
public void setRecipientUsername(String recipientUsername) {
this.recipientUsername = recipientUsername;
}
public String getAttr1() {
return attr1;
}
public void setAttr1(String attr1) {
this.attr1 = attr1;
}
public String getAttr2() {
return attr2;
}
public void setAttr2(String attr2) {
this.attr2 = attr2;
}
public Integer getAttr3() {
return attr3;
}
public void setAttr3(Integer attr3) {
this.attr3 = attr3;
}
public Integer getAttr4() {
return attr4;
}
public void setAttr4(Integer attr4) {
this.attr4 = attr4;
}
public List<WmsOutPlanDetail> getWmsOutPlanDetailList() {
return wmsOutPlanDetailList;
}
public void setWmsOutPlanDetailList(List<WmsOutPlanDetail> wmsOutPlanDetailList) {
this.wmsOutPlanDetailList = wmsOutPlanDetailList;
}
public WmsBusinessType getWmsBusinessType() {
return wmsBusinessType;
}
public void setWmsBusinessType(WmsBusinessType wmsBusinessType) {
this.wmsBusinessType = wmsBusinessType;
}
@Override
public String toString() {
return "WmsOutPlan{" +

View File

@ -2,6 +2,8 @@ package com.ktg.mes.md.domain;
import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -11,6 +13,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
* @author yinjinlu
* @date 2024-11-01
*/
@Setter
@Getter
public class WmsOutPlanDetail extends BaseEntity {
private static final long serialVersionUID = 1L;
@ -111,142 +115,6 @@ public class WmsOutPlanDetail extends BaseEntity {
*/
private Integer attr4;
public Long getWmsOutPlanDetailId() {
return wmsOutPlanDetailId;
}
public void setWmsOutPlanDetailId(Long wmsOutPlanDetailId) {
this.wmsOutPlanDetailId = wmsOutPlanDetailId;
}
public Long getWmsOutPlanId() {
return wmsOutPlanId;
}
public void setWmsOutPlanId(Long wmsOutPlanId) {
this.wmsOutPlanId = wmsOutPlanId;
}
public Long getMdItemId() {
return mdItemId;
}
public void setMdItemId(Long mdItemId) {
this.mdItemId = mdItemId;
}
public String getMdItemCode() {
return mdItemCode;
}
public void setMdItemCode(String mdItemCode) {
this.mdItemCode = mdItemCode;
}
public String getMdItemName() {
return mdItemName;
}
public void setMdItemName(String mdItemName) {
this.mdItemName = mdItemName;
}
public String getMdItemUnit() {
return mdItemUnit;
}
public void setMdItemUnit(String mdItemUnit) {
this.mdItemUnit = mdItemUnit;
}
public Integer getPlannedQuantity() {
return plannedQuantity;
}
public void setPlannedQuantity(Integer plannedQuantity) {
this.plannedQuantity = plannedQuantity;
}
public Integer getRealQuantity() {
return realQuantity;
}
public void setRealQuantity(Integer realQuantity) {
this.realQuantity = realQuantity;
}
public String getDetailBatchNum() {
return detailBatchNum;
}
public void setDetailBatchNum(String detailBatchNum) {
this.detailBatchNum = detailBatchNum;
}
public Long getWmStorageAreaId() {
return wmStorageAreaId;
}
public void setWmStorageAreaId(Long wmStorageAreaId) {
this.wmStorageAreaId = wmStorageAreaId;
}
public String getWmStorageAreaCode() {
return wmStorageAreaCode;
}
public void setWmStorageAreaCode(String wmStorageAreaCode) {
this.wmStorageAreaCode = wmStorageAreaCode;
}
public String getWmStorageAreaName() {
return wmStorageAreaName;
}
public void setWmStorageAreaName(String wmStorageAreaName) {
this.wmStorageAreaName = wmStorageAreaName;
}
public String getDetailState() {
return detailState;
}
public void setDetailState(String detailState) {
this.detailState = detailState;
}
public String getAttr1() {
return attr1;
}
public void setAttr1(String attr1) {
this.attr1 = attr1;
}
public String getAttr2() {
return attr2;
}
public void setAttr2(String attr2) {
this.attr2 = attr2;
}
public Integer getAttr3() {
return attr3;
}
public void setAttr3(Integer attr3) {
this.attr3 = attr3;
}
public Integer getAttr4() {
return attr4;
}
public void setAttr4(Integer attr4) {
this.attr4 = attr4;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -137,6 +137,38 @@ public class WmsOutTask extends BaseEntity {
private List<HashMap<String, Object>> outInfoList;
private List<BaseKnife> baseKnifes;
public WmsOutTask() {
super();
}
public WmsOutTask(Long wmsOutTaskId, Long wmsOutPlanId, String wmsOutPlanCode, Long wmsOutPlanDetailId, Long wmsBusinessTypeId, String wmsBusinessTypeCode, String taskCode, Integer taskNumber, Integer outNumber, Long wmStorageAreaId, String batchNum, Long mdItemId, String mdItemCode, String mdItemName, String mdItemUnit, String taskState, String recipientUsername, String attr1, String attr2, Integer attr3, Integer attr4, List<HashMap<String, Object>> outInfoList, List<BaseKnife> baseKnifes) {
this.wmsOutTaskId = wmsOutTaskId;
this.wmsOutPlanId = wmsOutPlanId;
this.wmsOutPlanCode = wmsOutPlanCode;
this.wmsOutPlanDetailId = wmsOutPlanDetailId;
this.wmsBusinessTypeId = wmsBusinessTypeId;
this.wmsBusinessTypeCode = wmsBusinessTypeCode;
this.taskCode = taskCode;
this.taskNumber = taskNumber;
this.outNumber = outNumber;
this.wmStorageAreaId = wmStorageAreaId;
this.batchNum = batchNum;
this.mdItemId = mdItemId;
this.mdItemCode = mdItemCode;
this.mdItemName = mdItemName;
this.mdItemUnit = mdItemUnit;
this.taskState = taskState;
this.recipientUsername = recipientUsername;
this.attr1 = attr1;
this.attr2 = attr2;
this.attr3 = attr3;
this.attr4 = attr4;
this.outInfoList = outInfoList;
this.baseKnifes = baseKnifes;
}
public Long getWmsOutTaskId() {
return wmsOutTaskId;
}
@ -177,6 +209,14 @@ public class WmsOutTask extends BaseEntity {
this.wmsBusinessTypeId = wmsBusinessTypeId;
}
public String getWmsBusinessTypeCode() {
return wmsBusinessTypeCode;
}
public void setWmsBusinessTypeCode(String wmsBusinessTypeCode) {
this.wmsBusinessTypeCode = wmsBusinessTypeCode;
}
public String getTaskCode() {
return taskCode;
}
@ -209,14 +249,6 @@ public class WmsOutTask extends BaseEntity {
this.wmStorageAreaId = wmStorageAreaId;
}
public String getWmsBusinessTypeCode() {
return wmsBusinessTypeCode;
}
public void setWmsBusinessTypeCode(String wmsBusinessTypeCode) {
this.wmsBusinessTypeCode = wmsBusinessTypeCode;
}
public String getBatchNum() {
return batchNum;
}
@ -313,6 +345,14 @@ public class WmsOutTask extends BaseEntity {
this.outInfoList = outInfoList;
}
public List<BaseKnife> getBaseKnifes() {
return baseKnifes;
}
public void setBaseKnifes(List<BaseKnife> baseKnifes) {
this.baseKnifes = baseKnifes;
}
@Override
public String toString() {
return "WmsOutTask{" +
@ -321,6 +361,7 @@ public class WmsOutTask extends BaseEntity {
", wmsOutPlanCode='" + wmsOutPlanCode + '\'' +
", wmsOutPlanDetailId=" + wmsOutPlanDetailId +
", wmsBusinessTypeId=" + wmsBusinessTypeId +
", wmsBusinessTypeCode='" + wmsBusinessTypeCode + '\'' +
", taskCode='" + taskCode + '\'' +
", taskNumber=" + taskNumber +
", outNumber=" + outNumber +
@ -337,6 +378,7 @@ public class WmsOutTask extends BaseEntity {
", attr3=" + attr3 +
", attr4=" + attr4 +
", outInfoList=" + outInfoList +
", baseKnifes=" + baseKnifes +
'}';
}
}

View File

@ -0,0 +1,27 @@
package com.ktg.mes.md.domain.dto;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
// 根据订单出库
@Getter
@Setter
public class WmsOutboundOrderDto {
// 订单号
@NotBlank(message = "订单号不能为空")
private String orderId;
// 物料编码
@NotBlank(message = "物料编码不能为空")
private String materialCode;
// 出库类型编码
@NotBlank(message = "出库类型编码不能为空")
private String typeCode;
// 出库数量
@NotNull(message = "出库数量不能为空")
@Min(value = 1, message = "数量必须大于等于 1")
private int quantity;
}

View File

@ -0,0 +1,15 @@
package com.ktg.mes.md.mapper;
import com.ktg.common.annotation.DataSource;
import com.ktg.common.enums.DataSourceType;
import com.ktg.mes.md.domain.AP0AD;
import java.util.List;
public interface AP0ADMapper {
@DataSource(DataSourceType.SQLSERVER)
List<AP0AD> selectOutNewData();
@DataSource(DataSourceType.SQLSERVER)
int updateOutDataToOld(AP0AD ap0ad);
}

View File

@ -0,0 +1,26 @@
package com.ktg.mes.md.mapper;
import com.ktg.common.annotation.DataSource;
import com.ktg.common.enums.DataSourceType;
import com.ktg.mes.md.domain.AP0AE;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author Kelvin
*/
@Mapper
public interface AP0AEMapper {
@DataSource(DataSourceType.SQLSERVER)
List<AP0AE> selectOutNewData();
@DataSource(DataSourceType.SQLSERVER)
int updateOutDataToOld(AP0AE ap0ae);
@DataSource(DataSourceType.SQLSERVER)
List<AP0AE> selectInNewData();
@DataSource(DataSourceType.SQLSERVER)
int updateInDataToOld(AP0AE ap0ae);
}

View File

@ -0,0 +1,63 @@
package com.ktg.mes.md.mapper;
import java.util.List;
import com.ktg.mes.md.domain.BaseKnifeLocked;
import org.apache.ibatis.annotations.Mapper;
/**
* 台账锁定Mapper接口
*
* @author yinjinlu
* @date 2024-12-09
*/
@Mapper
public interface BaseKnifeLockedMapper
{
/**
* 查询台账锁定
*
* @param baseKnifeLockedId 台账锁定主键
* @return 台账锁定
*/
public BaseKnifeLocked selectBaseKnifeLockedByBaseKnifeLockedId(String baseKnifeLockedId);
/**
* 查询台账锁定列表
*
* @param baseKnifeLocked 台账锁定
* @return 台账锁定集合
*/
public List<BaseKnifeLocked> selectBaseKnifeLockedList(BaseKnifeLocked baseKnifeLocked);
/**
* 新增台账锁定
*
* @param baseKnifeLocked 台账锁定
* @return 结果
*/
public int insertBaseKnifeLocked(BaseKnifeLocked baseKnifeLocked);
/**
* 修改台账锁定
*
* @param baseKnifeLocked 台账锁定
* @return 结果
*/
public int updateBaseKnifeLocked(BaseKnifeLocked baseKnifeLocked);
/**
* 删除台账锁定
*
* @param baseKnifeLockedId 台账锁定主键
* @return 结果
*/
public int deleteBaseKnifeLockedByBaseKnifeLockedId(String baseKnifeLockedId);
/**
* 批量删除台账锁定
*
* @param baseKnifeLockedIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteBaseKnifeLockedByBaseKnifeLockedIds(String[] baseKnifeLockedIds);
}

View File

@ -2,6 +2,7 @@ package com.ktg.mes.md.mapper;
import com.ktg.mes.md.domain.BaseKnife;
import com.ktg.mes.md.domain.MdItem;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -12,6 +13,7 @@ import java.util.List;
* @author yinjinlu
* @date 2024-10-31
*/
@Mapper
public interface BaseKnifeMapper {
/**
* 查询工具台账
@ -88,6 +90,11 @@ public interface BaseKnifeMapper {
@Param("isLocked") Integer isLocked
);
List<BaseKnife> selectBaseKnifeListByMbbBdMrlIdAndKnifeFineStateAndIsLocked(
@Param("mbbBdMrlId") Long mbbBdMrlId,
@Param("isLocked") Integer isLocked
);
int updateBaseKnifeIsLockedByBaseKnifeId(
@Param("baseKnifeId") Long baseKnifeId,
@Param("isLocked") Integer isLocked
@ -114,4 +121,8 @@ public interface BaseKnifeMapper {
public Boolean isDuplicateRfid(String rfid);
List<BaseKnife> selectBaseKnifeNotValidList(BaseKnife baseKnifeWrapper);
List<String> selectNotEmptyAreaCodeList();
List<BaseKnife> selectBaseKnifeListByMbbBdMrlId(Long itemId);
}

View File

@ -2,6 +2,7 @@ package com.ktg.mes.md.mapper;
import java.util.List;
import com.ktg.mes.md.domain.BaseTechnologyBom;
import org.apache.ibatis.annotations.Mapper;
/**
* 工艺bomMapper接口
@ -9,6 +10,7 @@ import com.ktg.mes.md.domain.BaseTechnologyBom;
* @author yinjinlu
* @date 2024-11-01
*/
@Mapper
public interface BaseTechnologyBomMapper
{
/**

View File

@ -3,6 +3,7 @@ package com.ktg.mes.md.mapper;
import java.util.List;
import com.ktg.mes.md.domain.BomRoute;
import com.ktg.mes.md.domain.MbbProduBom;
import org.apache.ibatis.annotations.Mapper;
/**
* BOM头Mapper接口
@ -10,6 +11,7 @@ import com.ktg.mes.md.domain.MbbProduBom;
* @author yinjinlu
* @date 2024-10-31
*/
@Mapper
public interface BomRouteMapper
{
/**

View File

@ -1,10 +1,12 @@
package com.ktg.mes.md.mapper;
import com.ktg.common.core.domain.entity.ItemType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface ItemTypeMapper {
/**

View File

@ -1,9 +1,11 @@
package com.ktg.mes.md.mapper;
import com.ktg.mes.md.domain.MdItem;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface MdItemMapper {
/**
* 根据条件查询物料编码

View File

@ -1,6 +1,7 @@
package com.ktg.mes.md.mapper;
import com.ktg.mes.md.domain.WmsBusinessType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -11,8 +12,8 @@ import java.util.List;
* @author yinjinlu
* @date 2024-10-31
*/
public interface WmsBusinessTypeMapper
{
@Mapper
public interface WmsBusinessTypeMapper {
/**
* 查询出入库类型
*

View File

@ -3,6 +3,7 @@ package com.ktg.mes.md.mapper;
import java.util.List;
import com.ktg.mes.md.domain.WmsOutPlanDetailEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 出库计划明细实体Mapper接口
@ -10,6 +11,7 @@ import com.ktg.mes.md.domain.WmsOutPlanDetailEntity;
* @author yinjinlu
* @date 2024-11-11
*/
@Mapper
public interface WmsOutPlanDetailEntityMapper {
/**
* 查询出库计划明细实体

View File

@ -2,6 +2,7 @@ package com.ktg.mes.md.mapper;
import com.ktg.mes.md.domain.WmsOutPlan;
import com.ktg.mes.md.domain.WmsOutPlanDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -12,6 +13,7 @@ import java.util.List;
* @author yinjinlu
* @date 2024-11-01
*/
@Mapper
public interface WmsOutPlanMapper {
/**
* 查询出库计划管理

View File

@ -1,6 +1,7 @@
package com.ktg.mes.md.mapper;
import com.ktg.mes.md.domain.WmsOutTask;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@ -10,6 +11,7 @@ import java.util.List;
* @author yinjinlu
* @date 2024-11-02
*/
@Mapper
public interface WmsOutTaskMapper {
/**
* 查询出库任务

View File

@ -0,0 +1,23 @@
package com.ktg.mes.md.service;
import com.ktg.mes.md.domain.AP0AE;
import java.util.List;
/**
* @author luo26
*/
public interface IAP0AEService {
/**
* 获取借用记录
* @return 借用记录列表
*/
public List<AP0AE> selectBorrowedNewData();
/**
* 获取归还记录
* @return 归还记录列表
*/
public List<AP0AE> selectReturnedNewData();
}

View File

@ -0,0 +1,61 @@
package com.ktg.mes.md.service;
import java.util.List;
import com.ktg.mes.md.domain.BaseKnifeLocked;
/**
* 台账锁定Service接口
*
* @author yinjinlu
* @date 2024-12-09
*/
public interface IBaseKnifeLockedService
{
/**
* 查询台账锁定
*
* @param baseKnifeLockedId 台账锁定主键
* @return 台账锁定
*/
public BaseKnifeLocked selectBaseKnifeLockedByBaseKnifeLockedId(String baseKnifeLockedId);
/**
* 查询台账锁定列表
*
* @param baseKnifeLocked 台账锁定
* @return 台账锁定集合
*/
public List<BaseKnifeLocked> selectBaseKnifeLockedList(BaseKnifeLocked baseKnifeLocked);
/**
* 新增台账锁定
*
* @param baseKnifeLocked 台账锁定
* @return 结果
*/
public int insertBaseKnifeLocked(BaseKnifeLocked baseKnifeLocked);
/**
* 修改台账锁定
*
* @param baseKnifeLocked 台账锁定
* @return 结果
*/
public int updateBaseKnifeLocked(BaseKnifeLocked baseKnifeLocked);
/**
* 批量删除台账锁定
*
* @param baseKnifeLockedIds 需要删除的台账锁定主键集合
* @return 结果
*/
public int deleteBaseKnifeLockedByBaseKnifeLockedIds(String[] baseKnifeLockedIds);
/**
* 删除台账锁定信息
*
* @param baseKnifeLockedId 台账锁定主键
* @return 结果
*/
public int deleteBaseKnifeLockedByBaseKnifeLockedId(String baseKnifeLockedId);
}

View File

@ -15,10 +15,18 @@ public interface IBaseKnifeService
* 查询工具台账
*
* @param baseKnifeId 工具台账主键
* @return 工具台账
* @return 工具台账 包含基础物料信息BOM清单
*/
public BaseKnife selectBaseKnifeByBaseKnifeId(Long baseKnifeId);
/**
* 查询工具台账
*
* @param rfid 工具台账主键
* @return 工具台账 包含物料基础信息
*/
public BaseKnife selectBaseKnifeByRfid(String rfid);
/**
* 查询工具台账列表
*

View File

@ -0,0 +1,41 @@
package com.ktg.mes.md.service;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.swing.*;
@WebService(name = IMasterDataSyncService.SERVICE_NAME, targetNamespace = IMasterDataSyncService.TARGET_NAMESPACE)
public interface IMasterDataSyncService {
String SERVICE_NAME = "MasterDataSyncService";
String TARGET_NAMESPACE = "http://server.spring.zhang.pers/";
/**
* 同步物料数据
*
* @param materialListStr 物料列表
*/
@WebMethod(operationName = "syncMaterial")
@WebResult
String syncMaterial(@WebParam(name = "materialListStr") String materialListStr);
/**
* 同步物料分类数据
*
* @param materialCategoryListStr 物料分类列表
*/
@WebMethod(operationName = "syncMaterialCategory")
@WebResult
String syncMaterialCategory(@WebParam(name = "materialCategoryList") String materialCategoryListStr);
/**
* 同步计量单位数据
*
* @param unitListStr 计量单位列表
*/
@WebMethod(operationName = "syncUnit")
@WebResult
String syncUnit(@WebParam(name = "unitList") String unitListStr);
}

View File

@ -20,6 +20,12 @@ public interface IMdItemService {
*/
public List<MdItem> selectMdItemAll();
/**
* 同步小型刀具库数据
* @return
*/
public int asyncSmallKnifeData();
/**
* 获取导出格式的物料产品清单
* 主要区别是物料分类会以父级分类/子集分类的方式组合

View File

@ -19,6 +19,14 @@ public interface IWmsBusinessTypeService
*/
public WmsBusinessType selectWmsBusinessTypeByTypeId(String typeId);
/**
* 查询出入库类型
*
* @param code 出入库类型编码
* @return 出入库类型
*/
public WmsBusinessType selectWmsBusinessTypeByCode(String code);
/**
* 查询出入库类型列表
*

View File

@ -1,5 +1,6 @@
package com.ktg.mes.md.service;
import com.ktg.mes.md.domain.AP0AE;
import com.ktg.mes.md.domain.WmsOutPlan;
import com.ktg.mes.md.domain.WmsOutPlanDetailEntity;
@ -29,6 +30,14 @@ public interface IWmsOutPlanService {
*/
List<WmsOutPlan> selectWmsOutPlanList(WmsOutPlan wmsOutPlan);
/**
* 新增出库计划管理并执行
*
* @param wmsOutPlan 出库计划管理
* @return 结果
*/
int insertWmsOutPlanAndRun(WmsOutPlan wmsOutPlan);
/**
* 新增出库计划管理
*
@ -65,6 +74,8 @@ public interface IWmsOutPlanService {
List<HashMap<String, Object>> selectWmsOutPlanDetailEntityList(WmsOutPlanDetailEntity wmsOutPlanDetailEntity);
int synchronizationMiniBox(String username);
int autoScrapOut(String username);
public String checkPlanCodeUnique(WmsOutPlan wmsOutPlan);

View File

@ -2,6 +2,7 @@ package com.ktg.mes.md.service;
import com.ktg.mes.md.domain.WmsOutTask;
import javax.xml.bind.JAXBException;
import java.util.List;
/**
@ -59,7 +60,7 @@ public interface IWmsOutTaskService {
*/
int deleteWmsOutTaskByWmsOutTaskId(Long wmsOutTaskId);
boolean runWmsOutTask(Long[] wmsOutTaskIds);
boolean runWmsOutTask(Long[] wmsOutTaskIds) throws JAXBException;
boolean autoRunWmsOutTask(Long[] wmsOutTaskIds);

View File

@ -0,0 +1,38 @@
package com.ktg.mes.md.service.impl;
import com.ktg.mes.md.domain.AP0AE;
import com.ktg.mes.md.mapper.AP0AEMapper;
import com.ktg.mes.md.service.IAP0AEService;
import com.ktg.mes.md.service.IMdItemService;
import com.ktg.mes.wm.service.IWmStorageAreaService;
import com.ktg.mes.wm.service.IWmsInPlanService;
import com.ktg.mes.wm.service.IWmsInTaskService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 小型刀具库-借领退还表
*
* @author Kelvin
*/
@Service
@RequiredArgsConstructor
public class AP0AEServiceImpl implements IAP0AEService {
private final AP0AEMapper aP0AEMapper;
private final IWmsInPlanService wmsInPlanService;
private final IWmsInTaskService wmsInTaskService;
private final IWmStorageAreaService wmStorageAreaService;
private final IMdItemService mdItemService;
@Override
public List<AP0AE> selectBorrowedNewData() {
return this.aP0AEMapper.selectOutNewData();
}
@Override
public List<AP0AE> selectReturnedNewData() {
return this.aP0AEMapper.selectInNewData();
}
}

View File

@ -0,0 +1,93 @@
package com.ktg.mes.md.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktg.mes.md.mapper.BaseKnifeLockedMapper;
import com.ktg.mes.md.domain.BaseKnifeLocked;
import com.ktg.mes.md.service.IBaseKnifeLockedService;
/**
* 台账锁定Service业务层处理
*
* @author yinjinlu
* @date 2024-12-09
*/
@Service
public class BaseKnifeLockedServiceImpl implements IBaseKnifeLockedService
{
@Autowired
private BaseKnifeLockedMapper baseKnifeLockedMapper;
/**
* 查询台账锁定
*
* @param baseKnifeLockedId 台账锁定主键
* @return 台账锁定
*/
@Override
public BaseKnifeLocked selectBaseKnifeLockedByBaseKnifeLockedId(String baseKnifeLockedId)
{
return baseKnifeLockedMapper.selectBaseKnifeLockedByBaseKnifeLockedId(baseKnifeLockedId);
}
/**
* 查询台账锁定列表
*
* @param baseKnifeLocked 台账锁定
* @return 台账锁定
*/
@Override
public List<BaseKnifeLocked> selectBaseKnifeLockedList(BaseKnifeLocked baseKnifeLocked)
{
return baseKnifeLockedMapper.selectBaseKnifeLockedList(baseKnifeLocked);
}
/**
* 新增台账锁定
*
* @param baseKnifeLocked 台账锁定
* @return 结果
*/
@Override
public int insertBaseKnifeLocked(BaseKnifeLocked baseKnifeLocked)
{
return baseKnifeLockedMapper.insertBaseKnifeLocked(baseKnifeLocked);
}
/**
* 修改台账锁定
*
* @param baseKnifeLocked 台账锁定
* @return 结果
*/
@Override
public int updateBaseKnifeLocked(BaseKnifeLocked baseKnifeLocked)
{
return baseKnifeLockedMapper.updateBaseKnifeLocked(baseKnifeLocked);
}
/**
* 批量删除台账锁定
*
* @param baseKnifeLockedIds 需要删除的台账锁定主键
* @return 结果
*/
@Override
public int deleteBaseKnifeLockedByBaseKnifeLockedIds(String[] baseKnifeLockedIds)
{
return baseKnifeLockedMapper.deleteBaseKnifeLockedByBaseKnifeLockedIds(baseKnifeLockedIds);
}
/**
* 删除台账锁定信息
*
* @param baseKnifeLockedId 台账锁定主键
* @return 结果
*/
@Override
public int deleteBaseKnifeLockedByBaseKnifeLockedId(String baseKnifeLockedId)
{
return baseKnifeLockedMapper.deleteBaseKnifeLockedByBaseKnifeLockedId(baseKnifeLockedId);
}
}

View File

@ -1,22 +1,34 @@
package com.ktg.mes.md.service.impl;
import com.alibaba.fastjson.JSON;
import com.ktg.common.utils.DateUtils;
import com.ktg.mes.cal.utils.CalendarUtil;
import com.ktg.mes.md.domain.*;
import com.ktg.mes.md.mapper.*;
import com.ktg.mes.md.service.IBaseKnifeService;
import com.ktg.mes.wm.domain.WmsInPlanDetailEntity;
import com.ktg.mes.wm.mapper.WmsInPlanDetailEntityMapper;
import com.ktg.mes.wm.service.impl.WmsInPlanDetailEntityServiceImpl;
import jcifs.smb.NtlmPasswordAuthentication;
import jcifs.smb.SmbFile;
import jcifs.smb.SmbFileInputStream;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import static org.apache.commons.lang3.SystemUtils.getUserName;
import java.util.*;
/**
* 工具台账Service业务层处理
@ -25,34 +37,14 @@ import static org.apache.commons.lang3.SystemUtils.getUserName;
* @date 2024-10-31
*/
@Service
@RequiredArgsConstructor
public class BaseKnifeServiceImpl implements IBaseKnifeService {
@Autowired
private BaseKnifeMapper baseKnifeMapper;
private final BaseKnifeMapper baseKnifeMapper;
private final WmsOutPlanMapper wmsOutPlanMapper;
private final WmsOutPlanDetailEntityMapper wmsOutPlanDetailEntityMapper;
private final WmsBusinessTypeMapper wmsBusinessTypeMapper;
private final WmsInPlanDetailEntityServiceImpl wmsInPlanDetailEntityService;
@Autowired
private WmsOutPlanMapper wmsOutPlanMapper;
@Autowired
private WmsOutPlanDetailEntityMapper wmsOutPlanDetailEntityMapper;
@Autowired
private WmsOutTaskMapper wmsOutTaskMapper;
@Autowired
private WmsBusinessTypeMapper wmsBusinessTypeMapper;
@Autowired
private WmsInPlanDetailEntityMapper wmsInPlanDetailEntityMapper;
@Autowired
private WmsInPlanDetailEntityServiceImpl wmsInPlanDetailEntityService;
/**
* 查询工具台账
*
* @param baseKnifeId 工具台账主键
* @return 工具台账
*/
@Override
public BaseKnife selectBaseKnifeByBaseKnifeId(Long baseKnifeId) {
BaseKnife baseKnife = baseKnifeMapper.selectBaseKnifeByBaseKnifeId(baseKnifeId);
@ -65,6 +57,17 @@ public class BaseKnifeServiceImpl implements IBaseKnifeService {
return baseKnife;
}
/**
* 查询工具台账
*
* @param rfid 工具台账主键
* @return 工具台账
*/
@Override
public BaseKnife selectBaseKnifeByRfid(String rfid) {
return baseKnifeMapper.selectBaseKnifeByRfid(rfid);
}
/**
* 查询工具台账列表
*
@ -112,6 +115,7 @@ public class BaseKnifeServiceImpl implements IBaseKnifeService {
hashMap.put("detailStatus", wmsOutPlanDetail.getDetailState()); // 明细状态
hashMap.put("isToolSetting", nowWmsOutPlanDetailEntity.getIsToolSetting()); // 是否对刀
hashMap.put("toolSettingParam", nowWmsOutPlanDetailEntity.getToolSettingParam()); // 对刀参数
/* 实体 */
String outTime = null;
if (nowWmsOutPlanDetailEntity.getCreateTime() != null)
@ -150,7 +154,6 @@ public class BaseKnifeServiceImpl implements IBaseKnifeService {
@Override
public int insertBaseKnife(BaseKnife baseKnife) {
baseKnife.setCreateTime(DateUtils.getNowDate());
baseKnife.setCreateBy(getUserName());
int rows = baseKnifeMapper.insertBaseKnife(baseKnife);
return rows;
}
@ -165,7 +168,6 @@ public class BaseKnifeServiceImpl implements IBaseKnifeService {
@Override
public int updateBaseKnife(BaseKnife baseKnife) {
baseKnife.setUpdateTime(DateUtils.getNowDate());
baseKnife.setUpdateBy(getUserName());
return baseKnifeMapper.updateBaseKnife(baseKnife);
}

View File

@ -189,7 +189,7 @@ public class InventoryBatchServiceImpl implements IInventoryBatchService {
// 获取当期入库明细数据
List<HashMap<String, Object>> hashMapList = new ArrayList<>();
WmsInPlanDetailEntity entityQuery = new WmsInPlanDetailEntity();
entityQuery.setPlanId(Long.parseLong(inTask.getPlanInId()));
entityQuery.setPlanId(inTask.getPlanInId());
// entityQuery.setKnifeId(Long.parseLong(inTask.getPlanInId()));
List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = wmsInPlanDetailEntityMapper.selectWmsInPlanDetailEntityList(entityQuery);
wmsInPlanDetailEntityList.forEach(inPlanDetailEntity -> {

View File

@ -0,0 +1,190 @@
package com.ktg.mes.md.service.impl;
import com.ktg.common.core.domain.entity.ItemType;
import com.ktg.mes.md.domain.MdItem;
import com.ktg.mes.md.domain.MdUnitMeasure;
import com.ktg.mes.md.service.IMasterDataSyncService;
import com.ktg.mes.md.service.IMdItemService;
import com.ktg.mes.md.service.IMdUnitMeasureService;
import lombok.RequiredArgsConstructor;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.map.ObjectMapper;
import org.springframework.stereotype.Service;
import javax.jws.WebService;
import javax.swing.*;
import java.util.List;
@RequiredArgsConstructor
@Service
@WebService(name = IMasterDataSyncService.SERVICE_NAME, targetNamespace = IMasterDataSyncService.TARGET_NAMESPACE, endpointInterface = "com.ktg.mes.md.service.IMasterDataSyncService")
public class MasterDataSyncServiceImpl implements IMasterDataSyncService {
private final ItemTypeServiceImpl itemTypeService;
private final IMdItemService mdItemService;
private final IMdUnitMeasureService mdUnitMeasureService;
// 无参构造函数 CXF 使用
public MasterDataSyncServiceImpl() {
this.itemTypeService = null;
this.mdItemService = null;
this.mdUnitMeasureService = null;
}
/**
* 同步物料数据
*
* @param materialListStr 物料列表
*/
@Override
public String syncMaterial(String materialListStr) {
// 使用 ObjectMapper 来处理 JSON
ObjectMapper objectMapper = new ObjectMapper();
try {
// 解析传入的 JSON 字符串
String jsonList = objectMapper.readTree(materialListStr).get("LIST").asText();
JsonNode jsonNode = objectMapper.readTree(jsonList);
for (JsonNode node : jsonNode) {
JsonNode jsonNode1 = null;
// 通用工具工装
if (!node.get("T_TYGJGZ").asText().isEmpty()) {
jsonNode1 = objectMapper.readTree(node.get("T_TYGJGZ").asText());
// 专用工具工装
} else if (!node.get("T_ZYGJGZ").asText().isEmpty()) {
jsonNode1 = objectMapper.readTree(node.get("T_ZYGJGZ").asText());
}
if (jsonNode1 != null) {
MdItem mdItem = new MdItem();
mdItem.setItemName(jsonNode1.get("MC").asText());
mdItem.setItemCode(jsonNode1.get("WLBM").asText());
// 查询并设置计量单位数据
MdUnitMeasure unit = mdUnitMeasureService.selectMdUnitByCode(jsonNode1.get("UNIT").asText());
mdItem.setUnitName(unit.getMeasureName());
mdItem.setUnitOfMeasure(unit.getMeasureName());
// 四级分类数据
String categoryName = jsonNode1.get("SIJFL").asText();
if (categoryName.isEmpty()) {
// 为空则使用三级分类数据
categoryName = jsonNode1.get("SJFL").asText();
}
ItemType itemType = itemTypeService.selectItemTypeByName(categoryName);
mdItem.setItemOrProduct(itemType.getItemOrProduct());
mdItem.setItemTypeId(itemType.getItemTypeId());
mdItem.setItemTypeName(itemType.getItemTypeName());
mdItemService.insertMdItem(mdItem);
}
}
} catch (Exception e) {
e.printStackTrace();
return "同步失败,原因:" + e.getMessage();
}
return "1"; // 返回成功标识
}
/**
* 同步物料分类数据
*
* @param materialCategoryListStr 物料分类列表
*/
@Override
public String syncMaterialCategory(String materialCategoryListStr) {
// 使用 ObjectMapper 来处理 JSON
ObjectMapper objectMapper = new ObjectMapper();
try {
// 解析传入的 JSON 字符串
String jsonList = objectMapper.readTree(materialCategoryListStr).get("LIST").asText();
JsonNode jsonNode = objectMapper.readTree(jsonList);
for (JsonNode node : jsonNode) {
ItemType itemType = new ItemType();
itemType.setItemTypeName(node.get("NAME").asText());
itemType.setItemTypeCode(node.get("CODE").asText());
// 判断是否有父级分类
String parentCode = node.get("PCODE").asText();
if (!parentCode.isEmpty()) {
ItemType itemTypeQuery = new ItemType();
itemTypeQuery.setItemTypeCode(parentCode);
// 查询父级数据
List<ItemType> parentItemTypeList = itemTypeService.selectItemTypeList(itemTypeQuery);
if (!parentItemTypeList.isEmpty()) {
ItemType parentItemType = parentItemTypeList.get(0);
itemType.setParentTypeId(parentItemType.getItemTypeId());
// 提取父级分类ID
Long parentId = parentItemType.getParentTypeId();
// 循环直至查出最顶层分类
while (parentId != null && parentId != 0) {
parentItemType = itemTypeService.selectItemTypeById(parentId);
if (parentItemType != null) {
// 更新父级 ID
parentId = parentItemType.getParentTypeId();
// 判断分类名称设置对应的物料类型
if ("专用刀具".equals(parentItemType.getItemTypeName()) || "刀具".equals(parentItemType.getItemTypeName())) {
itemType.setItemOrProduct("BLAND");
break;
} else if (parentId == 0) {
itemType.setItemOrProduct("ITEM");
break;
}
} else {
break;
}
}
}
}
// 插入数据
itemTypeService.insertItemType(itemType);
}
} catch (Exception e) {
e.printStackTrace();
return "同步失败,原因:" + e.getMessage();
}
return "1"; // 返回成功标识
}
/**
* 同步计量单位数据
*
* @param unitListStr 计量单位列表
*/
@Override
public String syncUnit(String unitListStr) {
// 使用 ObjectMapper 来处理 JSON
ObjectMapper objectMapper = new ObjectMapper();
try {
// 解析传入的 JSON 字符串
String jsonList = objectMapper.readTree(unitListStr).get("LIST").asText();
JsonNode jsonNode = objectMapper.readTree(jsonList);
for (JsonNode node : jsonNode) {
JsonNode jsonNode1 = objectMapper.readTree(node.get("DIC_D_UNIT").asText());
if (jsonNode1 != null) {
MdUnitMeasure mdUnitMeasure = new MdUnitMeasure();
mdUnitMeasure.setMeasureCode(jsonNode1.get("CODE").asText());
mdUnitMeasure.setMeasureName(jsonNode1.get("NAME").asText());
mdUnitMeasureService.insertMdUnitMeasure(mdUnitMeasure);
}
}
} catch (Exception e) {
e.printStackTrace();
return "同步失败,原因:" + e.getMessage();
}
return "1"; // 返回成功标识
}
}

View File

@ -10,8 +10,11 @@ import com.ktg.mes.md.mapper.BaseKnifeMapper;
import com.ktg.mes.md.mapper.ItemTypeMapper;
import com.ktg.mes.md.mapper.MdItemMapper;
import com.ktg.mes.md.service.IMdItemService;
import com.ktg.mes.stl.domain.StlMaterial;
import com.ktg.mes.stl.mapper.StlMaterialMapper;
import com.ktg.mes.wm.utils.WmBarCodeUtil;
import com.ktg.system.strategy.AutoCodeUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@ -20,24 +23,15 @@ import javax.validation.Validator;
import java.util.List;
@Service
@RequiredArgsConstructor
public class MdItemServiceImpl implements IMdItemService {
@Autowired
private BaseKnifeMapper baseKnifeMapper;
@Autowired
private MdItemMapper mdItemMapper;
@Autowired
private ItemTypeMapper itemTypeMapper;
@Autowired
protected Validator validator;
@Autowired
private WmBarCodeUtil barCodeUtil;
@Autowired
private AutoCodeUtil autoCodeUtil;
private final BaseKnifeMapper baseKnifeMapper;
private final MdItemMapper mdItemMapper;
private final ItemTypeMapper itemTypeMapper;
protected final Validator validator;
private final WmBarCodeUtil barCodeUtil;
private final AutoCodeUtil autoCodeUtil;
private final StlMaterialMapper stlMaterialMapper;
@Override
public List<MdItem> selectMdItemList(MdItem mdItem) {
@ -53,6 +47,36 @@ public class MdItemServiceImpl implements IMdItemService {
return mdItemMapper.selectMdItemAll();
}
@Override
public int asyncSmallKnifeData() {
List<StlMaterial> stlMaterials = stlMaterialMapper.selectList();
int count = 0;
for (StlMaterial stlMaterial : stlMaterials) {
MdItem mdItem = new MdItem();
mdItem.setItemCode(stlMaterial.getProductNumber());
mdItem.setItemName(stlMaterial.getProductName());
mdItem.setUnitName(stlMaterial.getSpecification());
mdItem.setUnitOfMeasure(stlMaterial.getSpecification());
// 产品物料标识 设置为 刀片
mdItem.setItemOrProduct("BLADE");
// 物料类型
mdItem.setItemTypeId(298L);
mdItem.setItemTypeCode("XXDJK");
mdItem.setItemTypeName("小型刀具库");
// 是否设置安全库存
mdItem.setSafeStockFlag("N");
// 查重
List<MdItem> mdItems = this.selectMdItemList(mdItem);
if (!mdItems.isEmpty()) {
continue;
}
this.insertMdItem(mdItem);
count++;
}
return count;
}
@Override
public List<MdItem> getExeportList(MdItem mdItem) {
return mdItemMapper.getExeportList(mdItem);

View File

@ -1,7 +1,9 @@
package com.ktg.mes.md.service.impl;
import java.util.List;
import com.ktg.common.utils.DateUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktg.mes.md.mapper.WmsBusinessTypeMapper;
@ -15,10 +17,9 @@ import com.ktg.mes.md.service.IWmsBusinessTypeService;
* @date 2024-10-31
*/
@Service
public class WmsBusinessTypeServiceImpl implements IWmsBusinessTypeService
{
@Autowired
private WmsBusinessTypeMapper wmsBusinessTypeMapper;
@RequiredArgsConstructor
public class WmsBusinessTypeServiceImpl implements IWmsBusinessTypeService {
private final WmsBusinessTypeMapper wmsBusinessTypeMapper;
/**
* 查询出入库类型
@ -27,11 +28,21 @@ public class WmsBusinessTypeServiceImpl implements IWmsBusinessTypeService
* @return 出入库类型
*/
@Override
public WmsBusinessType selectWmsBusinessTypeByTypeId(String typeId)
{
public WmsBusinessType selectWmsBusinessTypeByTypeId(String typeId) {
return wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(typeId);
}
/**
* 查询出入库类型
*
* @param code 出入库类型编码
* @return 出入库类型
*/
@Override
public WmsBusinessType selectWmsBusinessTypeByCode(String code) {
return wmsBusinessTypeMapper.selectWmsBusinessTypeByCode(code);
}
/**
* 查询出入库类型列表
*
@ -39,8 +50,7 @@ public class WmsBusinessTypeServiceImpl implements IWmsBusinessTypeService
* @return 出入库类型
*/
@Override
public List<WmsBusinessType> selectWmsBusinessTypeList(WmsBusinessType wmsBusinessType)
{
public List<WmsBusinessType> selectWmsBusinessTypeList(WmsBusinessType wmsBusinessType) {
return wmsBusinessTypeMapper.selectWmsBusinessTypeList(wmsBusinessType);
}
@ -51,8 +61,7 @@ public class WmsBusinessTypeServiceImpl implements IWmsBusinessTypeService
* @return 结果
*/
@Override
public int insertWmsBusinessType(WmsBusinessType wmsBusinessType)
{
public int insertWmsBusinessType(WmsBusinessType wmsBusinessType) {
wmsBusinessType.setCreateTime(DateUtils.getNowDate());
return wmsBusinessTypeMapper.insertWmsBusinessType(wmsBusinessType);
}
@ -64,8 +73,7 @@ public class WmsBusinessTypeServiceImpl implements IWmsBusinessTypeService
* @return 结果
*/
@Override
public int updateWmsBusinessType(WmsBusinessType wmsBusinessType)
{
public int updateWmsBusinessType(WmsBusinessType wmsBusinessType) {
return wmsBusinessTypeMapper.updateWmsBusinessType(wmsBusinessType);
}
@ -76,8 +84,7 @@ public class WmsBusinessTypeServiceImpl implements IWmsBusinessTypeService
* @return 结果
*/
@Override
public int deleteWmsBusinessTypeByTypeIds(String[] typeIds)
{
public int deleteWmsBusinessTypeByTypeIds(String[] typeIds) {
return wmsBusinessTypeMapper.deleteWmsBusinessTypeByTypeIds(typeIds);
}
@ -88,8 +95,7 @@ public class WmsBusinessTypeServiceImpl implements IWmsBusinessTypeService
* @return 结果
*/
@Override
public int deleteWmsBusinessTypeByTypeId(String typeId)
{
public int deleteWmsBusinessTypeByTypeId(String typeId) {
return wmsBusinessTypeMapper.deleteWmsBusinessTypeByTypeId(typeId);
}
}

View File

@ -6,12 +6,18 @@ import com.ktg.common.utils.StringUtils;
import com.ktg.mes.md.domain.*;
import com.ktg.mes.md.mapper.*;
import com.ktg.mes.md.service.IWmsOutPlanService;
import com.ktg.mes.stl.domain.InventoryAdjustment;
import com.ktg.mes.stl.mapper.InventoryAdjustmentMapper;
import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.mapper.WmStorageAreaMapper;
import com.ktg.mes.wm.mapper.WmStorageLocationMapper;
import com.ktg.mes.wm.mapper.WmWarehouseMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
@ -23,27 +29,17 @@ import java.util.concurrent.atomic.AtomicInteger;
* @date 2024-11-01
*/
@Service
@RequiredArgsConstructor
public class WmsOutPlanServiceImpl implements IWmsOutPlanService {
@Autowired
private WmsOutPlanMapper wmsOutPlanMapper;
@Autowired
private WmsOutPlanDetailEntityMapper wmsOutPlanDetailEntityMapper;
@Autowired
private WmsOutTaskMapper wmsOutTaskMapper;
@Autowired
private BaseKnifeMapper baseKnifeMapper;
@Autowired
private WmsBusinessTypeMapper wmsBusinessTypeMapper;
@Autowired
private MdItemMapper mdItemMapper;
@Autowired
private WmStorageAreaMapper wmStorageAreaMapper;
private final WmsOutPlanMapper wmsOutPlanMapper;
private final WmsOutPlanDetailEntityMapper wmsOutPlanDetailEntityMapper;
private final WmsOutTaskMapper wmsOutTaskMapper;
private final BaseKnifeMapper baseKnifeMapper;
private final WmsBusinessTypeMapper wmsBusinessTypeMapper;
private final MdItemMapper mdItemMapper;
private final AP0AEMapper ap0AEMapper;
private final WmStorageAreaMapper wmStorageAreaMapper;
private final InventoryAdjustmentMapper inventoryAdjustmentMapper;
/**
* 查询出库计划管理
@ -73,6 +69,16 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService {
return wmsOutPlanList;
}
@Transactional
@Override
public int insertWmsOutPlanAndRun(WmsOutPlan wmsOutPlan) {
wmsOutPlan.setCreateTime(DateUtils.getNowDate());
int rows = wmsOutPlanMapper.insertWmsOutPlan(wmsOutPlan);
insertWmsOutPlanDetail(wmsOutPlan);
this.runWmsOutPlan(new Long[]{wmsOutPlan.getWmsOutPlanId()});
return rows;
}
/**
* 新增出库计划管理
*
@ -141,9 +147,8 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService {
List<WmsOutPlanDetail> wmsOutPlanDetailList = wmsOutPlan.getWmsOutPlanDetailList();
wmsOutPlanDetailList.forEach(wmsOutPlanDetail -> {
// 获得该出库计划子项对应的工具台账实体
List<BaseKnife> baseKnifeList = this.baseKnifeMapper.selectBaseKnifeListByMbbBdMrlIdAndAreaCodeAndKnifeFineStateAndIsLocked(
List<BaseKnife> baseKnifeList = this.baseKnifeMapper.selectBaseKnifeListByMbbBdMrlIdAndKnifeFineStateAndIsLocked(
wmsOutPlanDetail.getMdItemId(),
wmsOutPlanDetail.getWmStorageAreaCode(),
0
);
@ -160,6 +165,7 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService {
);
// 开始遍历出库计划子项
HashMap<String, List<BaseKnife>> baseKnifeListHashMap = new HashMap<>();
baseKnifeList.subList(0, wmsOutPlanDetail.getPlannedQuantity()).forEach(baseKnife -> {
// 构建出库计划明细实体
WmsOutPlanDetailEntity wmsOutPlanDetailEntity = new WmsOutPlanDetailEntity();
@ -181,8 +187,18 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService {
// 锁定工具台账中的物料实体
this.baseKnifeMapper.updateBaseKnifeIsLockedByBaseKnifeId(baseKnife.getBaseKnifeId(), 1);
// 加入进MAP
if (!baseKnifeListHashMap.containsKey(baseKnife.getAreaCode()))
baseKnifeListHashMap.put(baseKnife.getAreaCode(), new ArrayList<>());
baseKnifeListHashMap.get(baseKnife.getAreaCode()).add(baseKnife);
});
// 根据库位遍历台账
baseKnifeListHashMap.keySet().forEach(key -> {
// 获取库位信息
WmStorageArea wmStorageAreaByAreaCode = this.wmStorageAreaMapper.selectWmStorageAreaByAreaCode(key);
// 构建出库任务
WmsOutTask wmsOutTask = new WmsOutTask();
wmsOutTask.setWmsOutPlanId(wmsOutPlanId);
@ -190,9 +206,9 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService {
wmsOutTask.setWmsOutPlanDetailId(wmsOutPlanDetail.getWmsOutPlanDetailId());
wmsOutTask.setWmsBusinessTypeId(wmsOutPlan.getWmsBusinessTypeId());
wmsOutTask.setTaskCode(new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
wmsOutTask.setTaskNumber(wmsOutPlanDetail.getPlannedQuantity());
wmsOutTask.setOutNumber(wmsOutPlanDetail.getPlannedQuantity());
wmsOutTask.setWmStorageAreaId(wmsOutPlanDetail.getWmStorageAreaId());
wmsOutTask.setTaskNumber(baseKnifeListHashMap.get(key).size());
wmsOutTask.setOutNumber(baseKnifeListHashMap.get(key).size());
wmsOutTask.setWmStorageAreaId(wmStorageAreaByAreaCode.getAreaId());
wmsOutTask.setBatchNum(wmsOutPlanDetail.getDetailBatchNum());
wmsOutTask.setMdItemId(wmsOutPlanDetail.getMdItemId());
wmsOutTask.setMdItemCode(wmsOutPlanDetail.getMdItemCode());
@ -205,6 +221,7 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService {
// 插入出库任务
this.wmsOutTaskMapper.insertWmsOutTask(wmsOutTask);
});
});
// 更新出库计划状态为已执行
wmsOutPlan.setPlanState("1");
@ -248,10 +265,12 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService {
hashMap.put("wmStorageAreaCode", wmsOutPlanDetail.getWmStorageAreaCode()); // 库位编码
hashMap.put("wmStorageAreaName", wmsOutPlanDetail.getWmStorageAreaName()); // 库位名称
hashMap.put("detailStatus", wmsOutPlanDetail.getDetailState()); // 明细状态
/* 来自台账明细 */
/* 来自物料 */
hashMap.put("itemId", mdItem.getItemId()); // 物料ID
hashMap.put("itemName", mdItem.getItemName()); // 物料名称
hashMap.put("itemCode", mdItem.getItemCode()); // 物料编码
/* 来自台账 */
hashMap.put("baseKnife", baseKnifeMapper.selectBaseKnifeByBaseKnifeId(nowWmsOutPlanDetailEntity.getBaseKnifeId()));
/* 实体 */
String outTime = null;
if (nowWmsOutPlanDetailEntity.getCreateTime() != null)
@ -262,6 +281,261 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService {
return hashMapList;
}
@Override
public int synchronizationMiniBox(String username) {
// 获得全部未记录的小货柜出库数据
HashMap<String, List<AP0AE>> ap0aeDateMap = new HashMap<>();
HashMap<String, List<InventoryAdjustment>> inventoryAdjustmentDateMap = new HashMap<>();
List<AP0AE> ap0AEList = ap0AEMapper.selectOutNewData();
List<InventoryAdjustment> inventoryAdjustmentList = this.inventoryAdjustmentMapper.selectOutNewData();
ap0AEList.forEach(ap0AE -> {
String dateKey = new SimpleDateFormat("yyyy-MM-dd").format(ap0AE.getDATE01());
ap0aeDateMap.computeIfAbsent(dateKey, k -> new ArrayList<>());
ap0aeDateMap.get(dateKey).add(ap0AE);
});
inventoryAdjustmentList.forEach(inventoryAdjustment -> {
String dateKey = new SimpleDateFormat("yyyy-MM-dd").format(inventoryAdjustment.getInTime());
inventoryAdjustmentDateMap.computeIfAbsent(dateKey, k -> new ArrayList<>());
inventoryAdjustmentDateMap.get(dateKey).add(inventoryAdjustment);
});
// 根据日期进行分组遍历
ap0aeDateMap.keySet().forEach(dateKey -> {
Date itemDate = new Date();
try {
itemDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(dateKey + " 00:00:00");
} catch (ParseException ignored) {
}
// 构建出库计划
WmsOutPlan wmsOutPlan = new WmsOutPlan();
wmsOutPlan.setPlanCode(Long.toString(System.currentTimeMillis(), 32).toUpperCase(Locale.ROOT));
wmsOutPlan.setWmsBusinessTypeId(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("DPCK").getTypeId() != null ? this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("DPCK").getTypeId() : 11L);
wmsOutPlan.setPlanState("1");
wmsOutPlan.setPlanType("XTTB");
wmsOutPlan.setRemark("同步小型刀具库数据");
wmsOutPlan.setCreateBy(username);
wmsOutPlan.setCreateTime(itemDate);
wmsOutPlanMapper.insertWmsOutPlan(wmsOutPlan);
// 构建出库计划明细
ap0aeDateMap.get(dateKey).forEach(ap0AE -> {
// 获得物料对象
MdItem mdItem = mdItemMapper.selectMdItemByCode(ap0AE.getAE014());
if (mdItem == null) return;
// 获得库位对象
WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaCode(ap0AE.getAE020());
if (wmStorageArea == null) return;
// 构建出库计划明细
WmsOutPlanDetail wmsOutPlanDetail = new WmsOutPlanDetail();
wmsOutPlanDetail.setWmsOutPlanId(wmsOutPlan.getWmsOutPlanId());
wmsOutPlanDetail.setMdItemId(mdItem.getItemId());
wmsOutPlanDetail.setMdItemCode(mdItem.getItemCode());
wmsOutPlanDetail.setMdItemName(mdItem.getItemName());
wmsOutPlanDetail.setMdItemUnit(mdItem.getUnitName());
wmsOutPlanDetail.setPlannedQuantity((int) ap0AE.getAE017().doubleValue());
wmsOutPlanDetail.setRealQuantity((int) ap0AE.getAE017().doubleValue());
wmsOutPlanDetail.setDetailBatchNum("1");
wmsOutPlanDetail.setWmStorageAreaId(wmStorageArea.getAreaId());
wmsOutPlanDetail.setWmStorageAreaCode(wmStorageArea.getAreaCode());
wmsOutPlanDetail.setWmStorageAreaName(wmStorageArea.getAreaName());
wmsOutPlanDetail.setDetailState("1");
wmsOutPlanDetail.setRemark("同步小型刀具库数据");
wmsOutPlanDetail.setCreateBy(username);
wmsOutPlanDetail.setCreateTime(ap0AE.getDATE01());
wmsOutPlanMapper.insertWmsOutPlanDetail(wmsOutPlanDetail);
// 获得该出库计划子项对应的工具台账实体
List<BaseKnife> baseKnifeList = this.baseKnifeMapper.selectBaseKnifeListByMbbBdMrlIdAndAreaCodeAndKnifeFineStateAndIsLocked(
wmsOutPlanDetail.getMdItemId(),
wmsOutPlanDetail.getWmStorageAreaCode(),
0
);
// 校验库中数量是否足够
if (baseKnifeList.size() < wmsOutPlanDetail.getPlannedQuantity()) {
throw new RuntimeException("AE库存数量不足以支持本次出库物料" + ap0AE.getAE015() + ",库内" + baseKnifeList.size() + ",需要" + wmsOutPlanDetail.getPlannedQuantity());
}
// 开始遍历出库计划子项
baseKnifeList.subList(0, wmsOutPlanDetail.getPlannedQuantity()).forEach(baseKnife -> {
// 构建出库计划明细实体
WmsOutPlanDetailEntity wmsOutPlanDetailEntity = new WmsOutPlanDetailEntity();
wmsOutPlanDetailEntity.setWmsOutPlanDetailId(wmsOutPlanDetail.getWmsOutPlanDetailId());
wmsOutPlanDetailEntity.setBaseKnifeId(baseKnife.getBaseKnifeId());
wmsOutPlanDetailEntity.setAreaCode(baseKnife.getAreaCode());
wmsOutPlanDetailEntity.setItemOrProduct(baseKnife.getItemOrProduct());
wmsOutPlanDetailEntity.setKnifeCode(baseKnife.getKnifeCode());
wmsOutPlanDetailEntity.setKnifeName(baseKnife.getKnifeName());
wmsOutPlanDetailEntity.setPlanSheet(baseKnife.getPlanSheet());
wmsOutPlanDetailEntity.setKnifeLife(baseKnife.getKnifeLife());
wmsOutPlanDetailEntity.setResetCount(baseKnife.getResetCount());
wmsOutPlanDetailEntity.setKnifeUnit(baseKnife.getKnifeUnit());
wmsOutPlanDetailEntity.setSafeStock(baseKnife.getKnifeType());
wmsOutPlanDetailEntity.setStandardQuantity(baseKnife.getStandardQuantity());
// 插入出库计划明细实体
this.wmsOutPlanDetailEntityMapper.insertWmsOutPlanDetailEntity(wmsOutPlanDetailEntity);
// 锁定工具台账中的物料实体
this.baseKnifeMapper.updateBaseKnifeIsLockedByBaseKnifeId(baseKnife.getBaseKnifeId(), 1);
// 锁定并出库台账明细实体
this.baseKnifeMapper.updateBaseKnifeKnifeFineStateAndIsLockedByBaseKnifeId(
wmsOutPlanDetailEntity.getBaseKnifeId(),
2,
1
);
});
// 构建出库任务
WmsOutTask wmsOutTask = new WmsOutTask();
wmsOutTask.setWmsOutPlanId(wmsOutPlan.getWmsOutPlanId());
wmsOutTask.setWmsOutPlanCode(wmsOutPlan.getPlanCode());
wmsOutTask.setWmsOutPlanDetailId(wmsOutPlanDetail.getWmsOutPlanDetailId());
wmsOutTask.setWmsBusinessTypeId(wmsOutPlan.getWmsBusinessTypeId());
wmsOutTask.setTaskCode(new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
wmsOutTask.setTaskNumber(wmsOutPlanDetail.getPlannedQuantity());
wmsOutTask.setOutNumber(wmsOutPlanDetail.getPlannedQuantity());
wmsOutTask.setWmStorageAreaId(wmsOutPlanDetail.getWmStorageAreaId());
wmsOutTask.setBatchNum(wmsOutPlanDetail.getDetailBatchNum());
wmsOutTask.setMdItemId(wmsOutPlanDetail.getMdItemId());
wmsOutTask.setMdItemCode(wmsOutPlanDetail.getMdItemCode());
wmsOutTask.setMdItemName(wmsOutPlanDetail.getMdItemName());
wmsOutTask.setMdItemUnit(wmsOutPlanDetail.getMdItemUnit());
wmsOutTask.setTaskState("1");
wmsOutTask.setRecipientUsername(wmsOutPlan.getRecipientUsername());
wmsOutTask.setCreateTime(new Date());
// 插入出库任务
this.wmsOutTaskMapper.insertWmsOutTask(wmsOutTask);
// 设置小型货柜数据为已读
this.ap0AEMapper.updateOutDataToOld(ap0AE);
});
});
inventoryAdjustmentDateMap.keySet().forEach(dateKey -> {
Date itemDate = new Date();
try {
itemDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(dateKey + " 00:00:00");
} catch (ParseException ignored) {
}
// 构建出库计划
WmsOutPlan wmsOutPlan = new WmsOutPlan();
wmsOutPlan.setPlanCode(Long.toString(System.currentTimeMillis(), 32).toUpperCase(Locale.ROOT));
wmsOutPlan.setWmsBusinessTypeId(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("DPCK").getTypeId() != null ? this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("DPCK").getTypeId() : 11L);
wmsOutPlan.setPlanState("1");
wmsOutPlan.setPlanType("XTTB");
wmsOutPlan.setRemark("同步小型刀具库数据");
wmsOutPlan.setCreateBy(username);
wmsOutPlan.setCreateTime(itemDate);
wmsOutPlanMapper.insertWmsOutPlan(wmsOutPlan);
// 构建出库计划明细
inventoryAdjustmentDateMap.get(dateKey).forEach(inventoryAdjustment -> {
// 获得物料对象
MdItem mdItem = mdItemMapper.selectMdItemByCode(inventoryAdjustment.getProductNumber());
if (mdItem == null) return;
// 获得库位对象
WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaCode(inventoryAdjustment.getOutWarehouse());
if (wmStorageArea == null) return;
// 构建出库计划明细
WmsOutPlanDetail wmsOutPlanDetail = new WmsOutPlanDetail();
wmsOutPlanDetail.setWmsOutPlanId(wmsOutPlan.getWmsOutPlanId());
wmsOutPlanDetail.setMdItemId(mdItem.getItemId());
wmsOutPlanDetail.setMdItemCode(mdItem.getItemCode());
wmsOutPlanDetail.setMdItemName(mdItem.getItemName());
wmsOutPlanDetail.setMdItemUnit(mdItem.getUnitName());
wmsOutPlanDetail.setPlannedQuantity((int) inventoryAdjustment.getQuantity().doubleValue());
wmsOutPlanDetail.setRealQuantity((int) inventoryAdjustment.getQuantity().doubleValue());
wmsOutPlanDetail.setDetailBatchNum("1");
wmsOutPlanDetail.setWmStorageAreaId(wmStorageArea.getAreaId());
wmsOutPlanDetail.setWmStorageAreaCode(wmStorageArea.getAreaCode());
wmsOutPlanDetail.setWmStorageAreaName(wmStorageArea.getAreaName());
wmsOutPlanDetail.setDetailState("1");
wmsOutPlanDetail.setRemark("同步小型刀具库数据");
wmsOutPlanDetail.setCreateBy(username);
wmsOutPlanDetail.setCreateTime(inventoryAdjustment.getInTime());
wmsOutPlanMapper.insertWmsOutPlanDetail(wmsOutPlanDetail);
// 获得该出库计划子项对应的工具台账实体
List<BaseKnife> baseKnifeList = this.baseKnifeMapper.selectBaseKnifeListByMbbBdMrlIdAndAreaCodeAndKnifeFineStateAndIsLocked(
wmsOutPlanDetail.getMdItemId(),
wmsOutPlanDetail.getWmStorageAreaCode(),
0
);
// 校验库中数量是否足够
if (baseKnifeList.size() < wmsOutPlanDetail.getPlannedQuantity()) {
throw new RuntimeException("AD库存数量不足以支持本次出库物料" + inventoryAdjustment.getProductName() + ",库内" + baseKnifeList.size() + ",需要" + wmsOutPlanDetail.getPlannedQuantity());
}
// 开始遍历出库计划子项
baseKnifeList.subList(0, wmsOutPlanDetail.getPlannedQuantity()).forEach(baseKnife -> {
// 构建出库计划明细实体
WmsOutPlanDetailEntity wmsOutPlanDetailEntity = new WmsOutPlanDetailEntity();
wmsOutPlanDetailEntity.setWmsOutPlanDetailId(wmsOutPlanDetail.getWmsOutPlanDetailId());
wmsOutPlanDetailEntity.setBaseKnifeId(baseKnife.getBaseKnifeId());
wmsOutPlanDetailEntity.setAreaCode(baseKnife.getAreaCode());
wmsOutPlanDetailEntity.setItemOrProduct(baseKnife.getItemOrProduct());
wmsOutPlanDetailEntity.setKnifeCode(baseKnife.getKnifeCode());
wmsOutPlanDetailEntity.setKnifeName(baseKnife.getKnifeName());
wmsOutPlanDetailEntity.setPlanSheet(baseKnife.getPlanSheet());
wmsOutPlanDetailEntity.setKnifeLife(baseKnife.getKnifeLife());
wmsOutPlanDetailEntity.setResetCount(baseKnife.getResetCount());
wmsOutPlanDetailEntity.setKnifeUnit(baseKnife.getKnifeUnit());
wmsOutPlanDetailEntity.setSafeStock(baseKnife.getKnifeType());
wmsOutPlanDetailEntity.setStandardQuantity(baseKnife.getStandardQuantity());
// 插入出库计划明细实体
this.wmsOutPlanDetailEntityMapper.insertWmsOutPlanDetailEntity(wmsOutPlanDetailEntity);
// 锁定工具台账中的物料实体
this.baseKnifeMapper.updateBaseKnifeIsLockedByBaseKnifeId(baseKnife.getBaseKnifeId(), 1);
// 锁定并出库台账明细实体
this.baseKnifeMapper.updateBaseKnifeKnifeFineStateAndIsLockedByBaseKnifeId(
wmsOutPlanDetailEntity.getBaseKnifeId(),
2,
1
);
});
// 构建出库任务
WmsOutTask wmsOutTask = new WmsOutTask();
wmsOutTask.setWmsOutPlanId(wmsOutPlan.getWmsOutPlanId());
wmsOutTask.setWmsOutPlanCode(wmsOutPlan.getPlanCode());
wmsOutTask.setWmsOutPlanDetailId(wmsOutPlanDetail.getWmsOutPlanDetailId());
wmsOutTask.setWmsBusinessTypeId(wmsOutPlan.getWmsBusinessTypeId());
wmsOutTask.setTaskCode(new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
wmsOutTask.setTaskNumber(wmsOutPlanDetail.getPlannedQuantity());
wmsOutTask.setOutNumber(wmsOutPlanDetail.getPlannedQuantity());
wmsOutTask.setWmStorageAreaId(wmsOutPlanDetail.getWmStorageAreaId());
wmsOutTask.setBatchNum(wmsOutPlanDetail.getDetailBatchNum());
wmsOutTask.setMdItemId(wmsOutPlanDetail.getMdItemId());
wmsOutTask.setMdItemCode(wmsOutPlanDetail.getMdItemCode());
wmsOutTask.setMdItemName(wmsOutPlanDetail.getMdItemName());
wmsOutTask.setMdItemUnit(wmsOutPlanDetail.getMdItemUnit());
wmsOutTask.setTaskState("1");
wmsOutTask.setRecipientUsername(wmsOutPlan.getRecipientUsername());
wmsOutTask.setCreateTime(new Date());
// 插入出库任务
this.wmsOutTaskMapper.insertWmsOutTask(wmsOutTask);
// 设置小型货柜数据为已读
this.inventoryAdjustmentMapper.updateOutDataToOld(inventoryAdjustment);
});
});
return 1;
}
@Transactional
@Override
public int autoScrapOut(String username) {
@ -291,7 +565,7 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService {
// 构建出库计划
WmsOutPlan wmsOutPlan = new WmsOutPlan();
wmsOutPlan.setPlanCode(Long.toString(System.currentTimeMillis(), 32).toUpperCase(Locale.ROOT));
wmsOutPlan.setWmsBusinessTypeId(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("CK04").getTypeId() != null ? Long.parseLong(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("CK04").getTypeId()) : 14L);
wmsOutPlan.setWmsBusinessTypeId(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("CK04").getTypeId() != null ? this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("CK04").getTypeId() : 14L);
wmsOutPlan.setPlanState("1");
wmsOutPlan.setPlanType("SCZB");
wmsOutPlan.setRemark("一键清退无寿命物品");

View File

@ -1,21 +1,34 @@
package com.ktg.mes.md.service.impl;
import com.alibaba.fastjson.JSON;
import com.ktg.common.utils.DateUtils;
import com.ktg.mes.cal.utils.CalendarUtil;
import com.ktg.mes.md.domain.*;
import com.ktg.mes.md.mapper.*;
import com.ktg.mes.md.service.IWmsOutTaskService;
import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.domain.WmsZdTask;
import com.ktg.mes.wm.mapper.WmStorageAreaMapper;
import com.ktg.mes.wm.service.IWmStorageAreaService;
import com.ktg.mes.wm.mapper.WmsZdTaskMapper;
import jcifs.smb.NtlmPasswordAuthentication;
import jcifs.smb.SmbFile;
import jcifs.smb.SmbFileInputStream;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.attribute.FileTime;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
* 出库任务Service业务层处理
@ -46,6 +59,12 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
@Autowired
private WmStorageAreaMapper wmStorageAreaMapper;
@Autowired
private WmsZdTaskMapper wmsZdTaskMapper;
@Autowired
private MyConfig myConfig;
/**
* 查询出库任务
*
@ -78,7 +97,7 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
WmsBusinessType wmsBusinessType = this.wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(wmsOutPlan.getWmsBusinessTypeId().toString());
// 获取库位信息
WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaId(wmsOutPlanDetail.getWmStorageAreaId());
WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaCode(nowWmsOutPlanDetailEntity.getAreaCode());
// 设定出库信息数据
HashMap<String, Object> hashMap = new HashMap<>();
@ -98,9 +117,9 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
hashMap.put("planTypeName", wmsBusinessType.getName()); // 出库类型名称
/* 来自计划明细 */
hashMap.put("detailBatchNum", wmsOutPlanDetail.getDetailBatchNum()); // 明细批次
hashMap.put("wmStorageAreaId", wmsOutPlanDetail.getWmStorageAreaId()); // 库位ID
hashMap.put("wmStorageAreaCode", wmsOutPlanDetail.getWmStorageAreaCode()); // 库位编码
hashMap.put("wmStorageAreaName", wmsOutPlanDetail.getWmStorageAreaName()); // 库位名称
hashMap.put("wmStorageAreaId", wmStorageArea.getAreaId()); // 库位ID
hashMap.put("wmStorageAreaCode", wmStorageArea.getAreaCode()); // 库位编码
hashMap.put("wmStorageAreaName", wmStorageArea.getAreaName()); // 库位名称
hashMap.put("cellX", wmStorageArea.getPositionX().toString());
hashMap.put("cellY", wmStorageArea.getPositionY().toString());
hashMap.put("cellZ", wmStorageArea.getPositionZ().toString());
@ -141,6 +160,13 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
WmsBusinessType wmsBusinessType = wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(nowWmsOutTask.getWmsBusinessTypeId().toString());
nowWmsOutTask.setWmsBusinessTypeCode(wmsBusinessType.getCode());
wmsOutTasks.add(nowWmsOutTask);
WmsOutPlanDetailEntity entityQuery = new WmsOutPlanDetailEntity();
entityQuery.setWmsOutPlanDetailId(nowWmsOutTask.getWmsOutPlanDetailId());
nowWmsOutTask.setBaseKnifes(wmsOutPlanDetailEntityMapper.selectWmsOutPlanDetailEntityList(entityQuery).stream()
.map(it -> this.baseKnifeMapper.selectBaseKnifeByBaseKnifeId(it.getBaseKnifeId()))
.filter(Objects::nonNull).collect(Collectors.toList()));
});
return wmsOutTasks;
@ -194,7 +220,7 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
@Transactional
@Override
public boolean runWmsOutTask(Long[] wmsOutTaskIds) {
public boolean runWmsOutTask(Long[] wmsOutTaskIds) throws JAXBException {
for (Long wmsOutTaskId : wmsOutTaskIds) {
// 获得当前出库任务
WmsOutTask wmsOutTask = wmsOutTaskMapper.selectWmsOutTaskByWmsOutTaskId(wmsOutTaskId);
@ -212,15 +238,230 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
2,
1
);
// 获取台账实体如果为整刀则开始读取对刀仪数据
BaseKnife baseKnife = baseKnifeMapper.selectBaseKnifeByBaseKnifeId(wmsOutPlanDetailEntity.getBaseKnifeId());
if (Objects.equals("PRODUCT", baseKnife.getItemOrProduct()))
this.readToolSettingRemoteFile(wmsOutPlanDetailEntity);
}
// 更新出库任务状态
wmsOutTask.setTaskState("1");
wmsOutTaskMapper.updateWmsOutTask(wmsOutTask);
// 完成标识
boolean flag = true;
// 判断是否来自组装任务
WmsZdTask wmsZdTaskWrapper = new WmsZdTask();
wmsZdTaskWrapper.setCode(wmsOutTask.getWmsOutPlanCode());
List<WmsZdTask> wmsZdTaskList = wmsZdTaskMapper.selectWmsZdTaskList(wmsZdTaskWrapper);
if (!wmsZdTaskList.isEmpty()) {
// 获取组装任务
WmsZdTask wmsZdTask = wmsZdTaskList.get(0);
// 检测是否完成
WmsOutTask wmsOutTaskWrapper = new WmsOutTask();
wmsOutTaskWrapper.setWmsOutPlanCode(wmsZdTask.getCode());
List<WmsOutTask> wmsOutTaskList = wmsOutTaskMapper.selectWmsOutTaskList(wmsOutTaskWrapper);
// 遍历状态
for (WmsOutTask item : wmsOutTaskList) {
if (Objects.equals("0", item.getTaskState())) {
flag = false;
break;
}
}
}
if (flag) {
this.wmsZdTaskFinish(wmsOutTask.getWmsOutPlanCode());
}
}
return true;
}
public void readToolSettingRemoteFile(WmsOutPlanDetailEntity wmsOutPlanDetailEntity) {
// 当前时间
String currentDate = CalendarUtil.getDateTimeStr();
// 配置每十秒执行扫描文件
Timer timer = new Timer();
TimerTask task = new TimerTask() {
@Override
public void run() {
try {
// 创建认证用户
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("", myConfig.getRemoteUser(), myConfig.getRemotePass());
// 构建远程文件对象
SmbFile remoteFile = new SmbFile(myConfig.getRemoteUrl(), auth);
// 尝试链接
remoteFile.connect();
if (remoteFile.exists()) {
// 获取共享文件夹中文件列表
SmbFile[] smbFiles = remoteFile.listFiles();
for (SmbFile smbFile : smbFiles) {
if (smbFile.isFile()) {
// Path path = Paths.get(smbFile.getPath()); // 根据文件的绝对路径获取文件
// BasicFileAttributes attributes = Files.readAttributes(path, BasicFileAttributes.class); // 根据path获取文件的基本属性
// FileTime fileTime = attributes.creationTime(); // 从基本属性中获取文件的创建时间
// long millis = fileTime.toMillis(); // 将创建时间转换成毫秒
// 时间戳比较
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (dateFormat.parse(currentDate).getTime() < smbFile.lastModified()) {
// 停止扫描
this.cancel();
// 保存到本地
createFile(smbFile);
// 读取本地文件
File xmlFile = new File(myConfig.getToolSettingXmlPath() + CalendarUtil.getDateTimeStrForFile() + "/" + smbFile.getName());
JAXBContext jaxbContext = JAXBContext.newInstance(Tools.class);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
Tools paramXml = (Tools) unmarshaller.unmarshal(xmlFile);
// 更新对刀参数
wmsOutPlanDetailEntity.setIsToolSetting(1);
wmsOutPlanDetailEntity.setToolSettingParam(JSON.toJSONString(paramXml));
wmsOutPlanDetailEntityMapper.updateWmsOutPlanDetailEntity(wmsOutPlanDetailEntity);
}
}
}
} else {
throw new RuntimeException("远程共享文件夹不存在或无法连接!");
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
};
timer.schedule(task, 0, 10000);
}
/**
* 创建本地文件
*/
public void createFile(SmbFile remoteFile) {
InputStream in = null;
OutputStream out = null;
try {
// 创建本地文件
// File localFile = new File("E:/xml_wjj/" + CalendarUtil.getDateTimeStrForFile() + "/" + remoteFile.getName());
File localFile = new File(myConfig.getToolSettingXmlPath() + CalendarUtil.getDateTimeStrForFile() + "/" + remoteFile.getName());
if (!localFile.getParentFile().exists()) localFile.getParentFile().mkdirs();
if (!localFile.exists()) localFile.createNewFile();
else {
localFile.delete();
localFile.createNewFile();
}
in = new BufferedInputStream(new SmbFileInputStream(remoteFile));
// 获取远程输出流
out = new BufferedOutputStream(new FileOutputStream(localFile));
byte[] buffer = new byte[4096];
int len = 0;
// 写入
while ((len = in.read(buffer, 0, buffer.length)) != -1) {
out.write(buffer, 0, len);
}
out.flush(); // 刷新缓冲
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
try {
if (out != null) out.close();
if (in != null) in.close();
} catch (Exception e) {
System.out.println("==============START=================");
System.out.println("关闭资源发生错误!");
System.out.println("===============END==================");
}
}
}
public void readToolSettingFile(BaseKnife baseKnife) {
// 当前时间
String currentDate = CalendarUtil.getDateTimeStr();
// 配置每十秒执行扫描文件
Timer timer = new Timer();
TimerTask task = new TimerTask() {
@Override
public void run() {
File folder = new File(myConfig.getRemoteUrl());
File[] files = folder.listFiles();
for (File file : files) {
if (file.isFile()) {
try {
// 根据文件的绝对路径获取文件
Path path = Paths.get(file.getAbsolutePath());
// 根据path获取文件的基本属性
BasicFileAttributes attributes = Files.readAttributes(path, BasicFileAttributes.class);
// 从基本属性中获取文件的创建时间
FileTime fileTime = attributes.creationTime();
// 将创建时间转换成毫秒
long millis = fileTime.toMillis();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = new Date();
date.setTime(millis);
// 毫秒转换成时间字符串
String fileCreateTime = dateFormat.format(date);
// 时间戳比较
if (dateFormat.parse(currentDate).getTime() < dateFormat.parse(fileCreateTime).getTime()) {
System.out.println("文件创建时间:" + fileCreateTime);
System.out.println("文件名:" + file.getName());
// 停止扫描
this.cancel();
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
}
};
timer.schedule(task, 0, 10000);
}
public void wmsZdTaskFinish(String planCode) {
WmsZdTask wmsZdTaskWrapper = new WmsZdTask();
wmsZdTaskWrapper.setCode(planCode);
List<WmsZdTask> wmsZdTaskList = wmsZdTaskMapper.selectWmsZdTaskList(wmsZdTaskWrapper);
if (!wmsZdTaskList.isEmpty()) {
// 获取组装任务 更新状态
WmsZdTask wmsZdTask = wmsZdTaskList.get(0);
wmsZdTask.setStatus("1");
wmsZdTaskMapper.updateWmsZdTask(wmsZdTask);
}
}
public void toolSetting(WmsOutPlanDetailEntity wmsOutPlanDetailEntity) throws JAXBException {
// 读取xml配置文件
File xmlFile = new File(myConfig.getToolSettingXmlPath());
JAXBContext jaxbContext = JAXBContext.newInstance(ParamXml.class);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
ParamXml paramXml = (ParamXml) unmarshaller.unmarshal(xmlFile);
// 获取当前实体台账
BaseKnife baseKnife = baseKnifeMapper.selectBaseKnifeByBaseKnifeId(wmsOutPlanDetailEntity.getBaseKnifeId());
if (Objects.equals(baseKnife.getRfid(), paramXml.getRfid())) {
wmsOutPlanDetailEntity.setIsToolSetting(1);
wmsOutPlanDetailEntity.setToolSettingParam("rfid: " + paramXml.getRfid() + " name: " + paramXml.getName() + " param: " + paramXml.getParam());
wmsOutPlanDetailEntityMapper.updateWmsOutPlanDetailEntity(wmsOutPlanDetailEntity);
}
}
@Transactional
@Override
public boolean autoRunWmsOutTask(Long[] wmsOutTaskIds) {

View File

@ -0,0 +1,105 @@
package com.ktg.mes.stl.domain;
import com.ktg.common.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 小型刀具库-库存调整
*/
@Data
public class InventoryAdjustment {
@Excel(name = "单别")
private String singetsu;
@Excel(name = "单号")
private String oddNumber;
@Excel(name = "单据日期")
private Date billDate;
@Excel(name = "序号")
private String serialNumber;
@Excel(name = "品号")
private String productNumber;
@Excel(name = "品名")
private String productName;
@Excel(name = "规格")
private String specification;
@Excel(name = "数量")
private Double quantity;
@Excel(name = "单价")
private Double unitPrice;
@Excel(name = "金额")
private Double money;
@Excel(name = "调出仓库")
private String outWarehouse;
@Excel(name = "调入仓库")
private String inWarehouse;
@Excel(name = "审核码")
private String approvalCode;
@Excel(name = "品牌")
private String brand;
@Excel(name = "厂家品号")
private String manufacturersProductNumber;
@Excel(name = "备注一")
private String remark1;
@Excel(name = "备注二")
private String remark2;
@Excel(name = "自定义字段1")
private String customField1;
@Excel(name = "自定义字段2")
private String customField2;
@Excel(name = "自定义字段3")
private String customField3;
@Excel(name = "自定义字段4")
private String customField4;
@Excel(name = "自定义字段5")
private String customField5;
@Excel(name = "自定义字段6")
private Double customField6;
@Excel(name = "自定义字段7")
private Double customField7;
@Excel(name = "自定义字段8")
private Double customField8;
@Excel(name = "自定义字段9")
private Double customField9;
@Excel(name = "自定义字段10")
private Double customField10;
@Excel(name = "录入人")
private String dataEntryClerk;
@Excel(name = "审核人")
private String auditor;
@Excel(name = "录入时间")
private Date inTime;
@Excel(name = "审核时间")
private Date auditTime;
}

View File

@ -0,0 +1,163 @@
package com.ktg.mes.stl.domain;
import com.ktg.common.annotation.Excel;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* 小型刀具库-物料信息
*/
@Data
public class StlMaterial {
@Excel(name = "品号")
private String productNumber;
@Excel(name = "品名")
private String productName;
@Excel(name = "规格")
private String specification;
@Excel(name = "单位")
private String unit;
@Excel(name = "图片")
private byte[] image;
@Excel(name = "主仓库")
private String mainWarehouse;
@Excel(name = "库存成本")
private BigDecimal inventoryCost;
@Excel(name = "图片更新栏位")
private String imageUpdateColumn;
@Excel(name = "最低库存")
private BigDecimal minimumInventory;
@Excel(name = "物料类型一")
private String materialTypeOne;
@Excel(name = "物料类型二")
private String materialTypeTwo;
@Excel(name = "品牌")
private String brand;
@Excel(name = "厂家品号")
private String manufacturerProductNumber;
@Excel(name = "领用类型(领用/借用)")
private String consumptionType;
@Excel(name = "单品管理")
private String individualItemManagement;
@Excel(name = "领用权限控制")
private String consumptionPermissionControl;
@Excel(name = "未归还数控制")
private String unreturnedNumberControl;
@Excel(name = "个人/设备 总领用量控制")
private String totalConsumptionControl;
@Excel(name = "归还对象限定类型")
private String returnObjectRestrictionType;
@Excel(name = "有效码(有效,限制,停止)")
private String validityCode;
@Excel(name = "备注一")
private String remarkOne;
@Excel(name = "备注二")
private String remarkTwo;
@Excel(name = "物料类型三")
private String materialTypeThree;
@Excel(name = "物料柜类型")
private String materialCabinetType;
@Excel(name = "条码")
private String barcode;
@Excel(name = "库位管理是否")
private String locationManagementEnabled;
@Excel(name = "显示类型")
private String displayType;
@Excel(name = "物料序号管理是否")
private String materialSerialNumberManagementEnabled;
@Excel(name = "采购单位")
private String purchaseUnit;
@Excel(name = "采购提醒量")
private BigDecimal purchaseReminderQuantity;
@Excel(name = "补货周期单位")
private String replenishmentCycleUnit;
@Excel(name = "补货周期数值")
private BigDecimal replenishmentCycleValue;
@Excel(name = "主供应商")
private String mainSupplier;
@Excel(name = "采购单位库存单位换算")
private BigDecimal purchaseUnitInventoryConversion;
@Excel(name = "有限期单位")
private String expirationUnit;
@Excel(name = "有限期值")
private BigDecimal expirationValue;
@Excel(name = "信用期单位")
private String creditTermUnit;
@Excel(name = "信用期数值")
private BigDecimal creditTermValue;
@Excel(name = "包装单位")
private String packagingUnit;
@Excel(name = "品号库位号")
private String productLocationNumber;
@Excel(name = "自定义字段3")
private String customField3;
@Excel(name = "自定义字段4")
private String customField4;
@Excel(name = "自定义字段5")
private String customField5;
@Excel(name = "包装单位库存单位换算")
private BigDecimal packagingUnitInventoryConversion;
@Excel(name = "修磨成本")
private BigDecimal sharpeningCost;
@Excel(name = "自定义字段8")
private BigDecimal customField8;
@Excel(name = "自定义字段9")
private BigDecimal customField9;
@Excel(name = "自定义字段10")
private BigDecimal customField10;
@Excel(name = "录入人")
private String entryPerson;
@Excel(name = "录入时间")
private Date entryTime;
}

View File

@ -0,0 +1,24 @@
package com.ktg.mes.stl.mapper;
import com.ktg.common.annotation.DataSource;
import com.ktg.common.enums.DataSourceType;
import com.ktg.mes.md.domain.AP0AD;
import com.ktg.mes.stl.domain.InventoryAdjustment;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface InventoryAdjustmentMapper {
@DataSource(DataSourceType.SQLSERVER)
List<InventoryAdjustment> selectOutNewData();
@DataSource(DataSourceType.SQLSERVER)
List<InventoryAdjustment> selectInNewData();
@DataSource(DataSourceType.SQLSERVER)
int updateOutDataToOld(InventoryAdjustment inventoryAdjustment);
@DataSource(DataSourceType.SQLSERVER)
int updateInDataToOld(InventoryAdjustment inventoryAdjustment);
}

View File

@ -0,0 +1,18 @@
package com.ktg.mes.stl.mapper;
import com.ktg.common.annotation.DataSource;
import com.ktg.common.enums.DataSourceType;
import com.ktg.mes.md.domain.AP0AD;
import com.ktg.mes.stl.domain.StlMaterial;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author luo26
*/
@Mapper
public interface StlMaterialMapper {
@DataSource(DataSourceType.SQLSERVER)
List<StlMaterial> selectList();
}

View File

@ -95,6 +95,11 @@ public class UcmCtBaseController extends BaseController {
}
}
@PostMapping("/open/add")
public String openAdd(@RequestBody UcmCtBase ucmCtBase) {
return ucmCtBaseService.addUcmCtBase(ucmCtBase);
}
/**
* 查询料箱管理列表
*/

View File

@ -1,31 +1,24 @@
package com.ktg.mes.wm.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ktg.common.constant.UserConstants;
import com.ktg.mes.wm.domain.vo.WmStorageLocationVo;
import com.ktg.mes.wm.service.IWmStorageAreaService;
import com.ktg.mes.wm.utils.WmBarCodeUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ktg.common.annotation.Log;
import com.ktg.common.constant.UserConstants;
import com.ktg.common.core.controller.BaseController;
import com.ktg.common.core.domain.AjaxResult;
import com.ktg.common.enums.BusinessType;
import com.ktg.mes.wm.domain.WmStorageLocation;
import com.ktg.mes.wm.service.IWmStorageLocationService;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.common.core.page.TableDataInfo;
import com.ktg.common.enums.BusinessType;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.mes.wm.domain.WmStorageLocation;
import com.ktg.mes.wm.domain.vo.WmStorageLocationVo;
import com.ktg.mes.wm.service.IWmStorageAreaService;
import com.ktg.mes.wm.service.IWmStorageLocationService;
import com.ktg.mes.wm.utils.WmBarCodeUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 库区设置Controller
@ -35,8 +28,7 @@ import com.ktg.common.core.page.TableDataInfo;
*/
@RestController
@RequestMapping("/mes/wm/location")
public class WmStorageLocationController extends BaseController
{
public class WmStorageLocationController extends BaseController {
@Autowired
private IWmStorageLocationService wmStorageLocationService;
@ -50,8 +42,7 @@ public class WmStorageLocationController extends BaseController
* 查询库区设置列表
*/
@GetMapping("/list")
public TableDataInfo list(WmStorageLocation wmStorageLocation)
{
public TableDataInfo list(WmStorageLocation wmStorageLocation) {
startPage();
List<WmStorageLocationVo> list = wmStorageLocationService.selectWmStorageLocationListVo(wmStorageLocation);
return getDataTable(list);
@ -63,8 +54,7 @@ public class WmStorageLocationController extends BaseController
@PreAuthorize("@ss.hasPermi('mes:wm:location:export')")
@Log(title = "库区设置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WmStorageLocation wmStorageLocation)
{
public void export(HttpServletResponse response, WmStorageLocation wmStorageLocation) {
List<WmStorageLocation> list = wmStorageLocationService.selectWmStorageLocationList(wmStorageLocation);
ExcelUtil<WmStorageLocation> util = new ExcelUtil<WmStorageLocation>(WmStorageLocation.class);
util.exportExcel(response, list, "库区设置数据");
@ -75,8 +65,7 @@ public class WmStorageLocationController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('mes:wm:location:query')")
@GetMapping(value = "/{locationId}")
public AjaxResult getInfo(@PathVariable("locationId") Long locationId)
{
public AjaxResult getInfo(@PathVariable("locationId") Long locationId) {
return AjaxResult.success(wmStorageLocationService.selectWmStorageLocationVoByLocationId(locationId));
}
@ -86,8 +75,7 @@ public class WmStorageLocationController extends BaseController
@PreAuthorize("@ss.hasPermi('mes:wm:location:add')")
@Log(title = "库区设置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WmStorageLocation wmStorageLocation)
{
public AjaxResult add(@RequestBody WmStorageLocation wmStorageLocation) {
if (UserConstants.NOT_UNIQUE.equals(wmStorageLocationService.checkLocationCodeUnique(wmStorageLocation))) {
return AjaxResult.error("库区编码已存在!");
}
@ -105,8 +93,7 @@ public class WmStorageLocationController extends BaseController
@PreAuthorize("@ss.hasPermi('mes:wm:location:edit')")
@Log(title = "库区设置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WmStorageLocation wmStorageLocation)
{
public AjaxResult edit(@RequestBody WmStorageLocation wmStorageLocation) {
return toAjax(wmStorageLocationService.updateWmStorageLocation(wmStorageLocation));
}
@ -117,8 +104,7 @@ public class WmStorageLocationController extends BaseController
@Log(title = "库区设置", businessType = BusinessType.DELETE)
@Transactional
@DeleteMapping("/{locationIds}")
public AjaxResult remove(@PathVariable Long[] locationIds)
{
public AjaxResult remove(@PathVariable Long[] locationIds) {
//TODO:库区删除之前的逻辑校验
for (Long locationId : locationIds

View File

@ -1,38 +1,33 @@
package com.ktg.mes.wm.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ktg.common.annotation.Log;
import com.ktg.common.core.controller.BaseController;
import com.ktg.common.core.domain.AjaxResult;
import com.ktg.common.enums.BusinessType;
import com.ktg.mes.wm.domain.WmsInPlan;
import com.ktg.mes.wm.service.IWmsInPlanService;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.common.core.page.TableDataInfo;
import com.ktg.common.enums.BusinessType;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.mes.wm.domain.WmsInPlan;
import com.ktg.mes.wm.domain.dto.WmsInboundOrderDto;
import com.ktg.mes.wm.service.IWmsInPlanService;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.List;
/**
* 入库计划Controller
*
* @author yinjinlu
* @author Kelvin
* @date 2024-10-31
*/
@RestController
@RequestMapping("/wm/PLAN")
@RequiredArgsConstructor
public class WmsInPlanController extends BaseController {
@Autowired
private IWmsInPlanService wmsInPlanService;
private final IWmsInPlanService wmsInPlanService;
/**
* 查询入库计划列表
@ -45,6 +40,14 @@ public class WmsInPlanController extends BaseController {
return getDataTable(list);
}
/**
* 同步小型刀具库数据
*/
@GetMapping(value = "/sync")
public AjaxResult sync() {
return AjaxResult.success(wmsInPlanService.asyncSmallKnifeData());
}
/**
* 导出入库计划列表
*/
@ -62,7 +65,7 @@ public class WmsInPlanController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('wm:PLAN:query')")
@GetMapping(value = "/{planId}")
public AjaxResult getInfo(@PathVariable("planId") String planId) {
public AjaxResult getInfo(@PathVariable("planId") Long planId) {
return AjaxResult.success(wmsInPlanService.selectWmsInPlanByPlanId(planId));
}
@ -79,9 +82,17 @@ public class WmsInPlanController extends BaseController {
@Log(title = "入库计划", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WmsInPlan wmsInPlan) {
wmsInPlanService.autoCell(wmsInPlan);
return toAjax(wmsInPlanService.insertWmsInPlan(wmsInPlan));
}
@Log(title = "入库计划", businessType = BusinessType.INSERT)
@PostMapping("/open/order/add")
public AjaxResult openOrderAdd(@RequestBody @Valid WmsInboundOrderDto wmsInboundOrderDto) {
wmsInPlanService.insertOrderWmsInPlan(wmsInboundOrderDto);
return AjaxResult.success("入库任务创建成功");
}
/**
* 修改入库计划
*/

View File

@ -1,27 +1,38 @@
package com.ktg.mes.wm.controller;
import com.alibaba.fastjson.JSON;
import com.ktg.common.annotation.Log;
import com.ktg.common.core.controller.BaseController;
import com.ktg.common.core.domain.AjaxResult;
import com.ktg.common.core.domain.BaseEntity;
import com.ktg.common.core.page.TableDataInfo;
import com.ktg.common.enums.BusinessType;
import com.ktg.common.utils.DateUtils;
import com.ktg.common.utils.StringUtils;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.mes.cal.utils.CalendarUtil;
import com.ktg.mes.md.domain.*;
import com.ktg.mes.md.service.IBaseKnifeService;
import com.ktg.mes.md.service.IMdItemService;
import com.ktg.mes.wm.domain.*;
import com.ktg.mes.wm.service.*;
import lombok.RequiredArgsConstructor;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import static com.ktg.generator.util.MultiModuleCodeGenerator.generateTaskCode;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
import java.util.stream.Stream;
import com.ktg.mes.wm.mapper.*;
import com.ktg.mes.md.mapper.*;
@ -33,51 +44,27 @@ import com.ktg.mes.md.mapper.*;
*/
@RestController
@RequestMapping("/wm/wmsInTask")
@RequiredArgsConstructor
public class WmsInTaskController extends BaseController {
@Autowired
private IWmsInTaskService wmsInTaskService;
@Autowired
private IWmsInPlanService wmsInPlanService;
@Autowired
private IWmsZdTaskService wmsZdTaskService;
@Autowired
private IMdItemService mdItemService;
@Autowired
private IBaseKnifeService baseKnifeService;
@Autowired
private IWmStorageAreaService wmStorageAreaService;
@Autowired
private IWmsInPlanDetailEntityService wmsInPlanDetailEntityService;
@Autowired
private WmsOutPlanMapper wmsOutPlanMapper;
@Autowired
private WmsOutPlanDetailEntityMapper wmsOutPlanDetailEntityMapper;
@Autowired
private WmsOutTaskMapper wmsOutTaskMapper;
@Autowired
private ProductionArrangementsMapper productionArrangementsMapper;
@Autowired
private BaseKnifeMapper baseKnifeMapper;
@Autowired
private BomRouteMapper bomRouteMapper;
@Autowired
private MdItemMapper mdItemMapper;
@Autowired
private BaseTechnologyBomMapper baseTechnologyBomMapper;
@Autowired
private WmsZdTaskMapper wmsZdTaskMapper;
@Autowired
private WmStorageAreaMapper wmStorageAreaMapper;
private final IWmsInTaskService wmsInTaskService;
private final IWmsInPlanService wmsInPlanService;
private final IWmsZdTaskService wmsZdTaskService;
private final IMdItemService mdItemService;
private final IBaseKnifeService baseKnifeService;
private final IWmStorageAreaService wmStorageAreaService;
private final IWmsInPlanDetailEntityService wmsInPlanDetailEntityService;
private final WmsOutPlanMapper wmsOutPlanMapper;
private final WmsOutPlanDetailEntityMapper wmsOutPlanDetailEntityMapper;
private final WmsOutTaskMapper wmsOutTaskMapper;
private final ProductionArrangementsMapper productionArrangementsMapper;
private final BaseKnifeMapper baseKnifeMapper;
private final BomRouteMapper bomRouteMapper;
private final MdItemMapper mdItemMapper;
private final BaseTechnologyBomMapper baseTechnologyBomMapper;
private final WmsZdTaskMapper wmsZdTaskMapper;
private final WmStorageAreaMapper wmStorageAreaMapper;
private final BaseKnifeLockedMapper baseKnifeLockedMapper;
private final MyConfig myConfig;
/**
* 查询入库任务列表
@ -90,13 +77,26 @@ public class WmsInTaskController extends BaseController {
return getDataTable(list);
}
/**
* 查询入库任务
*/
@GetMapping("/open/rfid/{rfid}")
public AjaxResult byRfid(@PathVariable String rfid) {
WmsInTask wmsInTask = wmsInTaskService.selectWmsInTaskByRfid(rfid);
if (wmsInTask == null) {
return AjaxResult.error("查询不到相关的入库任务");
}
return AjaxResult.success(wmsInTask);
}
/**
* 查询入库任务列表
*/
@GetMapping("/open/list")
public TableDataInfo openList(WmsInTask wmsInTask) {
startPage();
List<WmsInTask> list = wmsInTaskService.selectWmsInTaskList(wmsInTask);
List<WmsInTask> list = wmsInTaskService.selectWmsInTaskListOpen(wmsInTask);
return getDataTable(list);
}
@ -159,7 +159,7 @@ public class WmsInTaskController extends BaseController {
@PostMapping("/open/issueBatch/{ids}")
@ResponseBody
@Transactional
public AjaxResult issueBatch(@PathVariable String[] ids) {
public AjaxResult issueBatch(@PathVariable String[] ids) throws IOException {
for (String taskId : ids) {
// 获取任务信息
WmsInTask wmsInTask = wmsInTaskService.selectWmsInTaskById(taskId);
@ -220,7 +220,7 @@ public class WmsInTaskController extends BaseController {
baseKnife.setCreateTime(DateUtils.getNowDate());
baseKnifeService.updateBaseKnife(baseKnife);
});
} else if (Objects.equals(wmsInTask.getPlanTypeId(), "9")) {
} else if (Objects.equals(wmsInTask.getPlanTypeId(), "9") || Objects.equals(wmsInTask.getPlanTypeCode(), "ZDHK")) {
// 入库类型为整刀回库
wmsInPlanDetailEntityList.forEach(planDetailEntity -> {
BaseKnife baseKnife = baseKnifeService.selectBaseKnifeByBaseKnifeId(planDetailEntity.getKnifeId());
@ -239,8 +239,51 @@ public class WmsInTaskController extends BaseController {
}
// 更新台账状态
baseKnifeService.updateBaseKnife(baseKnife);
// 判断物料是否有绑定了订单
if (baseKnife.getPlanSheet() != null) {
// 获取台账锁定实体并将状态设置为已完成
BaseKnifeLocked baseKnifeLockedWrapper = new BaseKnifeLocked();
baseKnifeLockedWrapper.setStatus(0);
baseKnifeLockedWrapper.setBaseKnifeId(baseKnife.getBaseKnifeId());
baseKnifeLockedWrapper.setPlanSheet(baseKnife.getPlanSheet());
List<BaseKnifeLocked> baseKnifeLockedList = baseKnifeLockedMapper.selectBaseKnifeLockedList(baseKnifeLockedWrapper);
// 获取实体并修改状态
BaseKnifeLocked baseKnifeLocked;
if (!baseKnifeLockedList.isEmpty()) {
baseKnifeLocked = baseKnifeLockedList.get(0);
baseKnifeLocked.setStatus(1);
baseKnifeLockedMapper.updateBaseKnifeLocked(baseKnifeLocked);
}
// 再次查询物料是否有预订订单
baseKnifeLockedWrapper.setPlanSheet(null);
baseKnifeLockedList = baseKnifeLockedMapper.selectBaseKnifeLockedList(baseKnifeLockedWrapper);
if (!baseKnifeLockedList.isEmpty()) {
baseKnifeLocked = baseKnifeLockedList.get(0);
baseKnife.setPlanSheet(baseKnifeLocked.getPlanSheet());
baseKnife.setIsLocked(1);
baseKnife.setLockedStartTime(baseKnifeLocked.getLockedStartTime());
baseKnife.setLockedEndTime(baseKnifeLocked.getLockedEndTime());
baseKnifeService.updateBaseKnife(baseKnife);
// 检测订单是否完成完成则出库整刀
if (this.checkFinal(baseKnifeLocked.getPlanSheet())) {
try {
this.createOutTask(baseKnifeLocked.getPlanSheet());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
} else {
// 订单解绑
baseKnife.setPlanSheet("");
baseKnifeService.updateBaseKnife(baseKnife);
}
}
});
} else if (Objects.equals(wmsInTask.getPlanTypeId(), "15")) {
} else if (Objects.equals(wmsInTask.getPlanTypeId(), "15") || Objects.equals(wmsInTask.getPlanTypeCode(), "CDHK")) {
// 拆刀回库
wmsInPlanDetailEntityList.forEach(planDetailEntity -> {
BaseKnife baseKnife = baseKnifeService.selectBaseKnifeByBaseKnifeId(planDetailEntity.getKnifeId());
@ -257,7 +300,7 @@ public class WmsInTaskController extends BaseController {
baseKnifeService.updateBaseKnife(bladeOpt.get());
}
});
} else if (Objects.equals(wmsInTask.getPlanTypeId(), "7")) {
} else if (Objects.equals(wmsInTask.getPlanTypeId(), "7") || Objects.equals(wmsInTask.getPlanTypeCode(), "DBRK")) {
// 入库类型为刀柄入库
wmsInPlanDetailEntityList.forEach(planDetailEntity -> {
// 生成台账
@ -334,14 +377,14 @@ public class WmsInTaskController extends BaseController {
// 检查订单完成状态
@Transactional
public void createOutTask(String planSheet){
public void createOutTask(String planSheet) throws IOException {
// 构建出库计划
WmsOutPlan outPlan = new WmsOutPlan();
outPlan.setPlanCode(planSheet);
outPlan.setWmsBusinessTypeId(16L);
outPlan.setPlanState("1");
outPlan.setPlanType("ZDCK");
outPlan.setCreateBy(getUsername());
// outPlan.setCreateBy(getUsername());
outPlan.setCreateTime(DateUtils.getNowDate());
wmsOutPlanMapper.insertWmsOutPlan(outPlan);
@ -360,7 +403,8 @@ public class WmsInTaskController extends BaseController {
baseKnifeWrapper.setPlanSheet(planSheet);
baseKnifeWrapper.setKnifeCode(technologyBom.getKnifeCode());
List<BaseKnife> baseKnifeLockedList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper);
if (baseKnifeLockedList.size() == technologyBom.getKnifeCount()) baseKnifeResultList.addAll(baseKnifeLockedList);
if (baseKnifeLockedList.size() == technologyBom.getKnifeCount())
baseKnifeResultList.addAll(baseKnifeLockedList);
}
String batchNum = "SCZBPC01";
@ -449,5 +493,70 @@ public class WmsInTaskController extends BaseController {
productionArrangements.setStatus(1);
productionArrangementsMapper.updateProductionArrangements(productionArrangements);
// 给产线控制系统发指令
this.productionArrangementsIsOk(productionArrangements);
}
// 调用生产准备完成接口
public void productionArrangementsIsOk(ProductionArrangements productionArrangements) throws IOException {
// 产线控制系统生产准备完成接口
String url = myConfig.getProductionControlPath() + "/cutterapi/cutComplete";
// 请求客户端
OkHttpClient client = new OkHttpClient();
// 构建请求数据
Map<String, Object> requestMap = new HashMap<>();
requestMap.put("prodordercode", productionArrangements.getPlanSheet());
requestMap.put("result", "0");
requestMap.put("completetime", CalendarUtil.getDateTimeStr());
// 获取工艺信息
BaseTechnologyBom technologyBomWrapper = new BaseTechnologyBom();
technologyBomWrapper.setTechnologyCode(productionArrangements.getTechnologyCode());
List<BaseTechnologyBom> technologyBomList = baseTechnologyBomMapper.selectBaseTechnologyBomList(technologyBomWrapper);
BaseKnife baseKnifeWrapper = new BaseKnife();
baseKnifeWrapper.setPlanSheet(productionArrangements.getPlanSheet());
// 获取刀具信息
List<Map<String, String>> cutterList = new ArrayList<>();
technologyBomList.forEach(baseTechnologyBom -> {
baseKnifeWrapper.setKnifeCode(baseTechnologyBom.getKnifeCode());
List<BaseKnife> baseKnifeList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper);
baseKnifeList.forEach(baseKnife -> {
Map<String, String> map = new HashMap<>();
map.put("specno", baseTechnologyBom.getProcessCode());
map.put("code", baseKnife.getKnifeCode());
map.put("name", baseKnife.getKnifeName());
map.put("life", baseKnife.getKnifeLife().toString());
cutterList.add(map);
});
});
requestMap.put("cutterinfo", cutterList);
// 构建请求数据
MediaType mediaType = MediaType.parse("application/json; charset=utf-8");
okhttp3.RequestBody requestBody = okhttp3.RequestBody.create(mediaType, JSON.toJSONString(requestMap));
// 请求体
Request request = new Request.Builder()
.url(url)
.post(requestBody)
.build();
// 发送请求
try (Response response = client.newCall(request).execute()) {
if (!response.isSuccessful())
throw new IOException("Unexpected code " + response);
// 请求响应
String responseBody = response.body().string();
System.out.println(responseBody);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

View File

@ -1,10 +1,12 @@
package com.ktg.mes.wm.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;
import java.util.Date;
import java.util.List;
/**
@ -28,12 +30,17 @@ public class ProductionArrangements extends BaseEntity
@Excel(name = "工艺编码")
private String technologyCode;
// @Excel(name = "工序号")
// private List<String> processCodes;
@Excel(name = "加工单元")
private String processUnit;
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
/** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
/** 状态 */
@Excel(name = "状态")
private Integer status;
@ -94,13 +101,21 @@ public class ProductionArrangements extends BaseEntity
this.processUnit = processUnit;
}
// public List<String> getProcessCodes() {
// return processCodes;
// }
//
// public void setProcessCodes(List<String> processCodes) {
// this.processCodes = processCodes;
// }
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public Integer getStatus()
{

View File

@ -1,6 +1,7 @@
package com.ktg.mes.wm.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
@ -12,151 +13,167 @@ import com.ktg.common.core.domain.BaseEntity;
* @author yinjinlu
* @date 2022-05-08
*/
public class WmStorageArea extends BaseEntity
{
public class WmStorageArea extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 库位ID */
/**
* 库位ID
*/
private Long areaId;
/** 库位编码 */
/**
* 库位编码
*/
@Excel(name = "库位编码")
private String areaCode;
/** 库位名称 */
/**
* 库位名称
*/
@Excel(name = "库位名称")
private String areaName;
/** 库区ID */
/**
* 库区ID
*/
@Excel(name = "库区ID")
private Long locationId;
/** 面积 */
/**
* 面积
*/
@Excel(name = "面积")
private BigDecimal area;
/** 最大载重量 */
/**
* 最大载重量
*/
@Excel(name = "最大载重量")
private BigDecimal maxLoa;
/** 库位位置X */
/**
* 库位位置X
*/
@Excel(name = "库位位置X")
private Long positionX;
/** 库位位置y */
/**
* 库位位置y
*/
@Excel(name = "库位位置y")
private Long positionY;
/** 库位位置z */
/**
* 库位位置z
*/
@Excel(name = "库位位置z")
private Long positionZ;
/** 是否启用 */
/**
* 是否启用
*/
@Excel(name = "是否启用")
private String enableFlag;
private String frozenFlag;
/** 预留字段1 */
/**
* 预留字段1
*/
private String attr1;
/** 预留字段2 */
/**
* 预留字段2
*/
private String attr2;
/** 预留字段3 */
/**
* 预留字段3 - 为空或者0表示普通空间-1表示大空间
*/
private Long attr3;
/** 预留字段4 */
/**
* 预留字段4 - 为空或者0表示启用-1表示禁用
*/
private Long attr4;
public void setAreaId(Long areaId)
{
public void setAreaId(Long areaId) {
this.areaId = areaId;
}
public Long getAreaId()
{
public Long getAreaId() {
return areaId;
}
public void setAreaCode(String areaCode)
{
public void setAreaCode(String areaCode) {
this.areaCode = areaCode;
}
public String getAreaCode()
{
public String getAreaCode() {
return areaCode;
}
public void setAreaName(String areaName)
{
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public String getAreaName()
{
public String getAreaName() {
return areaName;
}
public void setLocationId(Long locationId)
{
public void setLocationId(Long locationId) {
this.locationId = locationId;
}
public Long getLocationId()
{
public Long getLocationId() {
return locationId;
}
public void setArea(BigDecimal area)
{
public void setArea(BigDecimal area) {
this.area = area;
}
public BigDecimal getArea()
{
public BigDecimal getArea() {
return area;
}
public void setMaxLoa(BigDecimal maxLoa)
{
public void setMaxLoa(BigDecimal maxLoa) {
this.maxLoa = maxLoa;
}
public BigDecimal getMaxLoa()
{
public BigDecimal getMaxLoa() {
return maxLoa;
}
public void setPositionX(Long positionX)
{
public void setPositionX(Long positionX) {
this.positionX = positionX;
}
public Long getPositionX()
{
public Long getPositionX() {
return positionX;
}
public void setPositionY(Long positionY)
{
public void setPositionY(Long positionY) {
this.positionY = positionY;
}
public Long getPositionY()
{
public Long getPositionY() {
return positionY;
}
public void setPositionZ(Long positionZ)
{
public void setPositionZ(Long positionZ) {
this.positionZ = positionZ;
}
public Long getPositionZ()
{
public Long getPositionZ() {
return positionZ;
}
public void setEnableFlag(String enableFlag)
{
public void setEnableFlag(String enableFlag) {
this.enableFlag = enableFlag;
}
public String getEnableFlag()
{
public String getEnableFlag() {
return enableFlag;
}
@ -168,40 +185,35 @@ public class WmStorageArea extends BaseEntity
this.frozenFlag = frozenFlag;
}
public void setAttr1(String attr1)
{
public void setAttr1(String attr1) {
this.attr1 = attr1;
}
public String getAttr1()
{
public String getAttr1() {
return attr1;
}
public void setAttr2(String attr2)
{
public void setAttr2(String attr2) {
this.attr2 = attr2;
}
public String getAttr2()
{
public String getAttr2() {
return attr2;
}
public void setAttr3(Long attr3)
{
public void setAttr3(Long attr3) {
this.attr3 = attr3;
}
public Long getAttr3()
{
public Long getAttr3() {
return attr3;
}
public void setAttr4(Long attr4)
{
public void setAttr4(Long attr4) {
this.attr4 = attr4;
}
public Long getAttr4()
{
public Long getAttr4() {
return attr4;
}

View File

@ -1,7 +1,10 @@
package com.ktg.mes.wm.domain;
import java.util.Date;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
@ -13,6 +16,8 @@ import com.ktg.common.core.domain.BaseEntity;
* @author yinjinlu
* @date 2024-10-31
*/
@Getter
@Setter
public class WmsInPlan extends BaseEntity {
private static final long serialVersionUID = 1L;
@ -55,7 +60,7 @@ public class WmsInPlan extends BaseEntity {
* 计划日期
*/
@Excel(name = "计划日期")
private String expectDate;
private Date expectDate;
/**
* 发布人
@ -158,210 +163,15 @@ public class WmsInPlan extends BaseEntity {
*/
private String planTypeCode;
/**
* 库区编码
*/
private String locationCode;
/**
* 入库计划明细信息
*/
private List<WmsInPlanDetails> wmsInPlanDetailsList;
public void setPlanId(Long planId) {
this.planId = planId;
}
public Long getPlanId() {
return planId;
}
public void setState(String state) {
this.state = state;
}
public String getState() {
return state;
}
public void setSourceType(String sourceType) {
this.sourceType = sourceType;
}
public String getSourceType() {
return sourceType;
}
public void setWareId(String wareId) {
this.wareId = wareId;
}
public String getWareId() {
return wareId;
}
public void setCellCode(String cellCode) {
this.cellCode = cellCode;
}
public String getCellCode() {
return cellCode;
}
public void setWorkOrderCode(String workOrderCode) {
this.workOrderCode = workOrderCode;
}
public String getWorkOrderCode() {
return workOrderCode;
}
public void setExpectDate(String expectDate) {
this.expectDate = expectDate;
}
public String getExpectDate() {
return expectDate;
}
public void setPublishName(String publishName) {
this.publishName = publishName;
}
public String getPublishName() {
return publishName;
}
public void setPublishTime(String publishTime) {
this.publishTime = publishTime;
}
public String getPublishTime() {
return publishTime;
}
public void setCloserId(String closerId) {
this.closerId = closerId;
}
public String getCloserId() {
return closerId;
}
public void setCloseTime(String closeTime) {
this.closeTime = closeTime;
}
public String getCloseTime() {
return closeTime;
}
public void setRelBillCode(String relBillCode) {
this.relBillCode = relBillCode;
}
public String getRelBillCode() {
return relBillCode;
}
public void setCustomerId(String customerId) {
this.customerId = customerId;
}
public String getCustomerId() {
return customerId;
}
public void setPoCode(String poCode) {
this.poCode = poCode;
}
public String getPoCode() {
return poCode;
}
public void setDepartmentId(String departmentId) {
this.departmentId = departmentId;
}
public String getDepartmentId() {
return departmentId;
}
public void setContractNo(String contractNo) {
this.contractNo = contractNo;
}
public String getContractNo() {
return contractNo;
}
public void setSupplierId(String supplierId) {
this.supplierId = supplierId;
}
public String getSupplierId() {
return supplierId;
}
public void setBusinessTypeId(String businessTypeId) {
this.businessTypeId = businessTypeId;
}
public String getBusinessTypeId() {
return businessTypeId;
}
public void setSrcOutTaskId(String srcOutTaskId) {
this.srcOutTaskId = srcOutTaskId;
}
public String getSrcOutTaskId() {
return srcOutTaskId;
}
public void setIsActive(String isActive) {
this.isActive = isActive;
}
public String getIsActive() {
return isActive;
}
public void setIsDelete(String isDelete) {
this.isDelete = isDelete;
}
public String getIsDelete() {
return isDelete;
}
public void setPlanCode(String planCode) {
this.planCode = planCode;
}
public String getPlanCode() {
return planCode;
}
public void setPlanTypeId(Long planTypeId) {
this.planTypeId = planTypeId;
}
public Long getPlanTypeId() {
return planTypeId;
}
public String getPlanTypeCode() {
return planTypeCode;
}
public void setPlanTypeCode(String planTypeCode) {
this.planTypeCode = planTypeCode;
}
public List<WmsInPlanDetails> getWmsInPlanDetailsList() {
return wmsInPlanDetailsList;
}
public void setWmsInPlanDetailsList(List<WmsInPlanDetails> wmsInPlanDetailsList) {
this.wmsInPlanDetailsList = wmsInPlanDetailsList;
}
private List<WmsInPlanDetail> wmsInPlanDetailList;
@Override
public String toString() {
@ -395,7 +205,7 @@ public class WmsInPlan extends BaseEntity {
.append("planCode", getPlanCode())
.append("planTypeId", getPlanTypeId())
.append("planTypeCode", getPlanTypeCode())
.append("wmsInPlanDetailsList", getWmsInPlanDetailsList())
.append("wmsInPlanDetailsList", getWmsInPlanDetailList())
.toString();
}
}

View File

@ -1,5 +1,7 @@
package com.ktg.mes.wm.domain;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
@ -13,7 +15,9 @@ import java.util.List;
* @author yinjinlu
* @date 2024-10-31
*/
public class WmsInPlanDetails extends BaseEntity
@Setter
@Getter
public class WmsInPlanDetail extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ -60,103 +64,6 @@ public class WmsInPlanDetails extends BaseEntity
private List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList;
public void setDetailsId(Long detailsId) {
this.detailsId = detailsId;
}
public Long getDetailsId()
{
return detailsId;
}
public void setPlanId(Long planId) {
this.planId = planId;
}
public Long getPlanId() {
return planId;
}
public void setMaterialId(String materialId)
{
this.materialId = materialId;
}
public String getMaterialId()
{
return materialId;
}
public void setBatch(String batch)
{
this.batch = batch;
}
public String getBatch()
{
return batch;
}
public void setCellId(Long cellId)
{
this.cellId = cellId;
}
public Long getCellId()
{
return cellId;
}
public void setQuantity(String quantity)
{
this.quantity = quantity;
}
public String getQuantity()
{
return quantity;
}
public void setQuantityIn(String quantityIn)
{
this.quantityIn = quantityIn;
}
public String getQuantityIn()
{
return quantityIn;
}
public void setPlanInStatus(String planInStatus)
{
this.planInStatus = planInStatus;
}
public String getPlanInStatus()
{
return planInStatus;
}
public void setIsActivy(String isActivy)
{
this.isActivy = isActivy;
}
public String getIsActivy()
{
return isActivy;
}
public void setIsDelete(String isDelete)
{
this.isDelete = isDelete;
}
public String getIsDelete()
{
return isDelete;
}
public List<WmsInPlanDetailEntity> getWmsInPlanDetailEntityList() {
return wmsInPlanDetailEntityList;
}
public void setWmsInPlanDetailEntityList(List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList) {
this.wmsInPlanDetailEntityList = wmsInPlanDetailEntityList;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -1,5 +1,7 @@
package com.ktg.mes.wm.domain;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
@ -13,6 +15,8 @@ import java.util.List;
* @author yinjinlu
* @date 2024-11-01
*/
@Setter
@Getter
public class WmsInTask extends BaseEntity {
private static final long serialVersionUID = 1L;
@ -31,7 +35,7 @@ public class WmsInTask extends BaseEntity {
* 入库计划id
*/
@Excel(name = "入库计划id")
private String planInId;
private Long planInId;
/**
* 任务数量
@ -141,206 +145,6 @@ public class WmsInTask extends BaseEntity {
private List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList;
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setTaskInCode(String taskInCode) {
this.taskInCode = taskInCode;
}
public String getTaskInCode() {
return taskInCode;
}
public void setPlanInId(String planInId) {
this.planInId = planInId;
}
public String getPlanInId() {
return planInId;
}
public void setTaskInQuantity(Integer taskInQuantity) {
this.taskInQuantity = taskInQuantity;
}
public Integer getTaskInQuantity() {
return taskInQuantity;
}
public void setActualInQuantity(Integer actualInQuantity) {
this.actualInQuantity = actualInQuantity;
}
public Integer getActualInQuantity() {
return actualInQuantity;
}
public void setCellTgt(Long cellTgt) {
this.cellTgt = cellTgt;
}
public Long getCellTgt() {
return cellTgt;
}
public void setCellOrig(String cellOrig) {
this.cellOrig = cellOrig;
}
public String getCellOrig() {
return cellOrig;
}
public String getCellName() {
return cellName;
}
public void setCellName(String cellName) {
this.cellName = cellName;
}
public String getCellCode() {
return cellCode;
}
public void setCellCode(String cellCode) {
this.cellCode = cellCode;
}
public String getCellX() {
return cellX;
}
public void setCellX(String cellX) {
this.cellX = cellX;
}
public String getCellY() {
return cellY;
}
public void setCellY(String cellY) {
this.cellY = cellY;
}
public String getCellZ() {
return cellZ;
}
public void setCellZ(String cellZ) {
this.cellZ = cellZ;
}
public void setIsActive(String isActive) {
this.isActive = isActive;
}
public String getIsActive() {
return isActive;
}
public void setIsDelete(String isDelete) {
this.isDelete = isDelete;
}
public String getIsDelete() {
return isDelete;
}
public void setBatch(String batch) {
this.batch = batch;
}
public String getBatch() {
return batch;
}
public void setMaterialId(String materialId) {
this.materialId = materialId;
}
public String getMaterialId() {
return materialId;
}
public void setPlanTypeId(String planTypeId) {
this.planTypeId = planTypeId;
}
public String getPlanTypeId() {
return planTypeId;
}
public void setPlanInStatus(String planInStatus) {
this.planInStatus = planInStatus;
}
public String getPlanInStatus() {
return planInStatus;
}
public void setPlanInCode(String planInCode) {
this.planInCode = planInCode;
}
public String getPlanInCode() {
return planInCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialCode() {
return materialCode;
}
public Long getDetailInId() {
return detailInId;
}
public void setDetailInId(Long detailInId) {
this.detailInId = detailInId;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public String getMaterialUnit() {
return materialUnit;
}
public void setMaterialUnit(String materialUnit) {
this.materialUnit = materialUnit;
}
public List<WmsInPlanDetailEntity> getWmsInPlanDetailEntityList() {
return wmsInPlanDetailEntityList;
}
public void setWmsInPlanDetailEntityList(List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList) {
this.wmsInPlanDetailEntityList = wmsInPlanDetailEntityList;
}
public String getPlanTypeCode() {
return planTypeCode;
}
public void setPlanTypeCode(String planTypeCode) {
this.planTypeCode = planTypeCode;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -0,0 +1,32 @@
package com.ktg.mes.wm.domain.dto;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
// 根据订单入库
@Getter
@Setter
public class WmsInboundOrderDto {
// 订单号
@NotBlank(message = "订单号不能为空")
private String orderId;
// 物料编码
@NotBlank(message = "物料编码不能为空")
private String materialCode;
private String rfid;
// 出库类型编码
@NotBlank(message = "入库类型编码不能为空")
private String typeCode;
// 出库数量
@NotNull(message = "入库数量不能为空")
@Min(value = 1, message = "数量必须大于等于 1")
private Integer quantity;
// 消耗寿命
@Min(value = 0, message = "消耗寿命值必须大于等于 0")
private Integer consumesLife;
}

View File

@ -2,6 +2,7 @@ package com.ktg.mes.wm.mapper;
import java.util.List;
import com.ktg.mes.wm.domain.ProductionArrangements;
import org.apache.ibatis.annotations.Mapper;
/**
* 生产准备记录Mapper接口
@ -9,6 +10,7 @@ import com.ktg.mes.wm.domain.ProductionArrangements;
* @author yinjinlu
* @date 2024-11-18
*/
@Mapper
public interface ProductionArrangementsMapper
{
/**

View File

@ -3,6 +3,7 @@ package com.ktg.mes.wm.mapper;
import java.util.List;
import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.domain.vo.AreaVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
/**
@ -11,6 +12,7 @@ import org.apache.ibatis.annotations.Select;
* @author yinjinlu
* @date 2022-05-08
*/
@Mapper
public interface WmStorageAreaMapper
{
/**

View File

@ -1,8 +1,10 @@
package com.ktg.mes.wm.mapper;
import java.util.List;
import com.ktg.mes.wm.domain.WmStorageLocation;
import com.ktg.mes.wm.domain.vo.WmStorageLocationVo;
import org.apache.ibatis.annotations.Mapper;
/**
* 库区设置Mapper接口
@ -10,8 +12,8 @@ import com.ktg.mes.wm.domain.vo.WmStorageLocationVo;
* @author yinjinlu
* @date 2022-05-07
*/
public interface WmStorageLocationMapper
{
@Mapper
public interface WmStorageLocationMapper {
/**
* 查询库区设置
*
@ -30,6 +32,7 @@ public interface WmStorageLocationMapper
/**
* 根据库区编码查询库区
*
* @param locationCode
* @return
*/
@ -53,8 +56,8 @@ public interface WmStorageLocationMapper
public WmStorageLocation checkLocationCodeUnique(WmStorageLocation wmStorageLocation);
public WmStorageLocation checkLocationNameUnique(WmStorageLocation wmStorageLocation);
public WmStorageLocation checkLocationNameUnique(WmStorageLocation wmStorageLocation);
/**
@ -91,6 +94,7 @@ public interface WmStorageLocationMapper
/**
* 根据仓库删除对应的库区
*
* @param warehouseId
* @return
*/

View File

@ -1,7 +1,9 @@
package com.ktg.mes.wm.mapper;
import java.util.List;
import com.ktg.mes.wm.domain.WmWarehouse;
import org.apache.ibatis.annotations.Mapper;
/**
* 仓库设置Mapper接口
@ -9,8 +11,8 @@ import com.ktg.mes.wm.domain.WmWarehouse;
* @author yinjinlu
* @date 2022-05-07
*/
public interface WmWarehouseMapper
{
@Mapper
public interface WmWarehouseMapper {
/**
* 查询仓库设置
*
@ -21,6 +23,7 @@ public interface WmWarehouseMapper
/**
* 根据编码查询仓库
*
* @param warehouseCdoe
* @return
*/
@ -38,6 +41,7 @@ public interface WmWarehouseMapper
public List<WmWarehouse> getTreeList();
public WmWarehouse checkWarehouseCodeUnique(WmWarehouse wmWarehouse);
public WmWarehouse checkWarehouseNameUnique(WmWarehouse wmWarehouse);
/**

View File

@ -2,6 +2,7 @@ package com.ktg.mes.wm.mapper;
import java.util.List;
import com.ktg.mes.wm.domain.WmsInPlanDetailEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 入库计划明细实体Mapper接口
@ -9,6 +10,7 @@ import com.ktg.mes.wm.domain.WmsInPlanDetailEntity;
* @author yinjinlu
* @date 2024-11-05
*/
@Mapper
public interface WmsInPlanDetailEntityMapper
{
/**

View File

@ -2,7 +2,8 @@ package com.ktg.mes.wm.mapper;
import java.util.List;
import com.ktg.mes.wm.domain.WmsInPlan;
import com.ktg.mes.wm.domain.WmsInPlanDetails;
import com.ktg.mes.wm.domain.WmsInPlanDetail;
import org.apache.ibatis.annotations.Mapper;
/**
* 入库计划Mapper接口
@ -10,6 +11,7 @@ import com.ktg.mes.wm.domain.WmsInPlanDetails;
* @author yinjinlu
* @date 2024-10-31
*/
@Mapper
public interface WmsInPlanMapper
{
/**
@ -18,7 +20,7 @@ public interface WmsInPlanMapper
* @param planId 入库计划主键
* @return 入库计划
*/
public WmsInPlan selectWmsInPlanByPlanId(String planId);
public WmsInPlan selectWmsInPlanByPlanId(Long planId);
/**
* 查询入库计划列表
@ -71,10 +73,10 @@ public interface WmsInPlanMapper
/**
* 批量新增入库计划明细
*
* @param wmsInPlanDetailsList 入库计划明细列表
* @param wmsInPlanDetailList 入库计划明细列表
* @return 结果
*/
public int batchWmsInPlanDetails(List<WmsInPlanDetails> wmsInPlanDetailsList);
public int batchWmsInPlanDetails(List<WmsInPlanDetail> wmsInPlanDetailList);
/**
@ -94,5 +96,5 @@ public interface WmsInPlanMapper
*/
public Boolean isDuplicatePlanCode(String planCode);
WmsInPlanDetails selectWmsInPlanDetailById(Long planDetailsId);
WmsInPlanDetail selectWmsInPlanDetailById(Long planDetailsId);
}

View File

@ -3,6 +3,7 @@ package com.ktg.mes.wm.mapper;
import java.util.List;
import com.ktg.mes.wm.domain.WmsInTask;
import com.ktg.mes.wm.domain.WmsZdTask;
import org.apache.ibatis.annotations.Mapper;
/**
* 入库任务Mapper接口
@ -10,6 +11,7 @@ import com.ktg.mes.wm.domain.WmsZdTask;
* @author yinjinlu
* @date 2024-11-01
*/
@Mapper
public interface WmsInTaskMapper
{
/**

View File

@ -2,6 +2,7 @@ package com.ktg.mes.wm.mapper;
import java.util.List;
import com.ktg.mes.wm.domain.WmsZdTask;
import org.apache.ibatis.annotations.Mapper;
/**
* 组装任务Mapper接口
@ -9,6 +10,7 @@ import com.ktg.mes.wm.domain.WmsZdTask;
* @author yinjinlu
* @date 2024-11-01
*/
@Mapper
public interface WmsZdTaskMapper
{
/**

View File

@ -71,4 +71,6 @@ public interface IUcmCtBaseService
String uploadTempBoxListInfo(List<RfidCard> rfidCardList);
String uploadTempBoxItemListInfo(List<RfidCard> rfidCardList);
String addUcmCtBase(UcmCtBase ucmCtBase);
}

View File

@ -1,17 +1,18 @@
package com.ktg.mes.wm.service;
import java.util.List;
import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.domain.WmStorageLocation;
import com.ktg.mes.wm.domain.vo.WmStorageLocationVo;
import java.util.List;
/**
* 库区设置Service接口
*
* @author yinjinlu
* @date 2022-05-07
*/
public interface IWmStorageLocationService
{
public interface IWmStorageLocationService {
/**
* 查询库区设置
*
@ -31,6 +32,7 @@ public interface IWmStorageLocationService
/**
* 根据库区编码查询库区
*
* @param locationCode
* @return
*/
@ -55,6 +57,7 @@ public interface IWmStorageLocationService
/**
* 检查库区编码是否唯一
*
* @param wmStorageLocation
* @return
*/
@ -62,6 +65,7 @@ public interface IWmStorageLocationService
/**
* 检查库区名称是否唯一
*
* @param wmStorageLocation
* @return
*/
@ -101,8 +105,18 @@ public interface IWmStorageLocationService
/**
* 根据仓库删除对应的库区
*
* @param warehouseId
* @return
*/
public int deleteByWarehouseId(Long warehouseId);
/**
* 查询一个库位
*
* @param code 库区编码
* @param isBig 是否大件
* @return 库位
*/
WmStorageArea queryOneAreaByLocationCode(String code, Boolean isBig);
}

View File

@ -2,6 +2,7 @@ package com.ktg.mes.wm.service;
import java.util.List;
import com.ktg.mes.wm.domain.WmsInPlan;
import com.ktg.mes.wm.domain.dto.WmsInboundOrderDto;
/**
* 入库计划Service接口
@ -17,7 +18,7 @@ public interface IWmsInPlanService
* @param planId 入库计划主键
* @return 入库计划
*/
public WmsInPlan selectWmsInPlanByPlanId(String planId);
public WmsInPlan selectWmsInPlanByPlanId(Long planId);
WmsInPlan selectWmsInPlanByPlanCode(String planCode);
@ -29,6 +30,8 @@ public interface IWmsInPlanService
*/
public List<WmsInPlan> selectWmsInPlanList(WmsInPlan wmsInPlan);
public int asyncSmallKnifeData();
/**
* 新增入库计划
*
@ -67,4 +70,29 @@ public interface IWmsInPlanService
* @return 是否重复
*/
public Boolean isDuplicatePlanCode(String planCode);
/**
* 执行入库计划
*
* @param planId 入库计划ID
*/
public void issueWmsInPlan(Long planId);
/**
* 创建并执行入库计划
* @param wmsInPlan 入库计划
*/
public void insertAndIssueWmsInPlan(WmsInPlan wmsInPlan);
/**
* 分配库位
* @param wmsInPlan 入库计划
*/
public void autoCell(WmsInPlan wmsInPlan);
/**
* 根据订单创建入库计划
* @param wmsInboundOrderDto 入库计划参数
*/
public void insertOrderWmsInPlan(WmsInboundOrderDto wmsInboundOrderDto);
}

View File

@ -19,6 +19,14 @@ public interface IWmsInTaskService
*/
public WmsInTask selectWmsInTaskById(String id);
/**
* 查询入库任务
*
* @param rfid rfid
* @return 入库任务
*/
public WmsInTask selectWmsInTaskByRfid(String rfid);
/**
* 查询入库任务列表
*
@ -27,6 +35,14 @@ public interface IWmsInTaskService
*/
public List<WmsInTask> selectWmsInTaskList(WmsInTask wmsInTask);
/**
* 查询入库任务列表 开放
*
* @param wmsInTask 入库任务
* @return 入库任务集合
*/
public List<WmsInTask> selectWmsInTaskListOpen(WmsInTask wmsInTask);
/**
* 新增入库任务
*
@ -58,4 +74,6 @@ public interface IWmsInTaskService
* @return 结果
*/
public int deleteWmsInTaskById(String id);
public int issueBatch(String[] ids);
}

View File

@ -1,7 +1,6 @@
package com.ktg.mes.wm.service.impl;
import com.alibaba.fastjson.JSON;
import com.ktg.common.core.redis.RedisCache;
import com.ktg.common.utils.DateUtils;
import com.ktg.mes.md.domain.BaseKnife;
import com.ktg.mes.md.mapper.BaseKnifeMapper;
@ -14,12 +13,10 @@ import com.ktg.mes.wm.domain.box.RfidCard;
import com.ktg.mes.wm.mapper.UcmCtBaseMapper;
import com.ktg.mes.wm.service.IUcmCtBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import static org.apache.commons.lang3.SystemUtils.getUserName;
@ -203,16 +200,15 @@ public class UcmCtBaseServiceImpl implements IUcmCtBaseService {
BaseKnife baseKnifeQuery = new BaseKnife();
baseKnifeQuery.setRfid(boxItem.getBoxItemRfid().trim());
List<BaseKnife> baseKnifeList = baseKnifeMapper.selectBaseKnifeList(baseKnifeQuery);
List<BaseKnife> baseKnifeList = baseKnifeMapper.selectBaseKnifeNotValidList(baseKnifeQuery);
if (baseKnifeList.isEmpty())
throw new RuntimeException(String.format("绑定失败,物料“%s”不存在", boxItem.getBoxItemRfid().trim()));
UcmCtMaterial ucmCtMaterialQuery = new UcmCtMaterial();
ucmCtMaterialQuery.setCtBaseId(Long.parseLong(ucmCtBaseList.get(0).getCtBaseId()));
ucmCtMaterialQuery.setBaseKnifeId(baseKnifeList.get(0).getBaseKnifeId());
List<UcmCtMaterial> ucmCtMaterialList = ucmCtMaterialMapper2.selectUcmCtMaterialList(ucmCtMaterialQuery);
if (!ucmCtMaterialList.isEmpty())
throw new RuntimeException(String.format("绑定失败,物料“%s”已经绑定料箱“%s”", boxItem.getBoxItemRfid().trim(), box.getBoxRfid().trim()));
throw new RuntimeException(String.format("绑定失败,物料“%s”已经被其它料箱绑定", boxItem.getBoxItemRfid().trim()));
UcmCtMaterial ucmCtMaterial = new UcmCtMaterial();
ucmCtMaterial.setCtBaseId(Long.parseLong(ucmCtBaseList.get(0).getCtBaseId()));
@ -230,7 +226,7 @@ public class UcmCtBaseServiceImpl implements IUcmCtBaseService {
BaseKnife baseKnifeQuery = new BaseKnife();
baseKnifeQuery.setRfid(boxItem.getBoxItemRfid().trim());
List<BaseKnife> baseKnifeList = baseKnifeMapper.selectBaseKnifeList(baseKnifeQuery);
List<BaseKnife> baseKnifeList = baseKnifeMapper.selectBaseKnifeNotValidList(baseKnifeQuery);
if (baseKnifeList.isEmpty())
throw new RuntimeException(String.format("解绑失败,物料“%s”不存在", boxItem.getBoxItemRfid().trim()));
@ -265,4 +261,16 @@ public class UcmCtBaseServiceImpl implements IUcmCtBaseService {
System.out.println("==============================================");
return "OK";
}
@Override
public String addUcmCtBase(UcmCtBase ucmCtBase) {
UcmCtBase ucmCtBaseQuery = new UcmCtBase();
ucmCtBaseQuery.setCode(ucmCtBase.getCode());
if (!ucmCtBaseMapper.selectUcmCtBaseList(ucmCtBaseQuery).isEmpty())
return "新增失败,该料箱已经存在";
ucmCtBase.setCreateTime(DateUtils.getNowDate());
ucmCtBase.setCreateBy(getUserName());
ucmCtBaseMapper.insertUcmCtBase(ucmCtBase);
return "OK";
}
}

View File

@ -1,17 +1,20 @@
package com.ktg.mes.wm.service.impl;
import java.util.List;
import com.ktg.common.constant.UserConstants;
import com.ktg.common.utils.DateUtils;
import com.ktg.common.utils.StringUtils;
import com.ktg.mes.md.mapper.BaseKnifeMapper;
import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.domain.WmStorageLocation;
import com.ktg.mes.wm.domain.vo.WmStorageLocationVo;
import org.apache.catalina.User;
import com.ktg.mes.wm.mapper.WmStorageAreaMapper;
import com.ktg.mes.wm.mapper.WmStorageLocationMapper;
import com.ktg.mes.wm.service.IWmStorageLocationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktg.mes.wm.mapper.WmStorageLocationMapper;
import com.ktg.mes.wm.domain.WmStorageLocation;
import com.ktg.mes.wm.service.IWmStorageLocationService;
import java.util.List;
import java.util.stream.Collectors;
/**
* 库区设置Service业务层处理
@ -20,11 +23,16 @@ import com.ktg.mes.wm.service.IWmStorageLocationService;
* @date 2022-05-07
*/
@Service
public class WmStorageLocationServiceImpl implements IWmStorageLocationService
{
public class WmStorageLocationServiceImpl implements IWmStorageLocationService {
@Autowired
private WmStorageLocationMapper wmStorageLocationMapper;
@Autowired
private BaseKnifeMapper baseKnifeMapper;
@Autowired
private WmStorageAreaMapper wmStorageAreaMapper;
/**
* 查询库区设置
*
@ -32,8 +40,7 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
* @return 库区设置
*/
@Override
public WmStorageLocation selectWmStorageLocationByLocationId(Long locationId)
{
public WmStorageLocation selectWmStorageLocationByLocationId(Long locationId) {
return wmStorageLocationMapper.selectWmStorageLocationByLocationId(locationId);
}
@ -44,10 +51,10 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
* @return 库区设置
*/
@Override
public WmStorageLocationVo selectWmStorageLocationVoByLocationId(Long locationId)
{
public WmStorageLocationVo selectWmStorageLocationVoByLocationId(Long locationId) {
return wmStorageLocationMapper.selectWmStorageLocationByVoLocationId(locationId);
}
@Override
public WmStorageLocation selectWmStorageLocationByLocationCode(String locationCode) {
return wmStorageLocationMapper.selectWmStorageLocationByLocationCode(locationCode);
@ -60,8 +67,7 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
* @return 库区设置
*/
@Override
public List<WmStorageLocation> selectWmStorageLocationList(WmStorageLocation wmStorageLocation)
{
public List<WmStorageLocation> selectWmStorageLocationList(WmStorageLocation wmStorageLocation) {
return wmStorageLocationMapper.selectWmStorageLocationList(wmStorageLocation);
}
@ -72,8 +78,7 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
* @return 库区设置
*/
@Override
public List<WmStorageLocationVo> selectWmStorageLocationListVo(WmStorageLocation wmStorageLocation)
{
public List<WmStorageLocationVo> selectWmStorageLocationListVo(WmStorageLocation wmStorageLocation) {
return wmStorageLocationMapper.selectWmStorageLocationListVo(wmStorageLocation);
}
@ -104,8 +109,7 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
* @return 结果
*/
@Override
public int insertWmStorageLocation(WmStorageLocation wmStorageLocation)
{
public int insertWmStorageLocation(WmStorageLocation wmStorageLocation) {
wmStorageLocation.setCreateTime(DateUtils.getNowDate());
return wmStorageLocationMapper.insertWmStorageLocation(wmStorageLocation);
}
@ -117,8 +121,7 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
* @return 结果
*/
@Override
public int updateWmStorageLocation(WmStorageLocation wmStorageLocation)
{
public int updateWmStorageLocation(WmStorageLocation wmStorageLocation) {
wmStorageLocation.setUpdateTime(DateUtils.getNowDate());
return wmStorageLocationMapper.updateWmStorageLocation(wmStorageLocation);
}
@ -130,8 +133,7 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
* @return 结果
*/
@Override
public int deleteWmStorageLocationByLocationIds(Long[] locationIds)
{
public int deleteWmStorageLocationByLocationIds(Long[] locationIds) {
return wmStorageLocationMapper.deleteWmStorageLocationByLocationIds(locationIds);
}
@ -142,8 +144,7 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
* @return 结果
*/
@Override
public int deleteWmStorageLocationByLocationId(Long locationId)
{
public int deleteWmStorageLocationByLocationId(Long locationId) {
return wmStorageLocationMapper.deleteWmStorageLocationByLocationId(locationId);
}
@ -151,4 +152,27 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
public int deleteByWarehouseId(Long warehouseId) {
return wmStorageLocationMapper.deleteByWarehouseId(warehouseId);
}
@Override
public WmStorageArea queryOneAreaByLocationCode(String code, Boolean isBig) {
// 获取库区
WmStorageLocation wmStorageLocationByCode = this.wmStorageLocationMapper.selectWmStorageLocationByLocationCode(code);
if (wmStorageLocationByCode == null) throw new RuntimeException("自动获取库位失败,该库区不存在");
// 获取台账中已经使用的库位编码
List<String> selectNotEmptyAreaCodeList = this.baseKnifeMapper.selectNotEmptyAreaCodeList();
// 获取库位列表
WmStorageArea wmStorageAreaQuery = new WmStorageArea();
wmStorageAreaQuery.setLocationId(wmStorageLocationByCode.getLocationId());
wmStorageAreaQuery.setAttr3(isBig ? 1L : 0L);
List<WmStorageArea> wmStorageAreaList = this.wmStorageAreaMapper.selectWmStorageAreaList(wmStorageAreaQuery).stream()
// 过滤掉全部存在物品的库位
.filter(it -> !selectNotEmptyAreaCodeList.contains(it.getAreaCode()))
.collect(Collectors.toList());
if (wmStorageAreaList.isEmpty()) throw new RuntimeException("自动获取库位失败,无可用库位");
// 返回第一个可用的库位
return wmStorageAreaList.get(0);
}
}

Some files were not shown because too many files have changed in this diff Show More