Commit 1d8a7925 authored by wanghao's avatar wanghao

1 料架号和物料维护界面可以出库调整

2 入库 选择物料界面调整
parent 14d0ab1d
......@@ -46,6 +46,9 @@ public class TRackMaterialRelation extends BaseEntity
/** 储位 */
private String location;
/** 描述 */
private String locationDesc;
public void setRelationId(Long relationId)
{
this.relationId = relationId;
......@@ -124,6 +127,14 @@ public class TRackMaterialRelation extends BaseEntity
this.location = location;
}
public String getLocationDesc() {
return locationDesc;
}
public void setLocationDesc(String locationDesc) {
this.locationDesc = locationDesc;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
......@@ -34,6 +34,8 @@ public interface TRackMaterialRelationMapper
*/
public List<TRackMaterialRelation> selectTRackMaterialRelationList(TRackMaterialRelation tRackMaterialRelation);
public List<TRackMaterialRelation> selectByRockCode(String rackCode);
/**
* 新增料架和物料维护
*
......
......@@ -108,6 +108,16 @@ public class ITShelfApiServiceImpl implements ITShelfApiService{
* @param param 关联信息
*/
private void addRelationInfo(JSONObject param){
List<TRackMaterialRelation> tRackMaterialRelations = rackMaterialRelationMapper.selectByRockCode(param.getString("rackCode"));
if(tRackMaterialRelations.size() > 0){
TRackMaterialRelation tRackMaterialRelation = tRackMaterialRelations.get(0);
tRackMaterialRelation.setUpdateTime(new Date());
tRackMaterialRelation.setUpdateBy(SecurityUtils.getLoginUser().getUser().getNickName());
tRackMaterialRelation.setMaterialId(param.getLong("materialId"));
tRackMaterialRelation.setRackCode(param.getString("rackCode"));
tRackMaterialRelation.setShelf(param.getString("shelf"));
rackMaterialRelationMapper.updateTRackMaterialRelation(tRackMaterialRelation);
} else {
TRackMaterialRelation tRackMaterialRelation = new TRackMaterialRelation();
tRackMaterialRelation.setMaterialId(param.getLong("materialId"));
tRackMaterialRelation.setRackCode(param.getString("rackCode"));
......@@ -117,6 +127,7 @@ public class ITShelfApiServiceImpl implements ITShelfApiService{
int result = rackMaterialRelationMapper.insertTRackMaterialRelation(tRackMaterialRelation);
if(result == 0) throw new CustomException("入库料盘物料信息关联失败");
}
}
/**
* 解除入库关联信息
......
......@@ -17,7 +17,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
<result property="shelf" column="f_shelf" />
<result property="layer" column="layer" />
<result property="location" column="location" />
<result property="location" column="f_location" />
<result property="locationDesc" column="locationDesc" />
</resultMap>
<sql id="selectTRackMaterialRelationVo">
......@@ -32,6 +33,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
relation.update_by,
relation.update_time,
relation.f_shelf,
location.f_location,
CONCAT(
CASE
WHEN location.f_location BETWEEN 1 AND 80 THEN '一层正面'
WHEN location.f_location BETWEEN 161 AND 240 THEN '一层反面'
......@@ -42,14 +45,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHEN location.f_location BETWEEN 481 AND 528 THEN '四层正面'
WHEN location.f_location BETWEEN 529 AND 576 THEN '五层正面'
ELSE '未知层'
END AS layer,
location.f_label as location
END,
'-',
IFNULL(location.f_label, '')
) AS locationDesc
FROM
t_rack_material_relation relation
LEFT JOIN t_rack_material_info info ON info.material_id = relation.material_id
LEFT JOIN t_shelf_storage_location location ON location.f_rid = relation.rack_code
</sql>
<select id="selectByRockCode" parameterType="string" resultMap="TRackMaterialRelationResult">
<include refid="selectTRackMaterialRelationVo"/>
where relation.rack_code = #{rackCode}
</select>
<select id="selectTRackMaterialRelationList" parameterType="TRackMaterialRelation" resultMap="TRackMaterialRelationResult">
<include refid="selectTRackMaterialRelationVo"/>
<where>
......
......@@ -180,7 +180,7 @@ export default {
}
};
},
created() {
activated() {
this.getList();
},
methods: {
......
......@@ -84,24 +84,18 @@
<el-table-column label="名称" align="center" prop="materialName" />
<el-table-column label="规格型号" align="center" prop="materialSpecifications" />
<el-table-column label="料架号" align="center" prop="shelf" />
<el-table-column label="层" align="center" prop="layer" />
<el-table-column label="位置" align="center" prop="location" />
<!--<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column label="位置" align="center" prop="locationDesc" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
v-if="!scope.row.locationDesc.includes('未知层')"
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>
icon="el-icon-remove"
@click="handleOut(scope.row)"
>出库</el-button>
</template>
</el-table-column>-->
</el-table-column>
</el-table>
<pagination
......@@ -144,6 +138,7 @@
<script>
import { relationListInfo, listRelation, getRelation, delRelation, addRelation, updateRelation, exportRelation } from "@/api/material/relation";
import {rackInOutput} from "@/api/shelf/location";
export default {
name: "Relation",
......@@ -196,17 +191,100 @@ export default {
materialSpecifications: [
{ required: true, message: "规格型号不能为空", trigger: "blur" }
],
}
},
ws: null,
heartbeatInterval: null,
};
},
created() {
this.connect();
},
activated() {
this.getList();
},
methods: {
// 出库操作需要选择位置可多选不需要扫码
handleOut(row){
if(row.locationDesc.includes('未知层')){
this.$message.error("未知层不能出库!!!");
return;
}
const param = {
ID: this.generateUUID(),
OPTYPE: "O",
SHELF: row.shelf,
COLOR: "1",
USERNAME: "admin",
TOTALINFO: [
{RID: row.rackCode,LOCATION: row.location}
],
}
this.$confirm("是否确认出库?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
return rackInOutput(JSON.stringify(param));
}).then(response => {
if(response.code == 200){
this.msgSuccess("请取物料");
}
}).catch(() => {});
},
//生成uuid
generateUUID() {
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
);
},
connect() {
this.ws = new WebSocket('ws://' + window.location.host + process.env.VUE_APP_BASE_API + '/ws/notifications');
this.ws.onopen = () => {
console.log('WebSocket Connected');
// 连接建立后,开始定期发送心跳
this.heartbeatInterval = setInterval(() => {
if (this.ws.readyState === WebSocket.OPEN) {
this.ws.send(JSON.stringify({ type: 'ping' }));
console.log("发送心跳")
}
}, 30000);
};
this.ws.onmessage = (event) => {
// Add received message to the list
const message = JSON.parse(event.data);
if(message && message.shelfId){
//入库
if("I" == message.optype){
this.getList()
}
//出库
if("O" == message.optype){
this.getList();
}
}
};
this.ws.onerror = (error) => {
console.error('WebSocket Error:', error);
};
this.ws.onclose = () => {
console.log('WebSocket Closed');
clearInterval(this.heartbeatInterval);
};
},
disconnect() {
if (this.ws) {
this.ws.close();
}
},
/** 查询料架和物料维护列表 */
getList() {
console.log("getList")
this.loading = true;
listRelation(this.queryParams).then(response => {
console.log("getList result")
this.relationList = response.rows;
this.total = response.total;
this.loading = false;
......@@ -332,6 +410,9 @@ export default {
handleSelect(item){
this.form.materialName = item.materialName;
this.form.materialSpecifications = item.materialSpecifications;
},
beforeDestroy() {
this.disconnect();
}
}
};
......
......@@ -66,6 +66,73 @@
</div>
</div>
<el-dialog
custom-class="bold-title-dialog"
title="请选择物料清单"
:visible.sync="selectMaterialInfoForPurReqOpen"
width="688px"
append-to-body
:close-on-click-modal="false"
:before-close="materialForPurReqFormBeforeClose"
>
<el-form ref="materialForPurReqForm" :inline="true" label-width="68px">
<el-form-item label="物料代码" prop="materialCode">
<el-input
v-model="queryMaterialInfoListParams.materialCode"
placeholder="请输入物料代码"
clearable
size="small"
@keyup.enter.native="listMaterialInfoListMethod"
/>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input
v-model="queryMaterialInfoListParams.materialName"
placeholder="请输入产品名称"
clearable
size="small"
@keyup.enter.native="listMaterialInfoListMethod"
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="listMaterialInfoListMethod"
>搜索
</el-button
>
</el-form-item>
</el-form>
<el-table
border
style="width: 100%"
ref="prodInfoFormTableRef"
height="550"
:data="materialInfoList"
@row-click="materialInfoHandleCellClick"
:key="Math.random()"
>
<el-table-column width="200" prop="materialCode" label="物料代码">
</el-table-column>
<el-table-column width="200" prop="materialName" label="物料名称">
</el-table-column>
<el-table-column width="200" prop="materialSpecifications" label="规格型号">
</el-table-column>
</el-table>
<pagination
v-show="materialForPurReqRefTotal > 0"
:total="materialForPurReqRefTotal"
:page.sync="queryMaterialInfoListParams.pageNum"
:limit.sync="queryMaterialInfoListParams.pageSize"
@pagination="listMaterialInfoListMethod"
/>
</el-dialog>
<!-- 出库 -->
<el-dialog title="入库" :visible.sync="open" width="500px" append-to-body destroy-on-close :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
......@@ -73,19 +140,12 @@
<el-input v-model="form.rackCode" placeholder="请输入物料代码" :readOnly="true"/>
</el-form-item>
<el-form-item label="物料代码" prop="materialCode">
<el-select
<el-input
v-model="form.materialCode"
placeholder="请选择物料代码"
:style="{ width: '100%' }"
@change="materialCodeChange"
>
<el-option
v-for="(item, index) in materialInfoList"
:key="index"
:label="item.materialCode"
:value="item.materialId"
placeholder="请点击选择物料"
readonly
@click.native="openMaterialSelectDialog"
/>
</el-select>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input v-model="form.materialName" placeholder="请输入名称" :readOnly="true"/>
......@@ -105,7 +165,7 @@
<script>
import { locationListInfo, rackInOutput} from "@/api/shelf/location";
import { materialInfoList } from "@/api/material/info";
import { materialInfoList ,listInfo} from "@/api/material/info";
export default {
name: "shelf-location",
data(){
......@@ -154,6 +214,13 @@
],
},
materialInfoList: [],
selectMaterialInfoForPurReqOpen: false,
materialForPurReqRefTotal: 0,
queryMaterialInfoListParams: {
status: 1,
pageNum: 1,
pageSize: 10,
},
// 料盘号
fShelf: null
}
......@@ -168,6 +235,31 @@
this.connect();
},
methods:{
openMaterialSelectDialog() {
this.selectMaterialInfoForPurReqOpen = true;
this.listMaterialInfoListMethod(); // 立即加载第一页数据
},
materialInfoHandleCellClick(row) {
this.form.materialId = row.materialInfoId || row.materialId;
this.form.materialCode = row.materialCode;
this.form.materialName = row.materialName;
this.form.materialSpecifications = row.specification || row.materialSpecifications;
this.selectMaterialInfoForPurReqOpen = false;
},
materialForPurReqFormBeforeClose() {
this.queryMaterialInfoListParams = {
status: 1,
pageNum: 1,
pageSize: 10,
};
this.selectMaterialInfoForPurReqOpen = false;
},
listMaterialInfoListMethod() {
listInfo(this.queryMaterialInfoListParams).then((response) => {
this.materialInfoList = response.rows;
this.materialForPurReqRefTotal = response.total;
});
} ,
getList(){
locationListInfo(this.queryParams).then(res => {
this.shelfInfo = res.data;
......@@ -269,6 +361,7 @@
},
// 入库操作需要扫码不需要选位置
handleIn(){
this.reset();
if(!this.barCode){
this.$message.error("请扫描或输入料盘条形码");
return
......@@ -299,7 +392,7 @@
})
rackInOutput(JSON.stringify(param)).then(res =>{
if(res.code == 200){
this.msgSuccess("出库成功");
this.msgSuccess("请取物料");
}
});
this.clearSelection();
......@@ -371,7 +464,7 @@
{
ID: this.generateUUID(),
OPTYPE: "I",
SHELF: this.$route.query.shelf,
SHELF: this.fShelf,
COLOR: "1",
USERNAME: "admin",
TOTALINFO: [{RID: this.barCode}]
......@@ -382,8 +475,12 @@
rackInOutput(JSON.stringify(param)).then(res =>{
if(res.code == 200){
this.open = false;
this.msgSuccess("入库成功");
this.barCode = null;
this.msgSuccess("请放物料");
this.clearSelection();
this.$nextTick(() => {
this.$refs.barCode.focus();
})
}
})
},
......
......@@ -67,6 +67,72 @@
</div>
</div>
<el-dialog
custom-class="bold-title-dialog"
title="请选择物料清单"
:visible.sync="selectMaterialInfoForPurReqOpen"
width="688px"
append-to-body
:close-on-click-modal="false"
:before-close="materialForPurReqFormBeforeClose"
>
<el-form ref="materialForPurReqForm" :inline="true" label-width="68px">
<el-form-item label="物料代码" prop="materialCode">
<el-input
v-model="queryMaterialInfoListParams.materialCode"
placeholder="请输入物料代码"
clearable
size="small"
@keyup.enter.native="listMaterialInfoListMethod"
/>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input
v-model="queryMaterialInfoListParams.materialName"
placeholder="请输入产品名称"
clearable
size="small"
@keyup.enter.native="listMaterialInfoListMethod"
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="listMaterialInfoListMethod"
>搜索
</el-button
>
</el-form-item>
</el-form>
<el-table
border
style="width: 100%"
ref="prodInfoFormTableRef"
height="550"
:data="materialInfoList"
@row-click="materialInfoHandleCellClick"
:key="Math.random()"
>
<el-table-column width="200" prop="materialCode" label="物料代码">
</el-table-column>
<el-table-column width="200" prop="materialName" label="物料名称">
</el-table-column>
<el-table-column width="200" prop="materialSpecifications" label="规格型号">
</el-table-column>
</el-table>
<pagination
v-show="materialForPurReqRefTotal > 0"
:total="materialForPurReqRefTotal"
:page.sync="queryMaterialInfoListParams.pageNum"
:limit.sync="queryMaterialInfoListParams.pageSize"
@pagination="listMaterialInfoListMethod"
/>
</el-dialog>
<!-- 出库 -->
<el-dialog title="入库" :visible.sync="open" width="500px" append-to-body destroy-on-close :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
......@@ -74,19 +140,12 @@
<el-input v-model="form.rackCode" placeholder="请输入物料代码" :readOnly="true"/>
</el-form-item>
<el-form-item label="物料代码" prop="materialCode">
<el-select
<el-input
v-model="form.materialCode"
placeholder="请选择物料代码"
:style="{ width: '100%' }"
@change="materialCodeChange"
>
<el-option
v-for="(item, index) in materialInfoList"
:key="index"
:label="item.materialCode"
:value="item.materialId"
placeholder="请点击选择物料"
readonly
@click.native="openMaterialSelectDialog"
/>
</el-select>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input v-model="form.materialName" placeholder="请输入名称" :readOnly="true"/>
......@@ -106,7 +165,7 @@
<script>
import { locationListInfo, rackInOutput} from "@/api/shelf/location";
import { materialInfoList } from "@/api/material/info";
import { materialInfoList ,listInfo} from "@/api/material/info";
export default {
name: "shelf-location",
data(){
......@@ -155,6 +214,13 @@
],
},
materialInfoList: [],
selectMaterialInfoForPurReqOpen: false,
materialForPurReqRefTotal: 0,
queryMaterialInfoListParams: {
status: 1,
pageNum: 1,
pageSize: 10,
},
// 料盘号
fShelf: null
}
......@@ -169,6 +235,31 @@
this.connect();
},
methods:{
openMaterialSelectDialog() {
this.selectMaterialInfoForPurReqOpen = true;
this.listMaterialInfoListMethod(); // 立即加载第一页数据
},
materialInfoHandleCellClick(row) {
this.form.materialId = row.materialInfoId || row.materialId;
this.form.materialCode = row.materialCode;
this.form.materialName = row.materialName;
this.form.materialSpecifications = row.specification || row.materialSpecifications;
this.selectMaterialInfoForPurReqOpen = false;
},
materialForPurReqFormBeforeClose() {
this.queryMaterialInfoListParams = {
status: 1,
pageNum: 1,
pageSize: 10,
};
this.selectMaterialInfoForPurReqOpen = false;
},
listMaterialInfoListMethod() {
listInfo(this.queryMaterialInfoListParams).then((response) => {
this.materialInfoList = response.rows;
this.materialForPurReqRefTotal = response.total;
});
} ,
getList(){
locationListInfo(this.queryParams).then(res => {
this.shelfInfo = res.data;
......@@ -299,7 +390,7 @@
})
rackInOutput(JSON.stringify(param)).then(res =>{
if(res.code == 200){
this.msgSuccess("出库成功");
this.msgSuccess("请取物料");
}
});
this.clearSelection();
......@@ -371,7 +462,7 @@
{
ID: this.generateUUID(),
OPTYPE: "I",
SHELF: this.$route.query.shelf,
SHELF: this.fShelf,
COLOR: "1",
USERNAME: "admin",
TOTALINFO: [{RID: this.barCode}]
......@@ -382,7 +473,7 @@
rackInOutput(JSON.stringify(param)).then(res =>{
if(res.code == 200){
this.open = false;
this.msgSuccess("入库成功");
this.msgSuccess("请放物料");
this.clearSelection();
}
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment