'车间库位管理'

This commit is contained in:
xd 2024-03-15 09:05:05 +08:00
parent 8015a38940
commit ac45215146
13 changed files with 696 additions and 59 deletions

View File

@ -42,6 +42,7 @@ public class CacheController
caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交")); caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交"));
caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理")); caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理"));
caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数")); caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数"));
caches.add(new SysCache(CacheConstants.STORAGE_LOCATION, "车间库位号占用状态"));
} }
@PreAuthorize("@ss.hasPermi('monitor:cache:list')") @PreAuthorize("@ss.hasPermi('monitor:cache:list')")

View File

@ -0,0 +1,131 @@
package com.ruoyi.web.controller.storageLocation;
import com.ruoyi.clMaterial.domain.CYlMaterial;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.storageLocation.domain.StorageLocation;
import com.ruoyi.storageLocation.service.StorageLocationService;
import com.ruoyi.system.service.ISysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* 库位管理Controller
*/
@RestController
@RequestMapping("/storageLocation/storageLocation")
@DataSource(DataSourceType.STORAGE)
public class storageLocationController extends BaseController
{
@Autowired
private RedisCache redisCache;
@Autowired
private StorageLocationService storageLocationService;
@Autowired
private ISysConfigService configService;
/**
* 获取库位信息
*/
@GetMapping("/list")
public AjaxResult list(StorageLocation storageLocation)
{
AjaxResult ajaxResult = new AjaxResult();
List<StorageLocation> listA = storageLocationService.selectStorageLocationAList(storageLocation);
List<StorageLocation> listB = storageLocationService.selectStorageLocationBList(storageLocation);
List<StorageLocation> listC = storageLocationService.selectStorageLocationCList(storageLocation);
ajaxResult.put("materialDetailA",listA);
ajaxResult.put("materialDetailB",listB);
ajaxResult.put("materialDetailC",listC);
return ajaxResult;
}
/**
* 录入库位信息
*/
@Log(title = "录入库位信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody StorageLocation storageLocation)
{
String user_name = getLoginUser().getUsername();//当前登陆者
String materialBh = storageLocation.getMaterialBh();
String kw_user_name = redisCache.getCacheObject(getCacheKey(materialBh));
if(StringUtils.isNull(kw_user_name)){
return error("已超过有效录入信息时间,请关闭重新录入!");
}else if(!user_name.equals(kw_user_name)){
return error("已超过有效录入信息时间,当前库位有人正在操作!");
}else{
redisCache.setCacheObject(getCacheKey(materialBh),user_name);
return toAjax(storageLocationService.addStorageLocation(storageLocation));
}
}
/**
* 校验库位是否已占用
*/
@Log(title = "校验库位是否已占用", businessType = BusinessType.OTHER)
@PostMapping("/checkStorageLocation")
public AjaxResult checkStorageLocation(@RequestBody StorageLocation storageLocation)
{
String storageExpire = configService.selectConfigByKey("storage.expire");
String user_name = getLoginUser().getUsername();//当前登陆者
String materialBh = storageLocation.getMaterialBh();
String kw_user_name = redisCache.getCacheObject(getCacheKey(materialBh));
if(StringUtils.isNotNull(kw_user_name)&&!user_name.equals(kw_user_name)){
return error("当前库位有人正在操作,请勿操作!");
}else{
redisCache.setCacheObject(getCacheKey(materialBh),user_name,Integer.valueOf(storageExpire), TimeUnit.SECONDS);
return success();
}
}
/**
* 弹窗取消按钮 清除库位缓存
*/
@Log(title = "校验库位是否已占用", businessType = BusinessType.OTHER)
@PostMapping("/cancelStorageLocation")
public AjaxResult cancelStorageLocation(@RequestBody StorageLocation storageLocation)
{
String storageExpire = configService.selectConfigByKey("storage.expire");
String user_name = getLoginUser().getUsername();//当前登陆者
String materialBh = storageLocation.getMaterialBh();
String kw_user_name = redisCache.getCacheObject(getCacheKey(materialBh));
if(StringUtils.isNotNull(kw_user_name)&&user_name.equals(kw_user_name)){
redisCache.deleteObject(getCacheKey(materialBh));
}
return success();
}
/**
* 库位缓存键名
*
* @param materialBh 库位号
* @return 缓存键key
*/
private String getCacheKey(String materialBh)
{
return CacheConstants.STORAGE_LOCATION + materialBh;
}
}

View File

@ -36,6 +36,15 @@ spring:
url: jdbc:sqlserver://192.168.9.2:1433;DatabaseName=jn_erp url: jdbc:sqlserver://192.168.9.2:1433;DatabaseName=jn_erp
username: sa username: sa
password: it12345 password: it12345
# 车间库位管理数据库数据源
storage:
# 从数据源开关/默认关闭
enabled: true
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
# 正式数据库
url: jdbc:sqlserver://192.168.9.99:1433;DatabaseName=jn_storage
username: sa
password: Itcenter110-
# 初始连接数 # 初始连接数
initialSize: 10 initialSize: 10
# 最小连接池数量 # 最小连接池数量

View File

@ -41,4 +41,9 @@ public class CacheConstants
* 登录账户密码错误次数 redis key * 登录账户密码错误次数 redis key
*/ */
public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:"; public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:";
/**
* 一车间库位号占用状态 redis key
*/
public static final String STORAGE_LOCATION = "storage_location:";
} }

View File

@ -25,6 +25,11 @@ public enum DataSourceType
/** /**
* 江南ERP数据库 * 江南ERP数据库
*/ */
JNERP JNERP,
/**
* 车间库位管理数据库
*/
STORAGE
} }

View File

@ -67,6 +67,15 @@ public class DruidConfig
return druidProperties.dataSource(dataSource); return druidProperties.dataSource(dataSource);
} }
@Bean
@ConfigurationProperties("spring.datasource.druid.storage")
@ConditionalOnProperty(prefix = "spring.datasource.druid.storage", name = "enabled", havingValue = "true")
public DataSource storageDataSource(DruidProperties druidProperties)
{
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
return druidProperties.dataSource(dataSource);
}
@Bean(name = "dynamicDataSource") @Bean(name = "dynamicDataSource")
@Primary @Primary
public DynamicDataSource dataSource(DataSource masterDataSource) public DynamicDataSource dataSource(DataSource masterDataSource)
@ -76,6 +85,7 @@ public class DruidConfig
setDataSource(targetDataSources, DataSourceType.REDBOOK.name(), "redbookDataSource"); setDataSource(targetDataSources, DataSourceType.REDBOOK.name(), "redbookDataSource");
setDataSource(targetDataSources, DataSourceType.QUOT.name(), "quotDataSource"); setDataSource(targetDataSources, DataSourceType.QUOT.name(), "quotDataSource");
setDataSource(targetDataSources, DataSourceType.JNERP.name(), "jnerpDataSource"); setDataSource(targetDataSources, DataSourceType.JNERP.name(), "jnerpDataSource");
setDataSource(targetDataSources, DataSourceType.STORAGE.name(), "storageDataSource");
return new DynamicDataSource(masterDataSource, targetDataSources); return new DynamicDataSource(masterDataSource, targetDataSources);
} }

View File

@ -0,0 +1,69 @@
package com.ruoyi.storageLocation.domain;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 库位管理对象 StorageLocation
*
* @author ruoyi
* @date 2024-02-28
*/
public class StorageLocation extends BaseEntity
{
private static final long serialVersionUID = 1L;
private String materialBh;
private String materialXingh;
private String materialGuig;
private String materialDiany;
private String materialMs;
private String materialState;
public String getMaterialBh() {
return materialBh;
}
public void setMaterialBh(String materialBh) {
this.materialBh = materialBh;
}
public String getMaterialXingh() {
return materialXingh;
}
public void setMaterialXingh(String materialXingh) {
this.materialXingh = materialXingh;
}
public String getMaterialGuig() {
return materialGuig;
}
public void setMaterialGuig(String materialGuig) {
this.materialGuig = materialGuig;
}
public String getMaterialDiany() {
return materialDiany;
}
public void setMaterialDiany(String materialDiany) {
this.materialDiany = materialDiany;
}
public String getMaterialMs() {
return materialMs;
}
public void setMaterialMs(String materialMs) {
this.materialMs = materialMs;
}
public String getMaterialState() {
return materialState;
}
public void setMaterialState(String materialState) {
this.materialState = materialState;
}
}

View File

@ -0,0 +1,31 @@
package com.ruoyi.storageLocation.mapper;
import com.ruoyi.storageLocation.domain.StorageLocation;
import java.util.List;
/**
* 库位管理Mapper接口
*
* @author ruoyi
* @date 2024-02-28
*/
public interface StorageLocationMapper
{
/**
* 获取库位信息
* @param storageLocation
* @return
*/
List<StorageLocation> selectStorageLocationAList(StorageLocation storageLocation);
List<StorageLocation> selectStorageLocationBList(StorageLocation storageLocation);
List<StorageLocation> selectStorageLocationCList(StorageLocation storageLocation);
/**
* 录入库位信息
* @param storageLocation
* @return
*/
int addStorageLocation(StorageLocation storageLocation);
}

View File

@ -0,0 +1,32 @@
package com.ruoyi.storageLocation.service;
import com.ruoyi.clMaterial.domain.CYlMaterial;
import com.ruoyi.storageLocation.domain.StorageLocation;
import java.util.List;
/**
* 库位管理Service接口
*
* @author ruoyi
* @date 2024-02-28
*/
public interface StorageLocationService
{
/**
* 获取库位信息
* @param storageLocation
* @return
*/
List<StorageLocation> selectStorageLocationAList(StorageLocation storageLocation);
List<StorageLocation> selectStorageLocationBList(StorageLocation storageLocation);
List<StorageLocation> selectStorageLocationCList(StorageLocation storageLocation);
/**
* 录入库位信息
* @param storageLocation
* @return
*/
int addStorageLocation(StorageLocation storageLocation);
}

View File

@ -0,0 +1,50 @@
package com.ruoyi.storageLocation.service.impl;
import com.ruoyi.storageLocation.domain.StorageLocation;
import com.ruoyi.storageLocation.mapper.StorageLocationMapper;
import com.ruoyi.storageLocation.service.StorageLocationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 库位管理Service业务层处理
*
* @author ruoyi
* @date 2024-02-28
*/
@Service
public class StorageLocationServiceImpl implements StorageLocationService
{
@Autowired
private StorageLocationMapper storageLocationMapper;
/**
* 获取库位信息
* @param storageLocation
* @return
*/
@Override
public List<StorageLocation> selectStorageLocationAList(StorageLocation storageLocation) {
return storageLocationMapper.selectStorageLocationAList(storageLocation);
}
@Override
public List<StorageLocation> selectStorageLocationBList(StorageLocation storageLocation) {
return storageLocationMapper.selectStorageLocationBList(storageLocation);
}
@Override
public List<StorageLocation> selectStorageLocationCList(StorageLocation storageLocation) {
return storageLocationMapper.selectStorageLocationCList(storageLocation);
}
/**
* 录入库位信息
* @param storageLocation
* @return
*/
@Override
public int addStorageLocation(StorageLocation storageLocation) {
return storageLocationMapper.addStorageLocation(storageLocation);
}
}

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.storageLocation.mapper.StorageLocationMapper">
<resultMap type="StorageLocation" id="StorageLocationResult">
<result property="materialBh" column="materialBh" />
<result property="materialXingh" column="materialXingh" />
<result property="materialGuig" column="materialGuig" />
<result property="materialDiany" column="materialDiany" />
<result property="materialMs" column="materialMs" />
<result property="materialState" column="materialState" />
</resultMap>
<select id="selectStorageLocationAList" parameterType="StorageLocation" resultMap="StorageLocationResult">
select materialBh, materialXingh, materialGuig, materialDiany, materialMs, materialState
from storageLocation where materialBh like 'A%'
</select>
<select id="selectStorageLocationBList" parameterType="StorageLocation" resultMap="StorageLocationResult">
select materialBh, materialXingh, materialGuig, materialDiany, materialMs, materialState
from storageLocation where materialBh like 'B%'
</select>
<select id="selectStorageLocationCList" parameterType="StorageLocation" resultMap="StorageLocationResult">
select materialBh, materialXingh, materialGuig, materialDiany, materialMs, materialState
from storageLocation where materialBh like 'C%'
</select>
<update id="addStorageLocation" parameterType="StorageLocation">
update storageLocation
<trim prefix="SET" suffixOverrides=",">
<if test="materialXingh != null and materialXingh != ''">materialXingh = #{materialXingh},</if>
<if test="materialGuig != null and materialGuig != ''">materialGuig = #{materialGuig},</if>
<if test="materialDiany != null and materialDiany != ''">materialDiany = #{materialDiany},</if>
<if test="materialMs != null and materialMs != ''">materialMs = #{materialMs},</if>
materialState = '1'
</trim>
where materialBh = #{materialBh}
</update>
</mapper>

View File

@ -0,0 +1,37 @@
import request from '@/utils/request'
// 获取库位信息
export function listStorageLocation(query) {
return request({
url: '/storageLocation/storageLocation/list',
method: 'get',
params: query
})
}
// 录入库位信息
export function addStorageLocation(data) {
return request({
url: '/storageLocation/storageLocation',
method: 'post',
data: data
})
}
// 校验库位是否已占用
export function checkStorageLocation(data) {
return request({
url: '/storageLocation/storageLocation/checkStorageLocation',
method: 'post',
data: data
})
}
// 弹窗取消按钮 清除库位缓存
export function cancelStorageLocation(data) {
return request({
url: '/storageLocation/storageLocation/cancelStorageLocation',
method: 'post',
data: data
})
}

View File

@ -1,23 +1,37 @@
<template> <template>
<div style="margin-top: 10px;margin-left: 5px; margin-right: 5px;"> <div style="margin-top: 5px;">
<el-row> <div style="margin-left: 5px; margin-right: 5px;">
<el-row :gutter="10" style="letter-spacing: 5px;">
<el-col :span="8"> <el-col :span="8">
<el-card class="box-card" style="background-color: yellow;" :body-style="{backgroundColor: '#fff' }"> <div class="grid-content bg-purpleA">黄色线芯A区({{countA}})</div>
<div slot="header" class="clearfix"> </el-col>
<span>黄色线芯A区</span> <el-col :span="8">
</div> <div class="grid-content bg-purpleB">绿色线芯B区({{countB}})</div>
<el-descriptions border :column="2" size="small" v-for="(item,index) in materialDetailA" :key="item.materialBh"> </el-col>
<el-col :span="8">
<div class="grid-content bg-purpleC">红色线芯C区({{countC}})</div>
</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="8">
<el-card class="box-card scrollable">
<el-descriptions border :column="2" size="small" :style="index==0?'': 'margin-top :15px'" v-for="(item,index) in materialDetailA" :key="item.materialBh">
<el-descriptions-item> <el-descriptions-item>
<template slot="label"> <template slot="label">
库位 库位
</template> </template>
<span style="font-size: 15px;color: black">{{item.materialBh}}</span> <span class="kw">{{item.materialBh}}</span>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item :contentStyle="{'text-align': 'center'}">
<template slot="label"> <template slot="label">
状态 状态
</template> </template>
<el-button size="mini" type="success" icon="el-icon-check" circle></el-button> <span v-if = "item.materialState=='0'">
<el-tag size="mini" type="success" @click="openDialog(item)">空闲</el-tag>
</span>
<span v-if = "item.materialState=='1'">
<el-tag size="mini" type="danger">已用</el-tag>
</span>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item :span="2"> <el-descriptions-item :span="2">
<template slot="label"> <template slot="label">
@ -47,16 +61,24 @@
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-card class="box-card" style="background-color: green;" :body-style="{backgroundColor: '#fff' }"> <el-card class="box-card scrollable">
<div slot="header" class="clearfix"> <el-descriptions border :column="2" size="small" :style="index==0?'': 'margin-top :12px'" v-for="(item,index) in materialDetailB" :key="item.materialBh">
<span>绿色线芯B区</span> <el-descriptions-item>
</div>
<el-descriptions border :column="2" size="small" v-for="(item,index) in materialDetailB" :key="item.materialBh">
<el-descriptions-item :span="2">
<template slot="label"> <template slot="label">
库位 库位
</template> </template>
<span style="font-size: 15px;color: black">{{item.materialBh}}</span> <span class="kw">{{item.materialBh}}</span>
</el-descriptions-item>
<el-descriptions-item :contentStyle="{'text-align': 'center'}">
<template slot="label">
状态
</template>
<span v-if = "item.materialState=='0'">
<el-tag size="mini" type="success" @click="openDialog(item)">空闲</el-tag>
</span>
<span v-if = "item.materialState=='1'">
<el-tag size="mini" type="danger">已用</el-tag>
</span>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item :span="2"> <el-descriptions-item :span="2">
<template slot="label"> <template slot="label">
@ -86,16 +108,24 @@
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-card class="box-card" style="background-color: red;" :body-style="{backgroundColor: '#fff' }"> <el-card class="box-card scrollable">
<div slot="header" class="clearfix"> <el-descriptions border :column="2" size="small" :style="index==0?'': 'margin-top :12px'" v-for="(item,index) in materialDetailC" :key="item.materialBh">
<span>红色线芯C区</span> <el-descriptions-item>
</div>
<el-descriptions border :column="2" size="small" v-for="(item,index) in materialDetailC" :key="item.materialBh">
<el-descriptions-item :span="2">
<template slot="label"> <template slot="label">
库位 库位
</template> </template>
<span style="font-size: 15px;color: black">{{item.materialBh}}</span> <span class="kw">{{item.materialBh}}</span>
</el-descriptions-item>
<el-descriptions-item :contentStyle="{'text-align': 'center'}">
<template slot="label">
状态
</template>
<span v-if = "item.materialState=='0'">
<el-tag size="mini" type="success" @click="openDialog(item)">空闲</el-tag>
</span>
<span v-if = "item.materialState=='1'">
<el-tag size="mini" type="danger">已用</el-tag>
</span>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item :span="2"> <el-descriptions-item :span="2">
<template slot="label"> <template slot="label">
@ -126,47 +156,233 @@
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
<!-- 添加或修改材料管理对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="12">
<el-form-item label="库位" prop="materialBh">
<el-input v-model="form.materialBh"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="型号" prop="materialXingh">
<el-input v-model="form.materialXingh" placeholder="请输入型号"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="规格" prop="materialGuig">
<el-input v-model="form.materialGuig" placeholder="请输入规格"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="电压等级" prop="materialDiany">
<el-input v-model="form.materialDiany" placeholder="请输入电压等级" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="米数" prop="materialMs">
<el-input v-model="form.materialMs" placeholder="请输入米数" />
</el-form-item>
</el-col>
</el-row>
</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> </template>
<style>
/*库位号样式*/
.kw{
font-size: 15px;color: black;font-weight: bold
}
/*卡片内容滚动条设置*/
::-webkit-scrollbar {
display: none; /* Chrome Safari */
}
.scrollable{
overflow: auto; /* 自动开启滚动条 */
max-height: 650px; /* 设置最大高度 */
}
/*最上方三大块样式*/
.grid-content {
border-radius: 4px;
min-height: 36px;
display: flex; /* 设置为 Flexbox */
justify-content: center; /* 水平居中 */
align-items: center; /* 垂直居中 */
}
.bg-purpleA {
background: #e6a700;
color: white;
font-weight: bold
}
.bg-purpleB {
background: green;
color: white;
font-weight: bold
}
.bg-purpleC {
background: red;
color: white;
font-weight: bold
}
</style>
<script> <script>
import { listStorageLocation, addStorageLocation, checkStorageLocation,cancelStorageLocation } from "@/api/storageLocation/storageLocation";
export default { export default {
name: "locationSet", name: "locationSet",
data() { data() {
return { return {
queryParams: {
materialBh: null,
materialXingh: null,
materialGuig: null,
materialDiany: null,
materialMs: null
},
//
title: "",
//
open: false,
//
materialDetailA:[],
materialDetailB:[],
materialDetailC:[],
//
form: {},
//
rules: {
materialXingh: [
{ required: true, message: "型号不能为空", trigger: "blur" }
],
materialGuig: [
{ required: true, message: "规格不能为空", trigger: "blur" }
],
materialDiany: [
{ required: true, message: "电压等级不能为空", trigger: "blur" }
],
materialMs: [
{ required: true, message: "米数不能为空", trigger: "blur" }
],
},
//线 //线
materialDetailA: [{materialBh:'A-1', materialXingh: 'YJV', materialGuig: '1*10', materialDiany: '1kV', materialMs: '1.5'}, /* materialDetailA: [{materialBh:'A-1', materialXingh: 'YJV', materialGuig: '1*10', materialDiany: '1kV', materialMs: '1.5', materialState:'0'},
{materialBh:'A-2',materialXingh: 'YJV2', materialGuig: '2*10', materialDiany: '2kV', materialMs: '2.5'}, {materialBh:'A-2',materialXingh: 'YJV2', materialGuig: '2*10', materialDiany: '2kV', materialMs: '2.5', materialState:'0'},
{materialBh:'A-3',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5'}, {materialBh:'A-3',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5', materialState:'1'},
{materialBh:'A-4',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5'}, {materialBh:'A-4',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5', materialState:'0'},
{materialBh:'A-5',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5'}, {materialBh:'A-5',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5', materialState:'1'},
{materialBh:'A-6',materialXingh: 'YJV2', materialGuig: '2*10', materialDiany: '2kV', materialMs: '2.5'}, {materialBh:'A-6',materialXingh: 'YJV2', materialGuig: '2*10', materialDiany: '2kV', materialMs: '2.5', materialState:'0'},
{materialBh:'A-7',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5'}, {materialBh:'A-7',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5', materialState:'1'},
{materialBh:'A-8',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5'}], {materialBh:'A-8',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5', materialState:'0'}],
materialDetailB: [{materialBh:'B-1',materialXingh: 'YJV', materialGuig: '1*10', materialDiany: '1kV', materialMs: '1.5'}, materialDetailB: [{materialBh:'B-1',materialXingh: 'YJV', materialGuig: '1*10', materialDiany: '1kV', materialMs: '1.5', materialState:'1'},
{materialBh:'B-2',materialXingh: 'YJV2', materialGuig: '2*10', materialDiany: '2kV', materialMs: '2.5'}, {materialBh:'B-2',materialXingh: 'YJV2', materialGuig: '2*10', materialDiany: '2kV', materialMs: '2.5', materialState:'0'},
{materialBh:'B-3',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5'}, {materialBh:'B-3',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5', materialState:'1'},
{materialBh:'B-4',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5'}, {materialBh:'B-4',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5', materialState:'0'},
{materialBh:'B-5',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5'}, {materialBh:'B-5',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5', materialState:'1'},
{materialBh:'B-6',materialXingh: 'YJV2', materialGuig: '2*10', materialDiany: '2kV', materialMs: '2.5'}, {materialBh:'B-6',materialXingh: 'YJV2', materialGuig: '2*10', materialDiany: '2kV', materialMs: '2.5', materialState:'0'},
{materialBh:'B-7',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5'}, {materialBh:'B-7',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5', materialState:'1'},
{materialBh:'B-8',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5'}], {materialBh:'B-8',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5', materialState:'0'}],
materialDetailC: [{materialBh:'C-1',materialXingh: 'YJV', materialGuig: '1*10', materialDiany: '1kV', materialMs: '1.5'}, materialDetailC: [{materialBh:'C-1',materialXingh: 'YJV', materialGuig: '1*10', materialDiany: '1kV', materialMs: '1.5', materialState:'0'},
{materialBh:'C-2',materialXingh: 'YJV2', materialGuig: '2*10', materialDiany: '2kV', materialMs: '2.5'}, {materialBh:'C-2',materialXingh: 'YJV2', materialGuig: '2*10', materialDiany: '2kV', materialMs: '2.5', materialState:'1'},
{materialBh:'C-3',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5'}, {materialBh:'C-3',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5', materialState:'0'},
{materialBh:'C-4',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5'}, {materialBh:'C-4',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5', materialState:'1'},
{materialBh:'C-5',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5'}, {materialBh:'C-5',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5', materialState:'0'},
{materialBh:'C-6',materialXingh: 'YJV2', materialGuig: '2*10', materialDiany: '2kV', materialMs: '2.5'}, {materialBh:'C-6',materialXingh: 'YJV2', materialGuig: '2*10', materialDiany: '2kV', materialMs: '2.5', materialState:'1'},
{materialBh:'C-7',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5'}, {materialBh:'C-7',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5', materialState:'0'},
{materialBh:'C-8',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5'}], {materialBh:'C-8',materialXingh: 'YJV3', materialGuig: '3*10', materialDiany: '3kV', materialMs: '3.5', materialState:'1'}],*/
}
},
created() {
/*获取库位信息*/
this.getStorageLocation();
},
computed:{
countA(){
// 使 find
return this.materialDetailA.filter(task => task.materialState === '0').length;
},
countB(){
// 使 find
return this.materialDetailB.filter(task => task.materialState === '0').length;
},
countC(){
// 使 find
return this.materialDetailC.filter(task => task.materialState === '0').length;
}
},
methods: {
/*获取库位信息*/
getStorageLocation(){
listStorageLocation(this.queryParams).then(response => {
this.materialDetailA = response.materialDetailA;
this.materialDetailB = response.materialDetailB;
this.materialDetailC = response.materialDetailC;
});
},
/** 打开录入弹窗 */
openDialog(item) {
//
this.form.materialBh = item.materialBh;
checkStorageLocation(this.form).then(response => {
this.reset();
this.open = true;
this.title = "录入信息";
this.form.materialBh = item.materialBh;
}).catch((error) => {
console.error(error);
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
addStorageLocation(this.form).then(response => {
this.$modal.msgSuccess("录入成功");
this.open = false;
this.getStorageLocation();
});
}
});
},
//
cancel() {
cancelStorageLocation(this.form).then(response => {
this.open = false;
this.reset();
}).catch((error) => {
console.error(error);
});
},
//
reset() {
this.form = {
materialBh: null,
materialXingh: null,
materialGuig: null,
materialDiany: null,
materialMs: null
};
this.resetForm("form");
} }
} }
} }
</script> </script>
<style scoped>
</style>