Merge remote-tracking branch 'origin/0.8.X' into 0.8.X
This commit is contained in:
147
README.md
147
README.md
@@ -1,146 +1 @@
|
|||||||
## 平台简介
|
下面我需要你写前端手机端uniapp web管理端
|
||||||
[](https://gitee.com/KonBAI-Q/klp-flowable-plus/stargazers)
|
|
||||||
[](https://github.com/KonBAI-Q/KLP/stargazers)
|
|
||||||
[](https://gitee.com/KonBAI-Q/klp-flowable-plus/blob/master/LICENSE)
|
|
||||||
[](https://www.jetbrains.com)
|
|
||||||
[]()
|
|
||||||
[]()
|
|
||||||
[]()
|
|
||||||
|
|
||||||
- 本项目基于 [RuoYi-Vue-Plus](https://gitee.com/dromara/RuoYi-Vue-Plus) 进行二次开发,采用 `Flowable` 扩展工作流应用场景,支持在线表单设计和丰富的工作流程设计能力。
|
|
||||||
- 本项目主要针对`Flowable`工作流场景开发,脚手架功能同步更新 [RuoYi-Vue-Plus](https://gitee.com/dromara/RuoYi-Vue-Plus) 项目。
|
|
||||||
- 采用`MIT开源协议`,完全免费给个人及企业使用。
|
|
||||||
- 项目处于开发阶段,工作流流程还存在不足。因此,目前仅推荐用于学习、毕业设计等个人使用。
|
|
||||||
|
|
||||||
## 赞助商
|
|
||||||
[](http://ccflow.org/?frm=KonBAI)
|
|
||||||
|
|
||||||
## 参考文档
|
|
||||||
- 项目文档:[RuoYi-Flowable-Plus开发文档](http://rfp-doc.konbai.work)
|
|
||||||
- 项目文档(备用):[RuoYi-Flowable-Plus开发文档](http://159.75.158.189:81/)
|
|
||||||
- 脚手架文档:[RuoYi-Vue-Plus文档](https://gitee.com/dromara/RuoYi-Vue-Plus/wikis/pages)
|
|
||||||
|
|
||||||
## 项目地址
|
|
||||||
- Gitee:<https://gitee.com/KonBAI-Q/klp-flowable-plus>
|
|
||||||
- GitHub:<https://github.com/KonBAI-Q/KLP>
|
|
||||||
|
|
||||||
## 在线演示
|
|
||||||
演示服务不限制CURD操作,希望大家按需使用,不要恶意添加脏数据或对服务器进行攻击等操作。(将不定期清理数据)
|
|
||||||
|
|
||||||
[KLP 在线演示](http://159.75.158.189/)
|
|
||||||
|
|
||||||
| | 账号 | 密码 |
|
|
||||||
|---------------- | ----- | -------- |
|
|
||||||
| 超管账户 | admin | admin123 |
|
|
||||||
| 监控中心(未运行) | klp | 123456 |
|
|
||||||
| 任务调度中心 | admin | 123456 |
|
|
||||||
| 数据监控中心 | klp | 123456 |
|
|
||||||
|
|
||||||
## 技术交流群
|
|
||||||
|
|
||||||
交流1群 🈵️ [](https://jq.qq.com/?_wv=1027\&k=PYDZa1tA) </br>
|
|
||||||
交流2群 🈵️ [](https://jq.qq.com/?_wv=1027&k=J4zeZaKo) </br>
|
|
||||||
交流3群 🈵️ [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=NfqIsFMASOvIC6yHYwY6bnaSfdgcD1La&authKey=SeFDA4oFkb%2FkdvnI%2FJ3aJTJZkyzDaz8v8gybpzUATAilnKSCmyKhCE6R2jkXc5e2&noverify=0&group_code=860980043) </br>
|
|
||||||
交流4群 [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=RBXhJKfZT0GSjEPa0CcViGmP_mnVE82j&authKey=J9shEDSoCujDRJO9wcpqzsbvCQskcEvo0idGd54I0uk735K90HhA0v5ywEkUdxK3&noverify=0&group_code=683510042) </br>
|
|
||||||
|
|
||||||
## 参与开源
|
|
||||||
- 如遇到问题,欢迎提交到 [issues](https://gitee.com/KonBAI-Q/klp-flowable-plus/issues)(请按模版进行填写信息)。
|
|
||||||
- 欢迎提交 [PR](https://gitee.com/KonBAI-Q/klp-flowable-plus/pulls) ,注意请提交到 `develop` 开发分支 统一测试发版。
|
|
||||||
|
|
||||||
## 特别鸣谢
|
|
||||||
- [RuoYi-Vue-Plus](https://gitee.com/dromara/RuoYi-Vue-Plus)
|
|
||||||
- [RuoYi-flowable](https://gitee.com/tony2y/RuoYi-flowable)
|
|
||||||
- [bpmn-process-designer](https://gitee.com/MiyueSC/bpmn-process-designer)
|
|
||||||
|
|
||||||
## 支持项目
|
|
||||||
如果项目对你有帮助,请给项目点个Star。也可以通过下方二维码请作者喝一杯奶茶!
|
|
||||||

|
|
||||||
|
|
||||||
## 友情链接
|
|
||||||
- [玩转RuoYi-Cloud-Plus - Flowable基础](https://blog.csdn.net/zhaozhiqiang1981/article/details/129240406):文档包含Flowable基础知识、项目使用说明、源码解析等。(新人必看)
|
|
||||||
- [基于若依的Flowable工作流实战](https://space.bilibili.com/400188320/channel/collectiondetail?sid=1002899):Flowable视频学习专栏,项目基本覆盖了Flowable的方方面面,也拓展了很多为了达到生产级别项目而附加的表结构,工具类等知识点!
|
|
||||||
|
|
||||||
## 推荐图书
|
|
||||||
- 大家在使用本项目时,推荐结合贺波老师的书[《深入Flowable流程引擎:核心原理与高阶实战》](https://item.jd.com/14804836.html)学习。这本书得到了Flowable创始人Tijs Rademakers亲笔作序推荐,对系统学习和深入掌握Flowable的用法非常有帮助。
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
- 大家在使用本项目时,推荐结合贺波老师的书[《深入Activiti流程引擎:核心原理与高阶实战》](https://item.m.jd.com/product/13928958.html?gx=RnAomTM2bmCImZxDqYAkVCoIHuIYVqc),这本书对系统学习和深入掌握Activiti/Flowable的用法非常有帮助。
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## 演示图例
|
|
||||||
<table style="width:100%; text-align:center">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<span>登录页面</span>
|
|
||||||
<img src="https://images.gitee.com/uploads/images/2022/0424/164043_74b57010_5096840.png" alt="登录页面"/>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<span>用户管理</span>
|
|
||||||
<img src="https://images.gitee.com/uploads/images/2022/0424/164236_2de3b8da_5096840.png" alt="用户管理"/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<span>流程分类</span>
|
|
||||||
<img src="https://images.gitee.com/uploads/images/2022/0424/164839_ca79b066_5096840.png" alt="流程分类"/>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<span>流程表单</span>
|
|
||||||
<img src="https://images.gitee.com/uploads/images/2022/0424/165118_688209fd_5096840.png" alt="流程表单"/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<span>流程定义</span>
|
|
||||||
<img src="https://images.gitee.com/uploads/images/2022/0424/165916_825a85c8_5096840.png" alt="流程定义"/>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<span>流程发起</span>
|
|
||||||
<img src="https://images.gitee.com/uploads/images/2022/0424/171409_ffb0faf3_5096840.png" alt="流程发起"/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<span>表单设计</span>
|
|
||||||
<img src="https://images.gitee.com/uploads/images/2022/0424/172933_7222c0f2_5096840.png" alt="表单设计"/>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<span>流程设计</span>
|
|
||||||
<img src="https://images.gitee.com/uploads/images/2022/0424/165827_44fa412b_5096840.png" alt="流程设计"/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<span>发起流程</span>
|
|
||||||
<img src="https://images.gitee.com/uploads/images/2022/0424/171651_4639254b_5096840.png" alt="发起流程"/>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<span>待办任务</span>
|
|
||||||
<img src="https://images.gitee.com/uploads/images/2022/0424/171916_7ba22063_5096840.png" alt="代办任务"/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<span>任务办理</span>
|
|
||||||
<img src="https://images.gitee.com/uploads/images/2022/0424/172204_04753399_5096840.png" alt="任务办理"/>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<span>流转记录</span>
|
|
||||||
<img src="https://images.gitee.com/uploads/images/2022/0424/172350_179e8341_5096840.png" alt="流转记录"/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<span>流程跟踪</span>
|
|
||||||
<img src="https://images.gitee.com/uploads/images/2022/0424/172547_fe7414d4_5096840.png" alt="流程跟踪"/>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<span>流程完结</span>
|
|
||||||
<img src="https://images.gitee.com/uploads/images/2022/0424/173159_8cc57e74_5096840.png" alt="流程完结"/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
@@ -58,9 +58,9 @@ spring:
|
|||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
||||||
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
||||||
url: jdbc:mysql://140.143.206.120:13306/klp-oa?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
|
url: jdbc:mysql://140.143.206.120:3306/klp-oa?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
|
||||||
username: klp
|
username: klp
|
||||||
password: KeLunPu@123
|
password: KeLunPu123@
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
slave:
|
slave:
|
||||||
lazy: true
|
lazy: true
|
||||||
|
|||||||
66
klp-ui/src/api/wms/coil.js
Normal file
66
klp-ui/src/api/wms/coil.js
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询钢卷物料表列表
|
||||||
|
export function listMaterialCoil(query) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/materialCoil/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function exportMaterialCoil(query) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/materialCoil/export',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getMaterialCoil(CoilMaterialId) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/materialCoil/' + CoilMaterialId,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function addMaterialCoil(data) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/materialCoil',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateMaterialCoil(data) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/materialCoil',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 简单更新钢卷物料表
|
||||||
|
export function updateMaterialCoilSimple(data) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/materialCoil/update',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除钢卷物料表
|
||||||
|
export function delMaterialCoil(CoilMaterialId) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/materialCoil/' + CoilMaterialId,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 钢卷溯源查询
|
||||||
|
export function getMaterialCoilTrace(CoilMaterialId) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/materialCoil/trace/' + CoilMaterialId,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -53,3 +53,12 @@ export function getStockTrace(batchNo) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询库存分布, 传入itemId和itemType,查询库存总量和在各个库存的分布数量
|
||||||
|
export function getStockDistribution(params) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/stock/distribution',
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
401
klp-ui/src/views/wms/coil/index.vue
Normal file
401
klp-ui/src/views/wms/coil/index.vue
Normal file
@@ -0,0 +1,401 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px">
|
||||||
|
<el-form-item label="入场钢卷号" prop="enterCoilNo">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.enterCoilNo"
|
||||||
|
placeholder="请输入入场钢卷号"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="当前钢卷号" prop="currentCoilNo">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.currentCoilNo"
|
||||||
|
placeholder="请输入当前钢卷号"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="厂家卷号" prop="supplierCoilNo">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.supplierCoilNo"
|
||||||
|
placeholder="请输入厂家原料卷号"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="班组" prop="team">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.team"
|
||||||
|
placeholder="请输入班组"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="el-icon-edit"
|
||||||
|
size="mini"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
>转移</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="mini"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="handleExport"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="materialCoilList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="入场钢卷号" align="center" prop="enterCoilNo" />
|
||||||
|
<el-table-column label="当前钢卷号" align="center" prop="currentCoilNo" />
|
||||||
|
<el-table-column label="厂家原料卷号" align="center" prop="supplierCoilNo" />
|
||||||
|
<el-table-column label="数据类型" align="center" prop="dataType">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.dataType == 0 ? '历史数据' : '当前数据' }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<!-- <el-table-column label="所在库区ID" align="center" prop="warehouseId" /> -->
|
||||||
|
<!-- <el-table-column label="下一库区ID" align="center" prop="nextWarehouseId" /> -->
|
||||||
|
<!-- <el-table-column label="关联二维码ID" align="center" prop="qrcodeRecordId" /> -->
|
||||||
|
<el-table-column label="二维码">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<QRCode
|
||||||
|
v-if="scope.row.dataType == 1"
|
||||||
|
:content="scope.row.qrcodeRecordId"
|
||||||
|
:size="50"
|
||||||
|
/>
|
||||||
|
<!-- <el-image
|
||||||
|
:src="scope.row.qrcodeUrl"
|
||||||
|
:preview-src-list="[scope.row.qrcodeUrl]"
|
||||||
|
fit="contain"
|
||||||
|
style="width: 50px; height: 50px;"
|
||||||
|
/> -->
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="班组" align="center" prop="team" />
|
||||||
|
<!-- <el-table-column label="是否合卷/分卷" align="center" prop="hasMergeSplit" /> -->
|
||||||
|
<!-- <el-table-column label="父卷号" align="center" prop="parentCoilNos" /> -->
|
||||||
|
<!-- <el-table-column label="物品ID" align="center" prop="itemId" /> -->
|
||||||
|
<!-- <el-table-column label="物品类型" align="center" prop="itemType" /> -->
|
||||||
|
<!-- <el-table-column label="状态" align="center" prop="status" /> -->
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
>转移</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改钢卷物料对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="入场钢卷号" prop="enterCoilNo">
|
||||||
|
<el-input v-model="form.enterCoilNo" placeholder="请输入入场钢卷号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="当前钢卷号" prop="currentCoilNo">
|
||||||
|
<el-input v-model="form.currentCoilNo" placeholder="请输入当前钢卷号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="厂家原料卷号" prop="supplierCoilNo">
|
||||||
|
<el-input v-model="form.supplierCoilNo" placeholder="请输入厂家原料卷号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="所在库区ID" prop="warehouseId">
|
||||||
|
<warehouse-select v-model="form.warehouseId" placeholder="请选择仓库/库区/库位" style="width: 100%;" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="下一库区ID" prop="nextWarehouseId">
|
||||||
|
<el-input v-model="form.nextWarehouseId" placeholder="请输入下一库区ID" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="关联二维码ID" prop="qrcodeRecordId">
|
||||||
|
<el-input v-model="form.qrcodeRecordId" placeholder="请输入关联二维码ID" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="班组" prop="team">
|
||||||
|
<el-input v-model="form.team" placeholder="请输入班组" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否合卷/分卷" prop="hasMergeSplit">
|
||||||
|
<el-input v-model="form.hasMergeSplit" placeholder="请输入是否合卷/分卷" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="父卷号" prop="parentCoilNos">
|
||||||
|
<el-input v-model="form.parentCoilNos" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="物品类型" prop="itemType">
|
||||||
|
<el-input v-model="form.itemType" placeholder="请输入物品类型" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="物品ID" prop="itemId">
|
||||||
|
<el-input v-model="form.itemId" placeholder="请输入物品ID" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listMaterialCoil, getMaterialCoil, delMaterialCoil, addMaterialCoil, updateMaterialCoil } from "@/api/wms/coil";
|
||||||
|
import WarehouseSelect from "@/components/WarehouseSelect";
|
||||||
|
import QRCode from "../print/components/QRCode.vue";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "MaterialCoil",
|
||||||
|
components: {
|
||||||
|
WarehouseSelect,
|
||||||
|
QRCode
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 按钮loading
|
||||||
|
buttonLoading: false,
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 钢卷物料表格数据
|
||||||
|
materialCoilList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
enterCoilNo: undefined,
|
||||||
|
currentCoilNo: undefined,
|
||||||
|
supplierCoilNo: undefined,
|
||||||
|
dataType: undefined,
|
||||||
|
warehouseId: undefined,
|
||||||
|
nextWarehouseId: undefined,
|
||||||
|
qrcodeRecordId: undefined,
|
||||||
|
team: undefined,
|
||||||
|
hasMergeSplit: undefined,
|
||||||
|
parentCoilNos: undefined,
|
||||||
|
itemId: undefined,
|
||||||
|
itemType: undefined,
|
||||||
|
status: undefined,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
enterCoilNo: [
|
||||||
|
{ required: true, message: "入场钢卷号不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
currentCoilNo: [
|
||||||
|
{ required: true, message: "当前钢卷号不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
supplierCoilNo: [
|
||||||
|
{ required: true, message: "厂家原料卷号不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
warehouseId: [
|
||||||
|
{ required: true, message: "所在库区ID不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
team: [
|
||||||
|
{ required: true, message: "班组不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
itemId: [
|
||||||
|
{ required: true, message: "物品ID不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
itemType: [
|
||||||
|
{ required: true, message: "物品类型不能为空", trigger: "change" }
|
||||||
|
],
|
||||||
|
remark: [
|
||||||
|
{ required: true, message: "备注不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询钢卷物料列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listMaterialCoil(this.queryParams).then(response => {
|
||||||
|
this.materialCoilList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
coilId: undefined,
|
||||||
|
enterCoilNo: undefined,
|
||||||
|
currentCoilNo: undefined,
|
||||||
|
supplierCoilNo: undefined,
|
||||||
|
dataType: undefined,
|
||||||
|
warehouseId: undefined,
|
||||||
|
nextWarehouseId: undefined,
|
||||||
|
qrcodeRecordId: undefined,
|
||||||
|
team: undefined,
|
||||||
|
hasMergeSplit: undefined,
|
||||||
|
parentCoilNos: undefined,
|
||||||
|
itemId: undefined,
|
||||||
|
itemType: undefined,
|
||||||
|
status: undefined,
|
||||||
|
remark: undefined,
|
||||||
|
delFlag: undefined,
|
||||||
|
createTime: undefined,
|
||||||
|
createBy: undefined,
|
||||||
|
updateTime: undefined,
|
||||||
|
updateBy: undefined
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.coilId)
|
||||||
|
this.single = selection.length!==1
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加钢卷物料";
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.loading = true;
|
||||||
|
this.reset();
|
||||||
|
const coilId = row.coilId || this.ids
|
||||||
|
getMaterialCoil(coilId).then(response => {
|
||||||
|
this.loading = false;
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改钢卷物料";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
this.buttonLoading = true;
|
||||||
|
if (this.form.coilId != null) {
|
||||||
|
updateMaterialCoil(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
}).finally(() => {
|
||||||
|
this.buttonLoading = false;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addMaterialCoil(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
}).finally(() => {
|
||||||
|
this.buttonLoading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const coilIds = row.coilId || this.ids;
|
||||||
|
this.$modal.confirm('是否确认删除钢卷物料编号为"' + coilIds + '"的数据项?').then(() => {
|
||||||
|
this.loading = true;
|
||||||
|
return delMaterialCoil(coilIds);
|
||||||
|
}).then(() => {
|
||||||
|
this.loading = false;
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {
|
||||||
|
}).finally(() => {
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download('system/materialCoil/export', {
|
||||||
|
...this.queryParams
|
||||||
|
}, `materialCoil_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -6,6 +6,7 @@ import com.klp.common.annotation.ExcelDictFormat;
|
|||||||
import com.klp.common.convert.ExcelDictConvert;
|
import com.klp.common.convert.ExcelDictConvert;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -152,6 +153,11 @@ public class WmsMaterialCoilVo {
|
|||||||
*/
|
*/
|
||||||
private Object product; // 产品VO待定义
|
private Object product; // 产品VO待定义
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BOM列表(原材料对应的BOM项目信息)
|
||||||
|
*/
|
||||||
|
private List<WmsBomItemVo> bomItemList;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.klp.common.helper.LoginHelper;
|
||||||
import com.klp.common.utils.StringUtils;
|
import com.klp.common.utils.StringUtils;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -17,6 +18,10 @@ import com.klp.domain.vo.WmsMaterialCoilVo;
|
|||||||
import com.klp.domain.vo.WmsGenerateRecordVo;
|
import com.klp.domain.vo.WmsGenerateRecordVo;
|
||||||
import com.klp.domain.vo.WmsWarehouseVo;
|
import com.klp.domain.vo.WmsWarehouseVo;
|
||||||
import com.klp.domain.vo.WmsRawMaterialVo;
|
import com.klp.domain.vo.WmsRawMaterialVo;
|
||||||
|
import com.klp.domain.vo.WmsProductBomVo;
|
||||||
|
import com.klp.domain.vo.WmsBomItemVo;
|
||||||
|
import com.klp.domain.bo.WmsProductBomBo;
|
||||||
|
import com.klp.domain.bo.WmsBomItemBo;
|
||||||
import com.klp.domain.WmsMaterialCoil;
|
import com.klp.domain.WmsMaterialCoil;
|
||||||
import com.klp.domain.WmsStock;
|
import com.klp.domain.WmsStock;
|
||||||
import com.klp.domain.bo.WmsStockBo;
|
import com.klp.domain.bo.WmsStockBo;
|
||||||
@@ -28,6 +33,8 @@ import com.klp.service.IWmsStockService;
|
|||||||
import com.klp.service.IWmsGenerateRecordService;
|
import com.klp.service.IWmsGenerateRecordService;
|
||||||
import com.klp.service.IWmsWarehouseService;
|
import com.klp.service.IWmsWarehouseService;
|
||||||
import com.klp.service.IWmsRawMaterialService;
|
import com.klp.service.IWmsRawMaterialService;
|
||||||
|
import com.klp.service.IWmsProductBomService;
|
||||||
|
import com.klp.service.IWmsBomItemService;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -55,6 +62,8 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
private final IWmsGenerateRecordService generateRecordService;
|
private final IWmsGenerateRecordService generateRecordService;
|
||||||
private final IWmsWarehouseService warehouseService;
|
private final IWmsWarehouseService warehouseService;
|
||||||
private final IWmsRawMaterialService rawMaterialService;
|
private final IWmsRawMaterialService rawMaterialService;
|
||||||
|
private final IWmsProductBomService productBomService;
|
||||||
|
private final IWmsBomItemService bomItemService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询钢卷物料表
|
* 查询钢卷物料表
|
||||||
@@ -66,6 +75,22 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 如果查询到的是历史数据,尝试查找对应的当前数据
|
||||||
|
if (vo.getDataType() != null && vo.getDataType() == 0) {
|
||||||
|
// 根据入场钢卷号查找当前数据
|
||||||
|
LambdaQueryWrapper<WmsMaterialCoil> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.eq(WmsMaterialCoil::getEnterCoilNo, vo.getEnterCoilNo())
|
||||||
|
.eq(WmsMaterialCoil::getDataType, 1) // 查找当前数据
|
||||||
|
.orderByDesc(WmsMaterialCoil::getCreateTime); // 按创建时间倒序,获取最新的
|
||||||
|
|
||||||
|
List<WmsMaterialCoilVo> currentDataList = baseMapper.selectVoList(lqw);
|
||||||
|
if (!currentDataList.isEmpty()) {
|
||||||
|
// 如果找到当前数据,返回最新的当前数据
|
||||||
|
vo = currentDataList.get(0);
|
||||||
|
}
|
||||||
|
// 如果没有找到当前数据,仍然返回历史数据供查看
|
||||||
|
}
|
||||||
|
|
||||||
// 查询关联对象
|
// 查询关联对象
|
||||||
fillRelatedObjects(vo);
|
fillRelatedObjects(vo);
|
||||||
|
|
||||||
@@ -98,6 +123,14 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
if ("raw_material".equals(vo.getItemType()) && vo.getItemId() != null) {
|
if ("raw_material".equals(vo.getItemType()) && vo.getItemId() != null) {
|
||||||
WmsRawMaterialVo rawMaterial = rawMaterialService.queryById(vo.getItemId());
|
WmsRawMaterialVo rawMaterial = rawMaterialService.queryById(vo.getItemId());
|
||||||
vo.setRawMaterial(rawMaterial);
|
vo.setRawMaterial(rawMaterial);
|
||||||
|
|
||||||
|
// 查询原材料对应的BOM信息(通过bomId查询BomItem列表)
|
||||||
|
if (rawMaterial != null && rawMaterial.getBomId() != null) {
|
||||||
|
WmsBomItemBo bomItemBo = new WmsBomItemBo();
|
||||||
|
bomItemBo.setBomId(rawMaterial.getBomId());
|
||||||
|
List<WmsBomItemVo> bomItemList = bomItemService.queryList(bomItemBo);
|
||||||
|
vo.setBomItemList(bomItemList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询产品信息(当itemType为product时)
|
// 查询产品信息(当itemType为product时)
|
||||||
@@ -320,6 +353,21 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
newCoil.setCoilId(null); // 清空ID,让数据库自动生成新的ID
|
newCoil.setCoilId(null); // 清空ID,让数据库自动生成新的ID
|
||||||
newCoil.setDataType(1); // 设置为当前数据
|
newCoil.setDataType(1); // 设置为当前数据
|
||||||
newCoil.setQrcodeRecordId(oldCoil.getQrcodeRecordId()); // 继承二维码ID
|
newCoil.setQrcodeRecordId(oldCoil.getQrcodeRecordId()); // 继承二维码ID
|
||||||
|
|
||||||
|
// 确保关键字段不丢失
|
||||||
|
if (newCoil.getEnterCoilNo() == null) {
|
||||||
|
newCoil.setEnterCoilNo(oldCoil.getEnterCoilNo());
|
||||||
|
}
|
||||||
|
if (newCoil.getSupplierCoilNo() == null) {
|
||||||
|
newCoil.setSupplierCoilNo(oldCoil.getSupplierCoilNo()); // 保留厂家原料卷号
|
||||||
|
}
|
||||||
|
if (newCoil.getItemType() == null) {
|
||||||
|
newCoil.setItemType(oldCoil.getItemType());
|
||||||
|
}
|
||||||
|
if (newCoil.getItemId() == null) {
|
||||||
|
newCoil.setItemId(oldCoil.getItemId());
|
||||||
|
}
|
||||||
|
|
||||||
validEntityBeforeSave(newCoil);
|
validEntityBeforeSave(newCoil);
|
||||||
boolean flag = baseMapper.insert(newCoil) > 0;
|
boolean flag = baseMapper.insert(newCoil) > 0;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
@@ -384,24 +432,33 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
|
|
||||||
// 1. 将原始钢卷更新为历史数据(已在上面完成)
|
// 1. 将原始钢卷更新为历史数据(已在上面完成)
|
||||||
|
|
||||||
// 2. 为每个分卷后的子钢卷生成独立的二维码并插入数据库
|
// 2. 为每个分卷后的子钢卷生成独立的二维码并插入数据库
|
||||||
for (WmsMaterialCoilBo newCoilBo : bo.getNewCoils()) {
|
for (WmsMaterialCoilBo newCoilBo : bo.getNewCoils()) {
|
||||||
WmsMaterialCoil newCoil = BeanUtil.toBean(newCoilBo, WmsMaterialCoil.class);
|
WmsMaterialCoil newCoil = BeanUtil.toBean(newCoilBo, WmsMaterialCoil.class);
|
||||||
newCoil.setCoilId(null);
|
newCoil.setCoilId(null);
|
||||||
newCoil.setDataType(1);
|
newCoil.setDataType(1);
|
||||||
newCoil.setEnterCoilNo(oldCoil.getEnterCoilNo());
|
// 继承原钢卷的基本信息
|
||||||
|
newCoil.setEnterCoilNo(oldCoil.getEnterCoilNo());
|
||||||
|
newCoil.setSupplierCoilNo(oldCoil.getSupplierCoilNo()); // 保留厂家原料卷号
|
||||||
|
newCoil.setItemType(oldCoil.getItemType());
|
||||||
|
newCoil.setItemId(oldCoil.getItemId());
|
||||||
|
newCoil.setTeam(oldCoil.getTeam());
|
||||||
|
// 如果没有指定库区,使用原库区
|
||||||
|
if (newCoil.getWarehouseId() == null) {
|
||||||
|
newCoil.setWarehouseId(oldCoil.getWarehouseId());
|
||||||
|
}
|
||||||
|
|
||||||
// 为每个子钢卷生成独立二维码
|
// 为每个子钢卷生成独立二维码
|
||||||
Long newQrcodeId = generateQrcodeForSplit(oldCoil, newCoilBo, allNewCoilNos);
|
Long newQrcodeId = generateQrcodeForSplit(oldCoil, newCoilBo, allNewCoilNos);
|
||||||
newCoil.setQrcodeRecordId(newQrcodeId);
|
newCoil.setQrcodeRecordId(newQrcodeId);
|
||||||
|
|
||||||
validEntityBeforeSave(newCoil);
|
validEntityBeforeSave(newCoil);
|
||||||
baseMapper.insert(newCoil);
|
baseMapper.insert(newCoil);
|
||||||
newCoils.add(newCoil);
|
newCoils.add(newCoil);
|
||||||
|
|
||||||
// 更新二维码内容中的coilId
|
// 更新二维码内容中的coilId
|
||||||
updateQrcodeCoilId(newQrcodeId, newCoil.getCoilId());
|
updateQrcodeCoilId(newQrcodeId, newCoil.getCoilId());
|
||||||
}
|
}
|
||||||
} else if (isMerge) {
|
} else if (isMerge) {
|
||||||
// 合卷:将bo作为合卷后的新钢卷,newCoils中的对象作为参与合卷的原始钢卷
|
// 合卷:将bo作为合卷后的新钢卷,newCoils中的对象作为参与合卷的原始钢卷
|
||||||
// 1. 将参与合卷的原始钢卷更新为历史数据
|
// 1. 将参与合卷的原始钢卷更新为历史数据
|
||||||
@@ -421,12 +478,27 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
WmsMaterialCoil newCoil = BeanUtil.toBean(bo, WmsMaterialCoil.class);
|
WmsMaterialCoil newCoil = BeanUtil.toBean(bo, WmsMaterialCoil.class);
|
||||||
newCoil.setCoilId(null);
|
newCoil.setCoilId(null);
|
||||||
newCoil.setDataType(1);
|
newCoil.setDataType(1);
|
||||||
// 合卷后的钢卷使用自己的enterCoilNo,如果没有则从参与合卷的原始钢卷中获取
|
|
||||||
if (newCoil.getEnterCoilNo() == null && !bo.getNewCoils().isEmpty()) {
|
// 从第一个参与合卷的原始钢卷获取基本信息
|
||||||
// 从第一个参与合卷的原始钢卷获取enterCoilNo
|
if (!bo.getNewCoils().isEmpty()) {
|
||||||
WmsMaterialCoil firstOriginalCoil = baseMapper.selectById(bo.getNewCoils().get(0).getCoilId());
|
WmsMaterialCoil firstOriginalCoil = baseMapper.selectById(bo.getNewCoils().get(0).getCoilId());
|
||||||
if (firstOriginalCoil != null) {
|
if (firstOriginalCoil != null) {
|
||||||
newCoil.setEnterCoilNo(firstOriginalCoil.getEnterCoilNo());
|
// 继承基本信息
|
||||||
|
if (newCoil.getEnterCoilNo() == null) {
|
||||||
|
newCoil.setEnterCoilNo(firstOriginalCoil.getEnterCoilNo());
|
||||||
|
}
|
||||||
|
if (newCoil.getSupplierCoilNo() == null) {
|
||||||
|
newCoil.setSupplierCoilNo(firstOriginalCoil.getSupplierCoilNo()); // 保留厂家原料卷号
|
||||||
|
}
|
||||||
|
if (newCoil.getItemType() == null) {
|
||||||
|
newCoil.setItemType(firstOriginalCoil.getItemType());
|
||||||
|
}
|
||||||
|
if (newCoil.getItemId() == null) {
|
||||||
|
newCoil.setItemId(firstOriginalCoil.getItemId());
|
||||||
|
}
|
||||||
|
if (newCoil.getTeam() == null) {
|
||||||
|
newCoil.setTeam(firstOriginalCoil.getTeam());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newCoil.setQrcodeRecordId(mergedQrcodeId);
|
newCoil.setQrcodeRecordId(mergedQrcodeId);
|
||||||
@@ -477,6 +549,7 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
splitStep.put("old_coil_id", String.valueOf(oldCoil.getCoilId()));
|
splitStep.put("old_coil_id", String.valueOf(oldCoil.getCoilId()));
|
||||||
splitStep.put("new_current_coil_nos", String.join(",", allNewCoilNos));
|
splitStep.put("new_current_coil_nos", String.join(",", allNewCoilNos));
|
||||||
splitStep.put("child_coils", allNewCoilNos);
|
splitStep.put("child_coils", allNewCoilNos);
|
||||||
|
splitStep.put("operator", LoginHelper.getUsername()); // 操作者
|
||||||
steps.add(splitStep);
|
steps.add(splitStep);
|
||||||
|
|
||||||
contentMap.put("steps", steps);
|
contentMap.put("steps", steps);
|
||||||
@@ -568,9 +641,12 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
mergeStep.put("parent_coil_nos", String.join(",", originalCoilNos));
|
mergeStep.put("parent_coil_nos", String.join(",", originalCoilNos));
|
||||||
mergeStep.put("parent_coil_ids", String.join(",", originalCoilIds));
|
mergeStep.put("parent_coil_ids", String.join(",", originalCoilIds));
|
||||||
mergeStep.put("new_current_coil_no", mergedCoilBo.getCurrentCoilNo());
|
mergeStep.put("new_current_coil_no", mergedCoilBo.getCurrentCoilNo());
|
||||||
|
mergeStep.put("operator", LoginHelper.getUsername()); // 操作者
|
||||||
steps.add(mergeStep);
|
steps.add(mergeStep);
|
||||||
|
|
||||||
contentMap.put("steps", steps);
|
contentMap.put("steps", steps);
|
||||||
|
// 将父钢卷ID也存储到顶层,方便快速查询
|
||||||
|
contentMap.put("parent_coil_ids", String.join(",", originalCoilIds));
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
String contentJson = objectMapper.writeValueAsString(contentMap);
|
String contentJson = objectMapper.writeValueAsString(contentMap);
|
||||||
@@ -649,6 +725,7 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
newStep.put("old_current_coil_no", oldCoil.getCurrentCoilNo()); // 原当前钢卷号
|
newStep.put("old_current_coil_no", oldCoil.getCurrentCoilNo()); // 原当前钢卷号
|
||||||
newStep.put("new_current_coil_no", bo.getCurrentCoilNo()); // 新当前钢卷号
|
newStep.put("new_current_coil_no", bo.getCurrentCoilNo()); // 新当前钢卷号
|
||||||
newStep.put("coil_id", String.valueOf(bo.getCoilId())); // 钢卷ID
|
newStep.put("coil_id", String.valueOf(bo.getCoilId())); // 钢卷ID
|
||||||
|
newStep.put("operator", LoginHelper.getUsername()); // 操作者
|
||||||
|
|
||||||
// 判断操作类型
|
// 判断操作类型
|
||||||
if (bo.getHasMergeSplit() != null && bo.getHasMergeSplit() == 2) {
|
if (bo.getHasMergeSplit() != null && bo.getHasMergeSplit() == 2) {
|
||||||
@@ -707,68 +784,112 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
@Override
|
@Override
|
||||||
public Map<String, Object> queryTrace(String enterCoilNo, String currentCoilNo) {
|
public Map<String, Object> queryTrace(String enterCoilNo, String currentCoilNo) {
|
||||||
try {
|
try {
|
||||||
// 1. 根据入场钢卷号查询二维码记录
|
// 1. 查询所有相关的二维码记录(包括分卷后的独立二维码)
|
||||||
|
List<WmsGenerateRecordVo> allQrRecords = new ArrayList<>();
|
||||||
|
|
||||||
|
// 首先查询主二维码(以入场钢卷号为序列号的)
|
||||||
WmsGenerateRecordBo qrBo = new WmsGenerateRecordBo();
|
WmsGenerateRecordBo qrBo = new WmsGenerateRecordBo();
|
||||||
qrBo.setSerialNumber(enterCoilNo);
|
qrBo.setSerialNumber(enterCoilNo);
|
||||||
List<WmsGenerateRecordVo> qrRecords = generateRecordService.queryList(qrBo);
|
List<WmsGenerateRecordVo> mainQrRecords = generateRecordService.queryList(qrBo);
|
||||||
|
allQrRecords.addAll(mainQrRecords);
|
||||||
|
|
||||||
if (qrRecords.isEmpty()) {
|
// 然后查询所有以该入场钢卷号开头的二维码(分卷后的二维码)
|
||||||
throw new RuntimeException("未找到对应的二维码记录");
|
WmsGenerateRecordBo splitQrBo = new WmsGenerateRecordBo();
|
||||||
}
|
List<WmsGenerateRecordVo> allRecords = generateRecordService.queryList(splitQrBo);
|
||||||
|
for (WmsGenerateRecordVo record : allRecords) {
|
||||||
// 取第一个(应该只有一个)
|
if (record.getSerialNumber() != null &&
|
||||||
WmsGenerateRecordVo qrRecord = qrRecords.get(0);
|
record.getSerialNumber().startsWith(enterCoilNo + "-") &&
|
||||||
|
!allQrRecords.contains(record)) {
|
||||||
// 2. 解析二维码content中的steps
|
allQrRecords.add(record);
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
Map<String, Object> contentMap = objectMapper.readValue(qrRecord.getContent(), Map.class);
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
List<Map<String, Object>> steps = (List<Map<String, Object>>) contentMap.get("steps");
|
|
||||||
|
|
||||||
// 3. 从steps中提取所有钢卷号
|
|
||||||
Set<String> coilNos = new HashSet<>();
|
|
||||||
if (steps != null) {
|
|
||||||
for (Map<String, Object> step : steps) {
|
|
||||||
// 提取各种可能的钢卷号字段
|
|
||||||
extractCoilNo(step, "current_coil_no", coilNos);
|
|
||||||
extractCoilNo(step, "new_current_coil_no", coilNos);
|
|
||||||
extractCoilNo(step, "old_current_coil_no", coilNos);
|
|
||||||
extractCoilNo(step, "new_current_coil_nos", coilNos);
|
|
||||||
extractCoilNo(step, "merged_from", coilNos);
|
|
||||||
extractCoilNo(step, "parent_coil_nos", coilNos);
|
|
||||||
// 提取钢卷ID字段
|
|
||||||
extractCoilId(step, "coil_id", coilNos);
|
|
||||||
extractCoilId(step, "old_coil_id", coilNos);
|
|
||||||
extractCoilId(step, "parent_coil_ids", coilNos);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. 如果指定了当前钢卷号,过滤出相关的钢卷号
|
if (allQrRecords.isEmpty()) {
|
||||||
Set<String> filteredCoilNos = coilNos;
|
throw new RuntimeException("未找到对应的二维码记录");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 合并所有二维码的steps信息,去重并重新编号
|
||||||
|
Map<String, Map<String, Object>> uniqueSteps = new HashMap<>(); // 用于去重
|
||||||
|
Set<String> allCoilNos = new HashSet<>();
|
||||||
|
|
||||||
|
for (WmsGenerateRecordVo qrRecord : allQrRecords) {
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
Map<String, Object> contentMap = objectMapper.readValue(qrRecord.getContent(), Map.class);
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
List<Map<String, Object>> steps = (List<Map<String, Object>>) contentMap.get("steps");
|
||||||
|
|
||||||
|
if (steps != null) {
|
||||||
|
for (Map<String, Object> step : steps) {
|
||||||
|
// 创建唯一标识:操作类型 + 相关钢卷号
|
||||||
|
String stepKey = createStepKey(step);
|
||||||
|
|
||||||
|
// 如果是新的步骤,添加到唯一步骤集合中
|
||||||
|
if (!uniqueSteps.containsKey(stepKey)) {
|
||||||
|
Map<String, Object> uniqueStep = new HashMap<>(step);
|
||||||
|
uniqueStep.put("qrcode_serial", qrRecord.getSerialNumber());
|
||||||
|
uniqueStep.put("qrcode_id", qrRecord.getRecordId());
|
||||||
|
uniqueSteps.put(stepKey, uniqueStep);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提取钢卷号
|
||||||
|
extractCoilNo(step, "current_coil_no", allCoilNos);
|
||||||
|
extractCoilNo(step, "new_current_coil_no", allCoilNos);
|
||||||
|
extractCoilNo(step, "old_current_coil_no", allCoilNos);
|
||||||
|
extractCoilNo(step, "new_current_coil_nos", allCoilNos);
|
||||||
|
extractCoilNo(step, "merged_from", allCoilNos);
|
||||||
|
extractCoilNo(step, "parent_coil_nos", allCoilNos);
|
||||||
|
extractCoilId(step, "coil_id", allCoilNos);
|
||||||
|
extractCoilId(step, "old_coil_id", allCoilNos);
|
||||||
|
extractCoilId(step, "parent_coil_ids", allCoilNos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 转换为列表并按原始步骤号排序(保持时间顺序)
|
||||||
|
List<Map<String, Object>> allSteps = new ArrayList<>(uniqueSteps.values());
|
||||||
|
|
||||||
|
// 按原始步骤号排序,保持实际操作的时间顺序
|
||||||
|
allSteps.sort((a, b) -> {
|
||||||
|
Integer stepA = (Integer) a.get("step");
|
||||||
|
Integer stepB = (Integer) b.get("step");
|
||||||
|
if (stepA == null) stepA = 0;
|
||||||
|
if (stepB == null) stepB = 0;
|
||||||
|
return stepA.compareTo(stepB);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 重新编号(保持连续性)
|
||||||
|
for (int i = 0; i < allSteps.size(); i++) {
|
||||||
|
allSteps.get(i).put("display_step", i + 1);
|
||||||
|
// 保留原始步骤号用于调试
|
||||||
|
allSteps.get(i).put("original_step", allSteps.get(i).get("step"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 如果指定了当前钢卷号,过滤出相关的钢卷号
|
||||||
|
Set<String> filteredCoilNos = allCoilNos;
|
||||||
if (currentCoilNo != null && !currentCoilNo.trim().isEmpty()) {
|
if (currentCoilNo != null && !currentCoilNo.trim().isEmpty()) {
|
||||||
final String filterValue = currentCoilNo; // 用于lambda的final变量
|
final String filterValue = currentCoilNo;
|
||||||
filteredCoilNos = coilNos.stream()
|
filteredCoilNos = allCoilNos.stream()
|
||||||
.filter(coilNo -> coilNo.contains(filterValue))
|
.filter(coilNo -> coilNo.contains(filterValue))
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5. 根据提取的钢卷号反向查询数据库
|
// 4. 根据提取的钢卷号反向查询数据库
|
||||||
List<WmsMaterialCoilVo> result = new ArrayList<>();
|
List<WmsMaterialCoilVo> result = new ArrayList<>();
|
||||||
if (!filteredCoilNos.isEmpty()) {
|
if (!filteredCoilNos.isEmpty()) {
|
||||||
LambdaQueryWrapper<WmsMaterialCoil> lqw = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<WmsMaterialCoil> lqw = Wrappers.lambdaQuery();
|
||||||
lqw.eq(WmsMaterialCoil::getEnterCoilNo, enterCoilNo);
|
lqw.eq(WmsMaterialCoil::getEnterCoilNo, enterCoilNo);
|
||||||
|
|
||||||
// 查询包含提取出的钢卷号的记录
|
// 查询包含提取出的钢卷号的记录
|
||||||
final Set<String> finalCoilNos = filteredCoilNos; // 用于lambda的final变量
|
final Set<String> finalCoilNos = filteredCoilNos;
|
||||||
lqw.and(wrapper -> {
|
lqw.and(wrapper -> {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (String coilNo : finalCoilNos) {
|
for (String coilNo : finalCoilNos) {
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
wrapper.like(WmsMaterialCoil::getCurrentCoilNo, coilNo);
|
wrapper.eq(WmsMaterialCoil::getCurrentCoilNo, coilNo);
|
||||||
} else {
|
} else {
|
||||||
wrapper.or().like(WmsMaterialCoil::getCurrentCoilNo, coilNo);
|
wrapper.or().eq(WmsMaterialCoil::getCurrentCoilNo, coilNo);
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
@@ -776,13 +897,32 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
|
|
||||||
lqw.orderByAsc(WmsMaterialCoil::getCreateTime);
|
lqw.orderByAsc(WmsMaterialCoil::getCreateTime);
|
||||||
result = baseMapper.selectVoList(lqw);
|
result = baseMapper.selectVoList(lqw);
|
||||||
|
|
||||||
|
// 填充每个记录的关联对象信息(如库区)
|
||||||
|
for (WmsMaterialCoilVo vo : result) {
|
||||||
|
fillRelatedObjects(vo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 6. 构建返回结果
|
// 如果没有找到记录,尝试查询所有相关的钢卷(包括历史数据)
|
||||||
|
if (result.isEmpty()) {
|
||||||
|
LambdaQueryWrapper<WmsMaterialCoil> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.eq(WmsMaterialCoil::getEnterCoilNo, enterCoilNo);
|
||||||
|
lqw.orderByAsc(WmsMaterialCoil::getCreateTime);
|
||||||
|
result = baseMapper.selectVoList(lqw);
|
||||||
|
|
||||||
|
// 填充每个记录的关联对象信息
|
||||||
|
for (WmsMaterialCoilVo vo : result) {
|
||||||
|
fillRelatedObjects(vo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. 构建返回结果
|
||||||
Map<String, Object> resultMap = new HashMap<>();
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
resultMap.put("qrcode", qrRecord);
|
resultMap.put("qrcode", allQrRecords.get(0)); // 主二维码
|
||||||
resultMap.put("steps", steps);
|
resultMap.put("all_qrcodes", allQrRecords); // 所有相关二维码
|
||||||
resultMap.put("records", result);
|
resultMap.put("steps", allSteps); // 所有步骤
|
||||||
|
resultMap.put("records", result); // 所有钢卷记录
|
||||||
|
|
||||||
return resultMap;
|
return resultMap;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -790,6 +930,38 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建步骤唯一标识
|
||||||
|
*/
|
||||||
|
private String createStepKey(Map<String, Object> step) {
|
||||||
|
StringBuilder keyBuilder = new StringBuilder();
|
||||||
|
|
||||||
|
// 使用操作类型和主要标识符创建唯一key
|
||||||
|
String operation = (String) step.get("operation");
|
||||||
|
keyBuilder.append(operation).append("-");
|
||||||
|
|
||||||
|
// 根据操作类型使用不同的标识符
|
||||||
|
if ("分卷".equals(operation)) {
|
||||||
|
// 分卷:使用原钢卷号 + 分卷列表
|
||||||
|
keyBuilder.append(step.get("old_current_coil_no")).append("->");
|
||||||
|
keyBuilder.append(step.get("new_current_coil_nos"));
|
||||||
|
} else if ("合卷".equals(operation)) {
|
||||||
|
// 合卷:使用父钢卷列表 + 新钢卷号
|
||||||
|
keyBuilder.append(step.get("parent_coil_nos")).append("->");
|
||||||
|
keyBuilder.append(step.get("new_current_coil_no"));
|
||||||
|
} else if ("新增".equals(operation)) {
|
||||||
|
// 新增:使用当前钢卷号
|
||||||
|
keyBuilder.append(step.get("current_coil_no"));
|
||||||
|
} else {
|
||||||
|
// 其他更新:使用原钢卷号 -> 新钢卷号
|
||||||
|
keyBuilder.append(step.get("old_current_coil_no")).append("->");
|
||||||
|
keyBuilder.append(step.get("new_current_coil_no"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return keyBuilder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 从step中提取钢卷号
|
* 从step中提取钢卷号
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
DROP TABLE IF EXISTS `wms_stock`;
|
DROP TABLE IF EXISTS `wms_stock`;
|
||||||
|
DROP TABLE IF EXISTS `wms_material_coil`;
|
||||||
|
|
||||||
create table wms_stock
|
create table wms_stock
|
||||||
(
|
(
|
||||||
|
|||||||
Reference in New Issue
Block a user