Commit 8a67af0d authored by 耿迪迪's avatar 耿迪迪

出入库逻辑修改及位置提示信息修改

parent 00e0e9bd
......@@ -37,6 +37,15 @@ public class TRackMaterialInfoController extends BaseController
return getDataTable(list);
}
/**
* 查询物料维护列表信息
*/
@GetMapping("/materialInfoList")
public AjaxResult materialInfoList(TRackMaterialInfo tRackMaterialInfo) {
List<TRackMaterialInfo> list = tRackMaterialInfoService.selectTRackMaterialInfoList(tRackMaterialInfo);
return AjaxResult.success(list);
}
/**
* 导出物料维护列表
*/
......
......@@ -50,6 +50,16 @@ public class TShelfStorageLocation extends BaseEntity
@Excel(name = "出库时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date outboundTime;
/** 物料代码 */
private String materialCode;
/** 物料名称 */
private String materialName;
/** 物料规格型号 */
private String materialSpecifications;
public Long getShelfStorageLocationId() {
return shelfStorageLocationId;
}
......@@ -114,7 +124,29 @@ public class TShelfStorageLocation extends BaseEntity
this.outboundTime = outboundTime;
}
public String getMaterialCode() {
return materialCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public String getMaterialSpecifications() {
return materialSpecifications;
}
public void setMaterialSpecifications(String materialSpecifications) {
this.materialSpecifications = materialSpecifications;
}
@Override
public String toString() {
......
......@@ -58,4 +58,11 @@ public interface TRackMaterialRelationMapper
* @return 结果
*/
public int deleteTRackMaterialRelationByIds(Long[] relationIds);
/**
* 批量删除料架和物料维护
* @param rackCodes 料架号
* @return int
*/
int deleteTRackMaterialRelationByRackCodes(String[] rackCodes);
}
......@@ -2,10 +2,13 @@ package com.zehong.system.service.impl.shelf;
import com.alibaba.fastjson.JSONObject;
import com.zehong.common.exception.CustomException;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.common.utils.StringUtils;
import com.zehong.common.utils.http.HttpClientUtils;
import com.zehong.system.domain.material.TRackMaterialRelation;
import com.zehong.system.domain.shelf.TShelfInfo;
import com.zehong.system.domain.shelf.TShelfStorageLocation;
import com.zehong.system.mapper.material.TRackMaterialRelationMapper;
import com.zehong.system.mapper.shelf.TShelfInfoMapper;
import com.zehong.system.mapper.shelf.TShelfStorageLocationMapper;
import com.zehong.system.service.impl.shelf.annotation.DockingTaskType;
......@@ -21,6 +24,9 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* 货架第三方接口
......@@ -36,6 +42,9 @@ public class ITShelfApiServiceImpl implements ITShelfApiService{
@Resource
private TShelfInfoMapper shelfInfoMapper;
@Resource
private TRackMaterialRelationMapper rackMaterialRelationMapper;
/**
* 获取料架状态接口
*/
......@@ -72,14 +81,54 @@ public class ITShelfApiServiceImpl implements ITShelfApiService{
* @param param 入参
*/
@Override
@Transactional(rollbackFor = Exception.class)
@PlatformDockingTaskLog(type = DockingTaskType.CALL_RACK_SYSTEM)
public String rackInOutput(String param){
log.info("rackInOutput...param==========" + param);
JSONObject paramJson = JSONObject.parseObject(param);
if(paramJson.containsKey("relationParam")){
// 入库
addRelationInfo(paramJson.getJSONObject("relationParam"));
String result = HttpClientUtils.doPost(shelfApiUrl + RACK_IN_OUT_PUT_URL,paramJson.getString("inStoreParam"),null);
if(StringUtils.isEmpty(result)) throw new CustomException("料架出入库接口错误");
return result;
}else{
//出库
delRelationInfo(JSONObject.parseObject(param));
String result = HttpClientUtils.doPost(shelfApiUrl + RACK_IN_OUT_PUT_URL,param,null);
if(StringUtils.isEmpty(result)) throw new CustomException("料架出入库接口错误");
return result;
}
}
/**
* 新增关联入库信息
* @param param 关联信息
*/
private void addRelationInfo(JSONObject param){
TRackMaterialRelation tRackMaterialRelation = new TRackMaterialRelation();
tRackMaterialRelation.setMaterialId(param.getLong("materialId"));
tRackMaterialRelation.setRackCode(param.getString("rackCode"));
tRackMaterialRelation.setCreateTime(new Date());
tRackMaterialRelation.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName());
int result = rackMaterialRelationMapper.insertTRackMaterialRelation(tRackMaterialRelation);
if(result == 0) throw new CustomException("入库料盘物料信息关联失败");
}
/**
* 解除入库关联信息
* @param param 位置信息
*/
private void delRelationInfo(JSONObject param){
List<JSONObject> locationInfo = param.getJSONArray("TOTALINFO").toJavaList(JSONObject.class);
String[] rockCodes = locationInfo.stream()
.map(json -> json.getString("RID"))
.filter(Objects::nonNull)
.toArray(String[]::new);
int result = rackMaterialRelationMapper.deleteTRackMaterialRelationByRackCodes(rockCodes);
if(result == 0) throw new CustomException("入库料盘物料信息解除失败");
}
/**
* 获取料架所有储位信息
* @param param 请求参数
......
......@@ -53,6 +53,10 @@ public class PlatformDockingTaskAspect {
private void insertCallRackSystemLog(JoinPoint joinPoint,Object result){
String param = (String) joinPoint.getArgs()[0];
JSONObject paramJson = JSONObject.parseObject(param);
//判断是否为入库
if(paramJson.containsKey("inStoreParam")){
paramJson = paramJson.getJSONObject("inStoreParam");
}
//插入日志
TPlatformDockingTask tPlatformDockingTask = new TPlatformDockingTask();
tPlatformDockingTask.setfTaskId(paramJson.getString("ID"));
......
......@@ -91,4 +91,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{relationId}
</foreach>
</delete>
<delete id="deleteTRackMaterialRelationByRackCodes" parameterType="String">
delete from t_rack_material_relation where rack_code in
<foreach item="rackCode" collection="array" open="(" separator="," close=")">
#{rackCode}
</foreach>
</delete>
</mapper>
\ No newline at end of file
......@@ -16,7 +16,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectTShelfStorageLocationVo">
select f_shelf_storage_location_id, f_shelf_id, f_label, f_location, f_index, f_rid, f_inbound_time, f_outbound_time from t_shelf_storage_location
SELECT
location.f_shelf_storage_location_id,
location.f_shelf_id,
location.f_label,
location.f_location,
location.f_index,
location.f_rid,
location.f_inbound_time,
location.f_outbound_time,
material.material_code AS materialCode,
material.material_name AS materialName,
material.material_specifications AS materialSpecifications
FROM
t_shelf_storage_location location
LEFT JOIN t_rack_material_relation relation ON relation.rack_code = location.f_rid
LEFT JOIN t_rack_material_info material ON material.material_id = relation.material_id
</sql>
<select id="selectTShelfStorageLocationList" parameterType="TShelfStorageLocation" resultMap="TShelfStorageLocationResult">
......
......@@ -9,6 +9,15 @@ export function listInfo(query) {
})
}
// 查询所有物料信息
export function materialInfoList(query) {
return request({
url: '/material/info/materialInfoList',
method: 'get',
params: query
})
}
// 查询物料维护详细
export function getInfo(materialId) {
return request({
......
......@@ -106,7 +106,7 @@
/>
<!-- 添加或修改物料维护对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-dialog :title="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">
<el-form-item label="物料代码" prop="materialCode">
<el-input v-model="form.materialCode" placeholder="请输入物料代码" />
......
......@@ -47,9 +47,14 @@
<el-tooltip
effect="light"
v-if="location.rid"
:content="location.rid"
placement="top"
>
<div slot="content">
料架号:{{ location.rid }}<br/>
物料代码:{{ location.materialCode}}<br/>
物料名称:{{ location.materialName }}<br/>
规格型号:{{ location.materialSpecifications }}
</div>
<span>{{ location.label }}</span>
</el-tooltip>
<span v-else>{{ location.label }}</span>
......@@ -57,11 +62,46 @@
</div>
</div>
<!-- 出库 -->
<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">
<el-form-item label="料盘码" prop="materialCode">
<el-input v-model="form.rackCode" placeholder="请输入物料代码" :readOnly="true"/>
</el-form-item>
<el-form-item label="物料代码" prop="materialCode">
<el-select
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"
/>
</el-select>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input v-model="form.materialName" placeholder="请输入名称" :readOnly="true"/>
</el-form-item>
<el-form-item label="规格型号" prop="materialSpecifications">
<el-input v-model="form.materialSpecifications" placeholder="请输入规格型号" :readOnly="true"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { locationListInfo, rackInOutput} from "@/api/shelf/location";
import { materialInfoList } from "@/api/material/info";
export default {
name: "shelf-location",
data(){
......@@ -87,7 +127,22 @@
shelfId: null,
},
ws: null,
heartbeatInterval: null
heartbeatInterval: null,
form: {
rackCode: null,
materialCode: null,
materialName: null,
materialSpecifications: null,
materialId: null
},
open: false,
// 表单校验
rules: {
rackCode: [
{ required: true, message: "物料代码不能为空", trigger: "blur" }
],
},
materialInfoList: []
}
},
created(){
......@@ -198,16 +253,10 @@
this.$message.error("请扫描或输入料盘条形码");
return
}
const param = {
ID: this.generateUUID(),
OPTYPE: "I",
SHELF: this.$route.query.shelf,
COLOR: "1",
USERNAME: "admin",
TOTALINFO: [{RID: this.barCode}]
};
rackInOutput(JSON.stringify(param));
this.clearSelection();
this.getMaterialInfo();
this.form.rackCode = this.barCode;
this.open = true;
},
// 出库操作需要选择位置可多选不需要扫码
handleOut(){
......@@ -228,7 +277,11 @@
const locationInfo = this.shelfInfo[dom.dataset.index - 1];
param.TOTALINFO.push({RID: locationInfo.rid,LOCATION: locationInfo.location})
})
rackInOutput(JSON.stringify(param));
rackInOutput(JSON.stringify(param)).then(res =>{
if(res.code == 200){
this.msgSuccess("出库成功");
}
});
this.clearSelection();
},
//生成uuid
......@@ -277,6 +330,60 @@
if (this.ws) {
this.ws.close();
}
},
// 表单重置
reset() {
this.form = {
materialCode: null,
materialId: null,
materialCode: null,
materialName: null,
materialSpecifications: null,
};
this.resetForm("form");
},
//提交入库
submitForm(){
const param = {
inStoreParam: JSON.stringify(
{
ID: this.generateUUID(),
OPTYPE: "I",
SHELF: this.$route.query.shelf,
COLOR: "1",
USERNAME: "admin",
TOTALINFO: [{RID: this.barCode}]
}
),
relationParam: this.form
};
rackInOutput(JSON.stringify(param)).then(res =>{
if(res.code == 200){
this.open = false;
this.msgSuccess("入库成功");
this.clearSelection();
}
})
},
//取消入库
cancel(){
this.reset();
this.open = false;
},
//切换物料代码
materialCodeChange(val){
const materialInfo = this.materialInfoList.find(item => item.materialId = val);
this.form.materialId = val;
this.form.materialName = materialInfo.materialName;
this.form.materialSpecifications = materialInfo.materialSpecifications;
},
//获取物料信息
getMaterialInfo(){
materialInfoList().then(res =>{
if(res.code == 200){
this.materialInfoList = res.data;
}
})
}
},
beforeDestroy() {
......
......@@ -50,6 +50,12 @@
:content="location.rid"
placement="top"
>
<div slot="content">
料架号:{{ location.rid }}<br/>
物料代码:{{ location.materialCode}}<br/>
物料名称:{{ location.materialName }}<br/>
规格型号:{{ location.materialSpecifications }}
</div>
<span>{{ location.label }}</span>
</el-tooltip>
<span v-else>{{ location.label }}</span>
......@@ -57,11 +63,46 @@
</div>
</div>
<!-- 出库 -->
<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">
<el-form-item label="料盘码" prop="materialCode">
<el-input v-model="form.rackCode" placeholder="请输入物料代码" :readOnly="true"/>
</el-form-item>
<el-form-item label="物料代码" prop="materialCode">
<el-select
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"
/>
</el-select>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input v-model="form.materialName" placeholder="请输入名称" :readOnly="true"/>
</el-form-item>
<el-form-item label="规格型号" prop="materialSpecifications">
<el-input v-model="form.materialSpecifications" placeholder="请输入规格型号" :readOnly="true"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { locationListInfo, rackInOutput} from "@/api/shelf/location";
import { materialInfoList } from "@/api/material/info";
export default {
name: "shelf-location",
data(){
......@@ -87,7 +128,22 @@
shelfId: null,
},
ws: null,
heartbeatInterval: null
heartbeatInterval: null,
form: {
rackCode: null,
materialCode: null,
materialName: null,
materialSpecifications: null,
materialId: null
},
open: false,
// 表单校验
rules: {
rackCode: [
{ required: true, message: "物料代码不能为空", trigger: "blur" }
],
},
materialInfoList: []
}
},
created(){
......@@ -198,16 +254,9 @@
this.$message.error("请扫描或输入料盘条形码");
return
}
const param = {
ID: this.generateUUID(),
OPTYPE: "I",
SHELF: this.$route.query.shelf,
COLOR: "1",
USERNAME: "admin",
TOTALINFO: [{RID: this.barCode}]
};
rackInOutput(JSON.stringify(param));
this.clearSelection();
this.getMaterialInfo();
this.form.rackCode = this.barCode;
this.open = true;
},
// 出库操作需要选择位置可多选不需要扫码
handleOut(){
......@@ -228,7 +277,11 @@
const locationInfo = this.shelfInfo[dom.dataset.index - 1];
param.TOTALINFO.push({RID: locationInfo.rid,LOCATION: locationInfo.location})
})
rackInOutput(JSON.stringify(param));
rackInOutput(JSON.stringify(param)).then(res =>{
if(res.code == 200){
this.msgSuccess("出库成功");
}
});
this.clearSelection();
},
//生成uuid
......@@ -277,6 +330,60 @@
if (this.ws) {
this.ws.close();
}
},
// 表单重置
reset() {
this.form = {
materialCode: null,
materialId: null,
materialCode: null,
materialName: null,
materialSpecifications: null,
};
this.resetForm("form");
},
//提交入库
submitForm(){
const param = {
inStoreParam: JSON.stringify(
{
ID: this.generateUUID(),
OPTYPE: "I",
SHELF: this.$route.query.shelf,
COLOR: "1",
USERNAME: "admin",
TOTALINFO: [{RID: this.barCode}]
}
),
relationParam: this.form
};
rackInOutput(JSON.stringify(param)).then(res =>{
if(res.code == 200){
this.open = false;
this.msgSuccess("入库成功");
this.clearSelection();
}
})
},
//取消入库
cancel(){
this.reset();
this.open = false;
},
//切换物料代码
materialCodeChange(val){
const materialInfo = this.materialInfoList.find(item => item.materialId = val);
this.form.materialId = val;
this.form.materialName = materialInfo.materialName;
this.form.materialSpecifications = materialInfo.materialSpecifications;
},
//获取物料信息
getMaterialInfo(){
materialInfoList().then(res =>{
if(res.code == 200){
this.materialInfoList = res.data;
}
})
}
},
beforeDestroy() {
......
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