add:物料
This commit is contained in:
@@ -1,2 +0,0 @@
|
|||||||
|
|
||||||
N java:S106."9Replace this use of System.out or System.err by a logger.(<28><><EFBFBD><EFBFBD>
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
|
|
||||||
k java:S117I"QRename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
k java:S117N"QRename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(<28><>Ђ<EFBFBD><D082><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
4
wms_pro/hd/.idea/sonarlint/issuestore/index.pb
generated
4
wms_pro/hd/.idea/sonarlint/issuestore/index.pb
generated
@@ -3,8 +3,6 @@ q
|
|||||||
Anladmin-system/src/main/java/org/nl/common/anno/Datazhuazhua.java,3/6/363ec6c9460095b38992146a934751ba30bef9af
|
Anladmin-system/src/main/java/org/nl/common/anno/Datazhuazhua.java,3/6/363ec6c9460095b38992146a934751ba30bef9af
|
||||||
<EFBFBD>
|
<EFBFBD>
|
||||||
Ynladmin-system/src/main/java/org/nl/wms/system_manage/controller/dept/DeptController.java,a/a/aa9ec186e2a7aa1989de50b7632ac6126cea19a9
|
Ynladmin-system/src/main/java/org/nl/wms/system_manage/controller/dept/DeptController.java,a/a/aa9ec186e2a7aa1989de50b7632ac6126cea19a9
|
||||||
_
|
|
||||||
/nladmin-system/src/main/java/org/nl/AppRun.java,1/0/10e40d67bd7d0818c5483704f020703d1bef8378
|
|
||||||
<EFBFBD>
|
<EFBFBD>
|
||||||
_nladmin-system/src/main/java/org/nl/wms/system_manage/controller/monitor/MonitorController.java,5/b/5bf8a103b07bcc6e53d76381558cf3ce51acec97
|
_nladmin-system/src/main/java/org/nl/wms/system_manage/controller/monitor/MonitorController.java,5/b/5bf8a103b07bcc6e53d76381558cf3ce51acec97
|
||||||
<EFBFBD>
|
<EFBFBD>
|
||||||
@@ -51,5 +49,3 @@ inladmin-system/src/main/java/org/nl/wms/base_manage/field_mapping/service/dao/B
|
|||||||
vnladmin-system/src/main/java/org/nl/wms/base_manage/field_mapping/service/dao/mapper/BmExternalFieldMappingMapper.java,3/8/3828de74f3f9d1252984dd2c3524e61bc6632160
|
vnladmin-system/src/main/java/org/nl/wms/base_manage/field_mapping/service/dao/mapper/BmExternalFieldMappingMapper.java,3/8/3828de74f3f9d1252984dd2c3524e61bc6632160
|
||||||
<EFBFBD>
|
<EFBFBD>
|
||||||
ynladmin-system/src/main/java/org/nl/wms/base_manage/field_mapping/service/dao/mapper/xml/BmExternalFieldMappingMapper.xml,8/5/8579f2942008652ebd59f8eed6fafca608a42516
|
ynladmin-system/src/main/java/org/nl/wms/base_manage/field_mapping/service/dao/mapper/xml/BmExternalFieldMappingMapper.xml,8/5/8579f2942008652ebd59f8eed6fafca608a42516
|
||||||
<EFBFBD>
|
|
||||||
rnladmin-system/src/main/java/org/nl/wms/base_manage/field_mapping/controller/BmExternalFieldMappingController.java,4/9/491288c6a971edd368823e6e6d6a676827d0d7b8
|
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
package org.nl.wms.base_manage.material.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import org.nl.common.TableDataInfo;
|
||||||
|
import org.nl.common.domain.entity.PageQuery;
|
||||||
|
import org.nl.common.utils.RedissonUtils;
|
||||||
|
import org.nl.wms.base_manage.material.service.IBmMaterialService;
|
||||||
|
import org.nl.wms.base_manage.material.service.dao.BmMaterial;
|
||||||
|
import org.nl.wms.base_manage.material.service.dto.MaterialQuery;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 物料基本信息表 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2023-04-26
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/bmMaterial")
|
||||||
|
public class BmMaterialController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IBmMaterialService materialService;
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public ResponseEntity<Object> getAll(MaterialQuery query, PageQuery page) {
|
||||||
|
return new ResponseEntity<>(TableDataInfo.build(materialService.page(page.build(), query.build())), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public ResponseEntity<Object> create(@Validated @RequestBody BmMaterial dto) {
|
||||||
|
materialService.save(dto);
|
||||||
|
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
public ResponseEntity<Object> update(@Validated @RequestBody BmMaterial dto) {
|
||||||
|
materialService.update(dto, new LambdaUpdateWrapper<BmMaterial>().eq(BmMaterial::getMaterial_id, dto.getMaterial_id()));
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@DeleteMapping
|
||||||
|
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||||
|
if (ids.length > 0) {
|
||||||
|
materialService.removeByIds(Arrays.asList(ids));
|
||||||
|
}
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/excelImport")
|
||||||
|
public ResponseEntity<Object> excelImport(@RequestParam("file") MultipartFile file, HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
RedissonUtils.lock(() ->
|
||||||
|
{
|
||||||
|
materialService.excelImport(file, request, response);
|
||||||
|
}, "物料基础信息导入", null);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package org.nl.wms.base_manage.material.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.nl.wms.base_manage.material.service.dao.BmMaterial;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 物料基本信息表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2023-04-26
|
||||||
|
*/
|
||||||
|
public interface IBmMaterialService extends IService<BmMaterial>{
|
||||||
|
/**
|
||||||
|
* 物料基础信息导入
|
||||||
|
*/
|
||||||
|
void excelImport(MultipartFile file, HttpServletRequest request, HttpServletResponse response)
|
||||||
|
throws IOException;
|
||||||
|
|
||||||
|
List<Map> pageQuery(Map whereJson);
|
||||||
|
|
||||||
|
void create(BmMaterial entity);
|
||||||
|
}
|
||||||
@@ -0,0 +1,150 @@
|
|||||||
|
package org.nl.wms.base_manage.material.service.dao;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 物料基本信息表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2023-04-26
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName("bm_material")
|
||||||
|
public class BmMaterial implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
/**
|
||||||
|
* 车间
|
||||||
|
*/
|
||||||
|
private String product_area;
|
||||||
|
/**
|
||||||
|
* 物料标识
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private String material_id;
|
||||||
|
/**
|
||||||
|
* 物料编码
|
||||||
|
*/
|
||||||
|
private String material_code;
|
||||||
|
/**
|
||||||
|
* 物料名称
|
||||||
|
*/
|
||||||
|
private String material_name;
|
||||||
|
/**
|
||||||
|
* 规格
|
||||||
|
*/
|
||||||
|
private String material_spec;
|
||||||
|
/**
|
||||||
|
* 型号
|
||||||
|
*/
|
||||||
|
private String material_model;
|
||||||
|
/**
|
||||||
|
* 外文名称
|
||||||
|
*/
|
||||||
|
private String english_name;
|
||||||
|
/**
|
||||||
|
* 基本计量单位
|
||||||
|
*/
|
||||||
|
private String base_unit_id;
|
||||||
|
/**
|
||||||
|
* 辅助计量单位
|
||||||
|
*/
|
||||||
|
private String assist_unit_id;
|
||||||
|
/**
|
||||||
|
* 批准文号
|
||||||
|
*/
|
||||||
|
private String approve_fileno;
|
||||||
|
/**
|
||||||
|
* 工程图号
|
||||||
|
*/
|
||||||
|
private String print_no;
|
||||||
|
/**
|
||||||
|
* 物料分类标识
|
||||||
|
*/
|
||||||
|
private String material_type_id;
|
||||||
|
/**
|
||||||
|
* 长度单位
|
||||||
|
*/
|
||||||
|
private String len_unit_id;
|
||||||
|
/**
|
||||||
|
* 物料长度
|
||||||
|
*/
|
||||||
|
private BigDecimal length;
|
||||||
|
/**
|
||||||
|
* 物料宽度
|
||||||
|
*/
|
||||||
|
private BigDecimal width;
|
||||||
|
/**
|
||||||
|
* 物料高度
|
||||||
|
*/
|
||||||
|
private BigDecimal height;
|
||||||
|
/**
|
||||||
|
* 重量单位
|
||||||
|
*/
|
||||||
|
private String weight_unit_id;
|
||||||
|
/**
|
||||||
|
* 物料毛重
|
||||||
|
*/
|
||||||
|
private BigDecimal gross_weight;
|
||||||
|
/**
|
||||||
|
* 物料净重
|
||||||
|
*/
|
||||||
|
private BigDecimal net_weight;
|
||||||
|
/**
|
||||||
|
* 体积单位
|
||||||
|
*/
|
||||||
|
private String cubage_unit_id;
|
||||||
|
/**
|
||||||
|
* 物料体积
|
||||||
|
*/
|
||||||
|
private BigDecimal cubage;
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String create_id;
|
||||||
|
/**
|
||||||
|
* 创建人姓名
|
||||||
|
*/
|
||||||
|
private String create_name;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private String create_time;
|
||||||
|
/**
|
||||||
|
* 修改人
|
||||||
|
*/
|
||||||
|
private String update_id;
|
||||||
|
/**
|
||||||
|
* 修改人姓名
|
||||||
|
*/
|
||||||
|
private String update_name;
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private String update_time;
|
||||||
|
/**
|
||||||
|
* 启用时间
|
||||||
|
*/
|
||||||
|
private String is_used_time;
|
||||||
|
/**
|
||||||
|
* 是否启用
|
||||||
|
*/
|
||||||
|
private Boolean is_used;
|
||||||
|
/**
|
||||||
|
* 是否删除
|
||||||
|
*/
|
||||||
|
private Boolean is_delete;
|
||||||
|
/**
|
||||||
|
* 外部标识
|
||||||
|
*/
|
||||||
|
private String ext_id;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package org.nl.wms.base_manage.material.service.dao.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.nl.common.domain.entity.PageQuery;
|
||||||
|
import org.nl.wms.base_manage.material.service.dao.BmMaterial;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 物料基本信息表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2023-04-26
|
||||||
|
*/
|
||||||
|
public interface BmMaterialMapper extends BaseMapper<BmMaterial> {
|
||||||
|
|
||||||
|
|
||||||
|
List<Map> queryAll(Map whereJson);
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<?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="org.nl.wms.base_manage.material.service.dao.mapper.BmMaterialMapper">
|
||||||
|
<select id="queryAll" resultType="java.util.Map">
|
||||||
|
SELECT
|
||||||
|
mb.*,
|
||||||
|
class.class_code,
|
||||||
|
class.class_name,
|
||||||
|
unit_name, '50' as standard_weight,
|
||||||
|
unit_name as base_unit_name,
|
||||||
|
class2.class_code as product_series_code,
|
||||||
|
class2.class_name as product_series_name
|
||||||
|
FROM
|
||||||
|
md_me_materialbase mb
|
||||||
|
LEFT JOIN MD_PB_ClassStandard class ON class.class_id = mb.material_type_id
|
||||||
|
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = mb.base_unit_id
|
||||||
|
left join MD_PB_ClassStandard class2 on class2.class_id =mb.product_series
|
||||||
|
WHERE mb.is_delete = '0'
|
||||||
|
<if test="idssql != null and idssql != ''">
|
||||||
|
and ${idssql}
|
||||||
|
</if>
|
||||||
|
<if test="search != null and search != ''">
|
||||||
|
and (
|
||||||
|
mb.material_code like '%${search}%'
|
||||||
|
OR
|
||||||
|
mb.material_name like '%${search}%'
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="class_code != null and class_code != ''">
|
||||||
|
and class.class_code like '%${class_code}%'
|
||||||
|
</if>
|
||||||
|
<if test="raw_material_code != null and raw_material_code != ''">
|
||||||
|
and mb.material_code like '${raw_material_code}%'
|
||||||
|
</if>
|
||||||
|
<if test="classIds != null and classIds != ''">
|
||||||
|
and class.class_id in ${classIds}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package org.nl.wms.base_manage.material.service.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.nl.common.domain.entity.BaseQuery;
|
||||||
|
import org.nl.common.domain.entity.QParam;
|
||||||
|
import org.nl.common.enums.QueryTEnum;
|
||||||
|
import org.nl.wms.base_manage.field_mapping.service.dao.BmExternalFieldMapping;
|
||||||
|
import org.nl.wms.base_manage.material.service.dao.BmMaterial;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @author ZZQ
|
||||||
|
* @Date 2023/5/4 19:49
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MaterialQuery extends BaseQuery<BmMaterial> {
|
||||||
|
|
||||||
|
|
||||||
|
private String local_table_name;
|
||||||
|
private String search;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void paramMapping() {
|
||||||
|
super.doP.put("local_table_name", QParam.builder().k(new String[]{"local_table_name"}).type(QueryTEnum.EQ).build());
|
||||||
|
super.doP.put("search", QParam.builder().k(new String[]{"local_field_name", "external_field_name"}).type(QueryTEnum.EQ).build());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package org.nl.wms.base_manage.material.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.poi.excel.ExcelReader;
|
||||||
|
import cn.hutool.poi.excel.ExcelUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.nl.common.domain.exception.BadRequestException;
|
||||||
|
import org.nl.common.utils.IdUtil;
|
||||||
|
import org.nl.common.utils.SecurityUtils;
|
||||||
|
import org.nl.wms.base_manage.material.service.IBmMaterialService;
|
||||||
|
import org.nl.wms.base_manage.material.service.dao.BmMaterial;
|
||||||
|
import org.nl.wms.base_manage.material.service.dao.mapper.BmMaterialMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 物料基本信息表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2023-04-26
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class BmMaterialServiceImpl extends ServiceImpl<BmMaterialMapper, BmMaterial> implements IBmMaterialService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map> pageQuery(Map whereJson) {
|
||||||
|
return this.baseMapper.queryAll(whereJson);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void create(BmMaterial entity) {
|
||||||
|
this.baseMapper.insert(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void excelImport(MultipartFile file, HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
35
wms_pro/qd/src/api/wms/base_manage/material/material.js
Normal file
35
wms_pro/qd/src/api/wms/base_manage/material/material.js
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function add(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/bmMaterial',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function del(ids) {
|
||||||
|
return request({
|
||||||
|
url: 'api/bmMaterial',
|
||||||
|
method: 'delete',
|
||||||
|
data: ids
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function edit(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/bmMaterial',
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function excelImport(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/mdMeMaterialbase/excelImport',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default { add, edit, del, excelImport }
|
||||||
124
wms_pro/qd/src/views/wms/base_manage/material/UploadDialog.vue
Normal file
124
wms_pro/qd/src/views/wms/base_manage/material/UploadDialog.vue
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
title="导入Excel文件"
|
||||||
|
append-to-body
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
destroy-on-close
|
||||||
|
width="400px"
|
||||||
|
:show-close="true"
|
||||||
|
@close="close"
|
||||||
|
@open="open"
|
||||||
|
>
|
||||||
|
<el-upload
|
||||||
|
ref="upload"
|
||||||
|
class="upload-demo"
|
||||||
|
action=""
|
||||||
|
drag
|
||||||
|
:on-exceed="is_one"
|
||||||
|
:limit="1"
|
||||||
|
:auto-upload="false"
|
||||||
|
:multiple="false"
|
||||||
|
:show-file-list="true"
|
||||||
|
:on-change="uploadByJsqd"
|
||||||
|
:file-list="fileList"
|
||||||
|
accept=".xlsx,.xls"
|
||||||
|
>
|
||||||
|
<i class="el-icon-upload" />
|
||||||
|
<div class="el-upload__text">
|
||||||
|
将文件拖到此处,或
|
||||||
|
<em>点击上传</em>
|
||||||
|
</div>
|
||||||
|
<div slot="tip" class="el-upload__tip">只能上传Excel文件,且不超过10MB</div>
|
||||||
|
</el-upload>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="submit">确 定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import crudMaterialbase from '@/api/wms/basedata/master/materialbase'
|
||||||
|
import CRUD, { crud } from '@crud/crud'
|
||||||
|
import { download2 } from '@/api/data'
|
||||||
|
import { downloadFile } from '@/utils'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'UploadDialog',
|
||||||
|
mixins: [crud()],
|
||||||
|
components: {},
|
||||||
|
props: {
|
||||||
|
dialogShow: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
openParam: {
|
||||||
|
type: String
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dialogVisible: false,
|
||||||
|
fileList: [],
|
||||||
|
file1: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
dialogShow: {
|
||||||
|
handler(newValue, oldValue) {
|
||||||
|
this.dialogVisible = newValue
|
||||||
|
}
|
||||||
|
},
|
||||||
|
openParam: {
|
||||||
|
handler(newValue, oldValue) {
|
||||||
|
this.opendtlParam = newValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
open() {
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.$emit('update:dialogShow', false)
|
||||||
|
},
|
||||||
|
is_one() {
|
||||||
|
this.crud.notify('只能上传一个excel文件!', CRUD.NOTIFICATION_TYPE.WARNING)
|
||||||
|
},
|
||||||
|
// 文件校验方法
|
||||||
|
beforeAvatarUpload(file) {
|
||||||
|
// 不能导入大小超过2Mb的文件
|
||||||
|
if (file.size > 10 * 1024 * 1024) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
// 文件发生改变就会触发的事件
|
||||||
|
uploadByJsqd(file) {
|
||||||
|
this.file1 = file
|
||||||
|
},
|
||||||
|
submit() {
|
||||||
|
if (this.beforeAvatarUpload(this.file1)) {
|
||||||
|
this.fileList.name = this.file1.name
|
||||||
|
this.fileList.url = ''
|
||||||
|
var formdata = new FormData()
|
||||||
|
formdata.append('file', this.file1.raw)
|
||||||
|
// excelImport:请求接口 formdata:传递参数
|
||||||
|
crudMaterialbase.excelImport(formdata).then((res) => {
|
||||||
|
this.crud.notify('导入成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||||
|
this.$emit('tableChanged3', '')
|
||||||
|
this.$emit('update:dialogShow', false)
|
||||||
|
}).catch(err => {
|
||||||
|
const list = err.response.data.message
|
||||||
|
download2('/api/produceWorkorder/download', list).then(result => {
|
||||||
|
downloadFile(result, '错误信息汇总', 'xlsx')
|
||||||
|
crud.downloadLoading = false
|
||||||
|
})
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.crud.notify('文件过大,请上传小于10MB的文件〜', CRUD.NOTIFICATION_TYPE.WARNING)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
439
wms_pro/qd/src/views/wms/base_manage/material/index.vue
Normal file
439
wms_pro/qd/src/views/wms/base_manage/material/index.vue
Normal file
@@ -0,0 +1,439 @@
|
|||||||
|
<template>
|
||||||
|
<div v-loading.fullscreen.lock="fullscreenLoading" class="app-container">
|
||||||
|
<!--工具栏-->
|
||||||
|
<div class="head-container">
|
||||||
|
<div v-if="crud.props.searchToggle">
|
||||||
|
<!-- 搜索 -->
|
||||||
|
<el-form
|
||||||
|
:inline="true"
|
||||||
|
class="demo-form-inline"
|
||||||
|
label-position="right"
|
||||||
|
label-width="80px"
|
||||||
|
label-suffix=":"
|
||||||
|
>
|
||||||
|
<el-form-item label="物料类别">
|
||||||
|
<treeselect
|
||||||
|
v-model="query.material_type_id"
|
||||||
|
:load-options="loadChildNodes"
|
||||||
|
:options="classes1"
|
||||||
|
offset-height="30px;"
|
||||||
|
style="width: 200px; height: 30px;"
|
||||||
|
placeholder="请选择"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="模糊查询">
|
||||||
|
<el-input
|
||||||
|
v-model="query.search"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
size="mini"
|
||||||
|
placeholder="输入物料编码或名称"
|
||||||
|
prefix-icon="el-icon-search"
|
||||||
|
class="filter-item"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<rrOperation />
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||||
|
<crudOperation :permission="permission">
|
||||||
|
<el-button
|
||||||
|
slot="right"
|
||||||
|
class="filter-item"
|
||||||
|
type="warning"
|
||||||
|
icon="el-icon-upload2"
|
||||||
|
size="mini"
|
||||||
|
@click="uploadShow = true"
|
||||||
|
>
|
||||||
|
导入
|
||||||
|
</el-button>
|
||||||
|
</crudOperation>
|
||||||
|
<!--表单组件-->
|
||||||
|
<el-dialog
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:before-close="crud.cancelCU"
|
||||||
|
:visible.sync="crud.status.cu > 0"
|
||||||
|
:title="crud.status.title"
|
||||||
|
width="1200px"
|
||||||
|
>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="110px">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="物料编码" prop="material_code">
|
||||||
|
<el-input v-model="form.material_code" style="width: 200px;" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="物料名称" prop="material_name">
|
||||||
|
<el-input v-model="form.material_name" style="width: 200px;" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
|
||||||
|
<el-form-item label="规格" prop="material_spec">
|
||||||
|
<label slot="label">规 格</label>
|
||||||
|
<el-input v-model="form.material_spec" style="width: 200px;" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="型号" prop="material_model">
|
||||||
|
<label slot="label">型 号</label>
|
||||||
|
<el-input v-model="form.material_model" style="width: 200px;" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="外部标识" prop="ext_id">
|
||||||
|
<el-input v-model="form.ext_id" style="width: 200px;" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="物料分类" prop="material_type_id">
|
||||||
|
<treeselect
|
||||||
|
v-model="form.material_type_id"
|
||||||
|
:load-options="loadChildNodes"
|
||||||
|
:options="classes2"
|
||||||
|
style="width: 200px;"
|
||||||
|
placeholder="请选择"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="产品系列">
|
||||||
|
<treeselect
|
||||||
|
v-model="form.product_series"
|
||||||
|
:options="classes3"
|
||||||
|
:auto-load-root-options="false"
|
||||||
|
:load-options="loadChildNodes"
|
||||||
|
style="width: 200px;"
|
||||||
|
placeholder="请选择"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="是否启用" prop="is_used">
|
||||||
|
<el-switch
|
||||||
|
v-model="form.is_used"
|
||||||
|
active-color="#13ce66"
|
||||||
|
inactive-color="#ff4949"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||||
|
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
<!--表格渲染-->
|
||||||
|
<el-table
|
||||||
|
ref="table"
|
||||||
|
v-loading="crud.loading"
|
||||||
|
:data="crud.data"
|
||||||
|
size="mini"
|
||||||
|
style="width: 100%;"
|
||||||
|
@selection-change="crud.selectionChangeHandler"
|
||||||
|
>
|
||||||
|
<el-table-column prop="material_code" label="物料编码" width="160" />
|
||||||
|
<el-table-column prop="material_name" label="物料名称" width="180" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="material_spec" label="物料规格" width="140" />
|
||||||
|
<el-table-column prop="material_model" label="物料型号" />
|
||||||
|
<el-table-column prop="class_name" label="物料分类" width="140" />
|
||||||
|
<el-table-column prop="unit_name" label="计量单位" />
|
||||||
|
<el-table-column prop="net_weight" label="单重(g)" />
|
||||||
|
<el-table-column prop="product_series_name" label="系列" />
|
||||||
|
<el-table-column label="启用" align="center" prop="is_used">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-switch
|
||||||
|
v-model="scope.row.is_used"
|
||||||
|
active-color="#409EFF"
|
||||||
|
inactive-color="#F56C6C"
|
||||||
|
@change="changeEnabled(scope.row, scope.row.is_used)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="update_optname" label="修改人" />
|
||||||
|
<el-table-column
|
||||||
|
prop="update_time"
|
||||||
|
label="修改时间"
|
||||||
|
:min-width="flexWidth('update_time',crud.data,'修改时间')"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
v-permission="['admin','Materialbase:edit','Materialbase:del']"
|
||||||
|
fixed="right"
|
||||||
|
label="操作"
|
||||||
|
width="120px"
|
||||||
|
align="center"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<udOperation
|
||||||
|
:data="scope.row"
|
||||||
|
:permission="permission"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!--分页组件-->
|
||||||
|
<pagination />
|
||||||
|
</div>
|
||||||
|
<UploadDialog :dialog-show.sync="uploadShow" @tableChanged3="crud.toQuery()" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import crudMaterialbase from '@/api/wms/base_manage/material/material'
|
||||||
|
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||||
|
import rrOperation from '@crud/RR.operation'
|
||||||
|
import crudOperation from '@crud/CRUD.operation'
|
||||||
|
import udOperation from '@crud/UD.operation'
|
||||||
|
import pagination from '@crud/Pagination'
|
||||||
|
import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
|
||||||
|
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||||
|
// import crudClassstandard from '@/api/wms/basedata/master/classstandard'
|
||||||
|
// import crudMdPbMeasureunit from '@/api/wms/basedata/master/mdPbMeasureunit'
|
||||||
|
import UploadDialog from '@/views/wms/base_manage/material/UploadDialog'
|
||||||
|
|
||||||
|
const defaultForm = {
|
||||||
|
material_id: null,
|
||||||
|
ass_unit_id: null,
|
||||||
|
material_code: null,
|
||||||
|
material_name: null,
|
||||||
|
material_spec: null,
|
||||||
|
material_model: null,
|
||||||
|
english_name: null,
|
||||||
|
base_unit_id: null,
|
||||||
|
approve_fileno: null,
|
||||||
|
print_no: null,
|
||||||
|
material_type_id: null,
|
||||||
|
len_unit_id: null,
|
||||||
|
length: null,
|
||||||
|
width: null,
|
||||||
|
height: null,
|
||||||
|
limit_qty: null,
|
||||||
|
weight_unit_id: null,
|
||||||
|
gross_weight: null,
|
||||||
|
net_weight: null,
|
||||||
|
cubage_unit_id: null,
|
||||||
|
cubage: null,
|
||||||
|
create_id: null,
|
||||||
|
create_name: null,
|
||||||
|
create_time: null,
|
||||||
|
update_optid: null,
|
||||||
|
update_optname: null,
|
||||||
|
update_time: null,
|
||||||
|
is_used_time: null,
|
||||||
|
is_used: null,
|
||||||
|
is_delete: null,
|
||||||
|
ext_id: null,
|
||||||
|
material_height_type: null,
|
||||||
|
product_series: null
|
||||||
|
}
|
||||||
|
export default {
|
||||||
|
name: 'Material',
|
||||||
|
// 数据字典
|
||||||
|
dicts: ['is_used'],
|
||||||
|
components: { pagination, crudOperation, rrOperation, udOperation, Treeselect, UploadDialog },
|
||||||
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
|
cruds() {
|
||||||
|
return CRUD({
|
||||||
|
title: '物料',
|
||||||
|
optShow: { add: true, reset: true },
|
||||||
|
url: 'api/bmMaterial',
|
||||||
|
idField: 'material_id',
|
||||||
|
sort: 'material_id,desc',
|
||||||
|
crudMethod: { ...crudMaterialbase }
|
||||||
|
})
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
classes1: [],
|
||||||
|
classes2: [],
|
||||||
|
classes3: [],
|
||||||
|
dialogShow: false,
|
||||||
|
uploadShow: false,
|
||||||
|
fullscreenLoading: false,
|
||||||
|
measure_unit: [],
|
||||||
|
productSeries: [],
|
||||||
|
permission: {},
|
||||||
|
rules: {
|
||||||
|
material_id: [
|
||||||
|
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
material_code: [
|
||||||
|
{ required: true, message: '物料编码不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
material_name: [
|
||||||
|
{ required: true, message: '物料名称不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
material_type_id: [
|
||||||
|
{ required: true, message: '物料分类不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
create_id: [
|
||||||
|
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
create_time: [
|
||||||
|
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
is_used: [
|
||||||
|
{ required: true, message: '是否启用不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
material_height_type: [
|
||||||
|
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.initClass1()
|
||||||
|
this.initClass2()
|
||||||
|
this.initClass3()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||||
|
[CRUD.HOOK.beforeRefresh]() {
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
initClass1() {
|
||||||
|
const param = {
|
||||||
|
parent_class_code: '09'
|
||||||
|
}
|
||||||
|
crudClassstandard.getClassType(param).then(res => {
|
||||||
|
const data = res.content
|
||||||
|
this.buildTree(data)
|
||||||
|
this.classes1 = data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
format_isOrNot(row, column, value) {
|
||||||
|
return value === true ? '是' : '否'
|
||||||
|
},
|
||||||
|
initClass2() {
|
||||||
|
const param = {
|
||||||
|
parent_class_code: '09'
|
||||||
|
}
|
||||||
|
crudClassstandard.getClassType(param).then(res => {
|
||||||
|
const data = res.content
|
||||||
|
this.buildTree(data)
|
||||||
|
this.classes2 = data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
initClass3() {
|
||||||
|
const param = {
|
||||||
|
parent_class_code: '07'
|
||||||
|
}
|
||||||
|
crudClassstandard.getClassType(param).then(res => {
|
||||||
|
const data = res.content
|
||||||
|
this.buildTree(data)
|
||||||
|
this.classes3 = data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
[CRUD.HOOK.beforeToCU](crud, form) {
|
||||||
|
},
|
||||||
|
getSubTypes(type, id) {
|
||||||
|
const that = this
|
||||||
|
crudClassstandard.getClassSuperior(id).then(res => {
|
||||||
|
const data = res.content
|
||||||
|
that.buildTree(data)
|
||||||
|
if (type == '02') {
|
||||||
|
that.classes2 = data
|
||||||
|
}
|
||||||
|
if (type == '03') {
|
||||||
|
that.classes3 = data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
synchronize() {
|
||||||
|
this.dialogShow = true
|
||||||
|
},
|
||||||
|
queryClassId() {
|
||||||
|
const param = {
|
||||||
|
'class_idStr': this.class_idStr
|
||||||
|
}
|
||||||
|
crudClassstandard.queryClassById(param).then(res => {
|
||||||
|
this.classes = res.content.map(obj => {
|
||||||
|
if (obj.hasChildren) {
|
||||||
|
obj.children = null
|
||||||
|
}
|
||||||
|
return obj
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
buildTree(classes) {
|
||||||
|
classes.forEach(data => {
|
||||||
|
if (data.children) {
|
||||||
|
this.buildTree(data.children)
|
||||||
|
}
|
||||||
|
if (data.hasChildren && !data.children) {
|
||||||
|
data.children = null // 重点代码
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 改变状态
|
||||||
|
changeEnabled(data, val) {
|
||||||
|
this.$confirm('此操作将修改' + data.material_name + '状态, 是否继续?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
crudMaterialbase.edit(data).then(res => {
|
||||||
|
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||||
|
}).catch(() => {
|
||||||
|
if (data.is_used === false) {
|
||||||
|
data.is_used = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (data.is_used === true) {
|
||||||
|
data.is_used = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
if (data.is_used === false) {
|
||||||
|
data.is_used = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (data.is_used === true) {
|
||||||
|
data.is_used = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 获取子节点数据
|
||||||
|
loadChildNodes({ action, parentNode, callback }) {
|
||||||
|
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||||
|
crudClassstandard.getClass({ pid: parentNode.id }).then(res => {
|
||||||
|
parentNode.children = res.content.map(function(obj) {
|
||||||
|
if (obj.hasChildren) {
|
||||||
|
obj.children = null
|
||||||
|
}
|
||||||
|
return obj
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
callback()
|
||||||
|
}, 100)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||||
|
.treeselect-main {
|
||||||
|
width: 204px;
|
||||||
|
line-height: 28px;
|
||||||
|
|
||||||
|
.vue-treeselect__placeholder {
|
||||||
|
line-height: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vue-treeselect__control {
|
||||||
|
height: 28px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
Reference in New Issue
Block a user