Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1,9 +1,23 @@
|
||||
package org.nl.wms.masterdata_manage.controller.material;
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.utils.RedissonUtils;
|
||||
import org.nl.wms.masterdata_manage.service.material.IMdMeMaterialbaseService;
|
||||
import org.nl.wms.masterdata_manage.备份master.service.MaterialbaseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -14,8 +28,19 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
* @since 2023-04-26
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/mdMeMaterialbase")
|
||||
@RequestMapping("/api/mdMeMaterialbase")
|
||||
public class MdMeMaterialbaseController {
|
||||
|
||||
@Autowired
|
||||
private IMdMeMaterialbaseService materialBaseService;
|
||||
@PostMapping("/excelImport")
|
||||
@Log("excel导入")
|
||||
@ApiOperation("excel导入")
|
||||
public ResponseEntity<Object> excelImport(@RequestParam("file") MultipartFile file, HttpServletRequest request, HttpServletResponse response) {
|
||||
RedissonUtils.lock(() -> {
|
||||
materialBaseService.excelImport(file, request, response);
|
||||
}, "物料基础信息导入", null);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.utils.RedissonUtils;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.masterdata_manage.master.service.classstandard.IMdPbClassstandardService;
|
||||
import org.nl.wms.masterdata_manage.备份master.service.ClassstandardService;
|
||||
@@ -22,7 +23,10 @@ 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.Map;
|
||||
|
||||
/**
|
||||
@@ -135,5 +139,14 @@ public class ClassstandardController {
|
||||
return new ResponseEntity<>(ClassstandardService.getClassName(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/excelImport")
|
||||
@Log("excel导入")
|
||||
@ApiOperation("excel导入")
|
||||
public ResponseEntity<Object> excelImport(@RequestParam("file") MultipartFile file, HttpServletRequest request, HttpServletResponse response) {
|
||||
RedissonUtils.lock(() -> {
|
||||
mdPbClassstandardService.excelImport(file, request, response);
|
||||
}, "基础分类导入", null);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,14 +4,14 @@ package org.nl.wms.masterdata_manage.master.controller.customer;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.anno.Log;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.utils.RedissonUtils;
|
||||
import org.nl.wms.masterdata_manage.master.service.customer.IMdCsCustomerbaseService;
|
||||
import org.nl.wms.masterdata_manage.master.service.customer.dao.MdCsCustomerbase;
|
||||
import org.nl.wms.masterdata_manage.master.service.customer.dto.CustomerQuery;
|
||||
@@ -21,7 +21,10 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
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.*;
|
||||
|
||||
/**
|
||||
@@ -72,6 +75,17 @@ public class MdCsCustomerbaseController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/excelImport")
|
||||
@Log("excel导入")
|
||||
@ApiOperation("excel导入")
|
||||
public ResponseEntity<Object> excelImport(@RequestParam("file") MultipartFile file, HttpServletRequest request, HttpServletResponse response) {
|
||||
RedissonUtils.lock(() -> {
|
||||
icustomerbaseService.excelImport(file, request, response);
|
||||
}, "客户信息导入", null);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/selectList")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> getSelectList() {
|
||||
|
||||
@@ -3,7 +3,11 @@ package org.nl.wms.masterdata_manage.master.service.classstandard;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.masterdata_manage.master.service.classstandard.dao.MdPbClassstandard;
|
||||
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;
|
||||
import java.util.Set;
|
||||
@@ -65,4 +69,6 @@ public interface IMdPbClassstandardService extends IService<MdPbClassstandard> {
|
||||
List<String> getChildIdStr(String class_id);
|
||||
|
||||
Set<String> getAllChildIdSet(String class_idStr);
|
||||
|
||||
void excelImport(MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
|
||||
@@ -2,11 +2,11 @@ package org.nl.wms.masterdata_manage.master.service.classstandard.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.lang.hash.Hash;
|
||||
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.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
@@ -17,19 +17,22 @@ import org.nl.common.utils.CopyUtil;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.masterdata_manage.master.service.classstandard.IMdPbClassstandardService;
|
||||
import org.nl.wms.masterdata_manage.master.service.classstandard.dao.MdPbClassstandard;
|
||||
import org.nl.wms.masterdata_manage.master.service.classstandard.dto.MdPbClassstandardTree;
|
||||
import org.nl.wms.masterdata_manage.service.master.dao.mapper.MdPbClassstandardMapper;
|
||||
import org.nl.wms.masterdata_manage.service.material.IMdMeMaterialbaseService;
|
||||
import org.nl.wms.masterdata_manage.service.material.dao.MdMeMaterialbase;
|
||||
import org.nl.wms.masterdata_manage.备份master.service.dto.ClassstandardDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
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.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -46,6 +49,7 @@ public class MdPbClassstandardServiceImpl extends ServiceImpl<MdPbClassstandardM
|
||||
|
||||
@Autowired
|
||||
private IMdMeMaterialbaseService materialbaseService;
|
||||
|
||||
@Override
|
||||
public List<Map> dropdownList(Map whereJson) {
|
||||
Assert.notNull(whereJson, "参数不能为空");
|
||||
@@ -116,6 +120,11 @@ public class MdPbClassstandardServiceImpl extends ServiceImpl<MdPbClassstandardM
|
||||
public List<Map> queryClassById(Map whereJson) {
|
||||
QueryWrapper<MdPbClassstandard> query = new QueryWrapper<>();
|
||||
query.eq("1", "1");
|
||||
if (ObjectUtil.isNotEmpty(whereJson.get("material_id"))) {
|
||||
MdMeMaterialbase one = materialbaseService.getOne(new QueryWrapper<MdMeMaterialbase>().eq("material_id", whereJson.get("material_id")));
|
||||
whereJson.put("class_idStr", one.getMaterial_type_id());
|
||||
}
|
||||
query.eq("1", "1");
|
||||
if (ObjectUtil.isNotEmpty(whereJson.get("material_id"))) {
|
||||
MdMeMaterialbase one = materialbaseService.getOne(new QueryWrapper<MdMeMaterialbase>().eq("material_id", whereJson.get("material_id")));
|
||||
if (null != one) {
|
||||
@@ -128,9 +137,12 @@ public class MdPbClassstandardServiceImpl extends ServiceImpl<MdPbClassstandardM
|
||||
if (ObjectUtil.isNotEmpty(whereJson.get("parent_class_id"))) {
|
||||
query.eq("parent_class_id", whereJson.get("parent_class_id"));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(whereJson.get("class_idStr"))) {
|
||||
query.in("class_id", whereJson.get("class_idStr"));
|
||||
if (ObjectUtil.isNotEmpty(whereJson.get("class_idStr"))) {
|
||||
query.last("and class_id in (" + whereJson.get("class_idStr") + ")");
|
||||
}
|
||||
}
|
||||
List<Map<String, Object>> list = this.listMaps(query);
|
||||
return getMaps(list);
|
||||
}
|
||||
@@ -265,4 +277,69 @@ public class MdPbClassstandardServiceImpl extends ServiceImpl<MdPbClassstandardM
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void excelImport(MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
InputStream inputStream = file.getInputStream();
|
||||
ExcelReader excelReader = ExcelUtil.getReader(inputStream);
|
||||
List<List<Object>> read = excelReader.read();
|
||||
|
||||
Map<String, String> errorMap = new HashMap();
|
||||
for (int i = 1; i < read.size(); i++) {
|
||||
List<Object> list = read.get(i);
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
continue;
|
||||
}
|
||||
if (ObjectUtil.isEmpty(list.get(0))) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "分类编码为空!");
|
||||
continue;
|
||||
}
|
||||
String class_code = String.valueOf(list.get(0));
|
||||
MdPbClassstandard one = this.getOne(new QueryWrapper<MdPbClassstandard>().eq("class_code", class_code).eq("is_delete", false));
|
||||
if (one != null) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "存在相同的分类编码:" + class_code);
|
||||
continue;
|
||||
} else {
|
||||
one = new MdPbClassstandard();
|
||||
}
|
||||
|
||||
String class_name = (String) list.get(1);
|
||||
if (ObjectUtil.isEmpty(class_name)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "分类名称为空!");
|
||||
continue;
|
||||
}
|
||||
String class_desc = (String) list.get(2);
|
||||
if (StrUtil.isNotEmpty(class_desc)) {
|
||||
one.setClass_desc(class_desc);
|
||||
}
|
||||
|
||||
one.setClass_id(IdUtil.getStringId());
|
||||
one.setClass_code(class_code);
|
||||
one.setClass_name(class_name);
|
||||
one.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
one.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
one.setCreate_time(DateUtil.now());
|
||||
one.setIs_leaf(true);
|
||||
one.setSub_count(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(list.get(3))) {
|
||||
String pareant_class_code = String.valueOf(list.get(3));
|
||||
///更新节点
|
||||
if (StrUtil.isNotEmpty(pareant_class_code)) {
|
||||
MdPbClassstandard parent_one = this.getOne(new QueryWrapper<MdPbClassstandard>().eq("class_code", pareant_class_code).eq("is_delete", false));
|
||||
if (ObjectUtil.isEmpty(parent_one)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "父节点对应的编码:" + pareant_class_code + "不存在!");
|
||||
} else {
|
||||
one.setParent_class_id(parent_one.getClass_id());
|
||||
this.save(one);
|
||||
updateSubCnt(parent_one.getParent_class_id());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(errorMap)) {
|
||||
throw new BadRequestException(JSON.toJSONString(errorMap));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,11 @@ package org.nl.wms.masterdata_manage.master.service.customer;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.masterdata_manage.master.service.customer.dao.MdCsCustomerbase;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -18,4 +23,6 @@ public interface IMdCsCustomerbaseService extends IService<MdCsCustomerbase> {
|
||||
|
||||
void update(JSONObject dto);
|
||||
|
||||
void excelImport(MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws IOException;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,10 +2,14 @@ package org.nl.wms.masterdata_manage.master.service.customer.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
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.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
@@ -20,6 +24,15 @@ import org.nl.wms.masterdata_manage.备份master.service.dto.CustomerbaseDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
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>
|
||||
@@ -58,4 +71,53 @@ public class MdCsCustomerbaseServiceImpl extends ServiceImpl<MdCsCustomerbaseMap
|
||||
entity.setUpdate_time(DateUtil.now());
|
||||
this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void excelImport(MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
InputStream inputStream = file.getInputStream();
|
||||
ExcelReader excelReader = ExcelUtil.getReader(inputStream);
|
||||
List<List<Object>> read = excelReader.read();
|
||||
|
||||
Map<String, String> errorMap = new HashMap();
|
||||
for (int i = 1; i < read.size(); i++) {
|
||||
List<Object> list = read.get(i);
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
continue;
|
||||
}
|
||||
String cust_code = (String) list.get(0);
|
||||
if (StrUtil.isEmpty(cust_code)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "客户编码为空!");
|
||||
}
|
||||
|
||||
String cust_name = (String) list.get(1);
|
||||
if (StrUtil.isEmpty(cust_name)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "客户名称为空!");
|
||||
}
|
||||
|
||||
boolean need_update = false;
|
||||
MdCsCustomerbase cust_jo = this.getOne(new QueryWrapper<MdCsCustomerbase>().eq("cust_code", cust_code));
|
||||
if (ObjectUtil.isNotEmpty(cust_jo)){
|
||||
need_update = true;
|
||||
}else {
|
||||
cust_jo = new MdCsCustomerbase();
|
||||
}
|
||||
if (need_update){
|
||||
cust_jo.setCust_name(cust_name);
|
||||
cust_jo.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
cust_jo.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
cust_jo.setUpdate_time(DateUtil.now());
|
||||
this.updateById(cust_jo);
|
||||
}else {
|
||||
cust_jo.setCust_code(cust_code);
|
||||
cust_jo.setCust_name(cust_name);
|
||||
cust_jo.setCust_id(IdUtil.getStringId());
|
||||
cust_jo.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
cust_jo.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
cust_jo.setCreate_time(DateUtil.now());
|
||||
cust_jo.setIs_delete("0");
|
||||
cust_jo.setIs_used("1");
|
||||
this.save(cust_jo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -1,11 +1,14 @@
|
||||
package org.nl.wms.masterdata_manage.service.material;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.masterdata_manage.service.material.dao.MdMeMaterialbase;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.storage_manage.pda.service.dto.PdaQuery;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -18,5 +21,8 @@ import java.util.List;
|
||||
*/
|
||||
public interface IMdMeMaterialbaseService extends IService<MdMeMaterialbase> {
|
||||
|
||||
void excelImport(MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws IOException;
|
||||
|
||||
List getPdaBcpGetMaterial(PdaQuery whereJson, PageQuery pageQuery);
|
||||
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ public class MdMeMaterialbase implements Serializable {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date create_time;
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
@@ -154,12 +154,12 @@ public class MdMeMaterialbase implements Serializable {
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date update_time;
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 启用时间
|
||||
*/
|
||||
private Date is_used_time;
|
||||
private String is_used_time;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
|
||||
@@ -1,15 +1,42 @@
|
||||
package org.nl.wms.masterdata_manage.service.material.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.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.wms.masterdata_manage.master.service.classstandard.IMdPbClassstandardService;
|
||||
import org.nl.wms.masterdata_manage.master.service.classstandard.dao.MdPbClassstandard;
|
||||
import org.nl.wms.masterdata_manage.service.master.IMdPbMeasureunitService;
|
||||
import org.nl.wms.masterdata_manage.service.master.dao.MdPbMeasureunit;
|
||||
import org.nl.wms.masterdata_manage.service.material.IMdMeMaterialbaseService;
|
||||
import org.nl.wms.masterdata_manage.service.material.dao.MdMeMaterialbase;
|
||||
import org.nl.wms.masterdata_manage.service.material.dao.mapper.MdMeMaterialbaseMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.masterdata_manage.service.material.IMdMeMaterialbaseService;
|
||||
import org.nl.wms.masterdata_manage.service.material.dao.MdMeMaterialbase;
|
||||
import org.nl.wms.masterdata_manage.service.material.dao.mapper.MdMeMaterialbaseMapper;
|
||||
import org.nl.wms.storage_manage.pda.service.dto.PdaQuery;
|
||||
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.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -22,8 +49,113 @@ import java.util.List;
|
||||
@Service
|
||||
public class MdMeMaterialbaseServiceImpl extends ServiceImpl<MdMeMaterialbaseMapper, MdMeMaterialbase> implements IMdMeMaterialbaseService {
|
||||
|
||||
@Autowired
|
||||
IMdPbClassstandardService classstandardService;
|
||||
@Autowired
|
||||
IMdPbMeasureunitService measureunitService;
|
||||
|
||||
@Override
|
||||
public List getPdaBcpGetMaterial(PdaQuery whereJson, PageQuery pageQuery) {
|
||||
return this.baseMapper.getPdaBcpGetMaterial(whereJson,pageQuery);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void excelImport(MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
InputStream inputStream = file.getInputStream();
|
||||
ExcelReader excelReader = ExcelUtil.getReader(inputStream);
|
||||
List<List<Object>> read = excelReader.read();
|
||||
|
||||
Map<String, String> errorMap = new HashMap();
|
||||
for (int i = 1; i < read.size(); i++) {
|
||||
List<Object> list = read.get(i);
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
continue;
|
||||
}
|
||||
String material_code = (String) list.get(0);
|
||||
if (StrUtil.isEmpty(material_code)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "物料编码为空!");
|
||||
}
|
||||
boolean need_update = true;
|
||||
MdMeMaterialbase material_jo = this.getOne(new QueryWrapper<MdMeMaterialbase>().eq("material_code", material_code));
|
||||
if (ObjectUtil.isEmpty(material_jo)) {
|
||||
material_jo = new MdMeMaterialbase();
|
||||
material_jo.setMaterial_code(material_code);
|
||||
need_update = false;
|
||||
}
|
||||
String material_name = (String) list.get(1);
|
||||
if (StrUtil.isEmpty(material_name)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "物料名称为空!");
|
||||
} else {
|
||||
material_jo.setMaterial_name(material_name);
|
||||
}
|
||||
String material_spec = (String) list.get(2);
|
||||
if (StrUtil.isNotEmpty(material_spec)) {
|
||||
material_jo.setMaterial_spec(material_spec);
|
||||
}
|
||||
|
||||
String material_model = (String) list.get(3);
|
||||
if (StrUtil.isNotEmpty(material_model)) {
|
||||
material_jo.setMaterial_model(material_model);
|
||||
}
|
||||
|
||||
String material_type = (String) list.get(4);
|
||||
if (StrUtil.isEmpty(material_type)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "物料分类编码为空!");
|
||||
}else {
|
||||
//查询对应的系列名称
|
||||
MdPbClassstandard class_jo = classstandardService.getOne(new QueryWrapper<MdPbClassstandard>().eq("class_name", material_type).eq("is_delete", false));
|
||||
if (ObjectUtil.isEmpty(class_jo)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "物料分类编码对应的分类不存在!");
|
||||
continue;
|
||||
}
|
||||
material_jo.setMaterial_type_id(class_jo.getClass_id());
|
||||
}
|
||||
|
||||
String product_series = (String) list.get(5);
|
||||
if (StrUtil.isNotEmpty(product_series)) {
|
||||
//查询对应的系列名称
|
||||
MdPbClassstandard class_jo = classstandardService.getOne(new QueryWrapper<MdPbClassstandard>().eq("class_name", product_series).eq("is_delete", false));
|
||||
if (ObjectUtil.isEmpty(class_jo)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "系列分类编码对应的分类不存在!");
|
||||
continue;
|
||||
}
|
||||
material_jo.setProduct_series(class_jo.getClass_id());
|
||||
}
|
||||
|
||||
String unit_name = (String) list.get(6);
|
||||
if (StrUtil.isEmpty(unit_name)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "单位为空!");
|
||||
}else {
|
||||
MdPbMeasureunit unit_jo = measureunitService.getOne(new QueryWrapper<MdPbMeasureunit>().eq("unit_name", unit_name));
|
||||
if (ObjectUtil.isEmpty(unit_jo)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "单位:"+unit_name+"不存在!");
|
||||
continue;
|
||||
}
|
||||
material_jo.setBase_unit_id(unit_jo.getMeasure_unit_id());
|
||||
}
|
||||
|
||||
String net_weight = String.valueOf(list.get(7));
|
||||
if (StrUtil.isEmpty(net_weight)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "单重为空!");
|
||||
}else {
|
||||
material_jo.setNet_weight(new BigDecimal(net_weight));
|
||||
}
|
||||
|
||||
if (need_update){
|
||||
this.updateById(material_jo);
|
||||
material_jo.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
material_jo.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
material_jo.setUpdate_time(DateUtil.now());
|
||||
}else {
|
||||
material_jo.setMaterial_id(IdUtil.getStringId());
|
||||
material_jo.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
material_jo.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
material_jo.setCreate_time(DateUtil.now());
|
||||
this.save(material_jo);
|
||||
}
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(errorMap)) {
|
||||
throw new BadRequestException(JSON.toJSONString(errorMap));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.common.anno.Log;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.RedissonUtils;
|
||||
import org.nl.wms.masterdata_manage.备份master.constant.MaterOptTypeEnum;
|
||||
import org.nl.wms.masterdata_manage.备份master.service.MaterialbaseService;
|
||||
import org.nl.wms.masterdata_manage.备份master.service.dto.MaterialbaseDto;
|
||||
@@ -17,7 +18,10 @@ 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.Map;
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,6 +8,7 @@ import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.common.anno.Log;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.RedissonUtils;
|
||||
import org.nl.wms.masterdata_manage.备份master.service.SemirealrawmaterialService;
|
||||
import org.nl.wms.masterdata_manage.备份master.service.dto.SemirealrawmaterialDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -15,7 +16,10 @@ 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.Map;
|
||||
|
||||
/**
|
||||
@@ -66,4 +70,13 @@ public class SemirealrawmaterialController {
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@PostMapping("/excelImport")
|
||||
@Log("excel导入")
|
||||
@ApiOperation("excel导入")
|
||||
public ResponseEntity<Object> excelImport(@RequestParam("file") MultipartFile file, HttpServletRequest request, HttpServletResponse response) {
|
||||
RedissonUtils.lock(() -> {
|
||||
semirealrawmaterialService.excelImport(file, request, response);
|
||||
}, "半成品原材料导入", null);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,11 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.masterdata_manage.备份master.service.dto.MaterialbaseDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
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;
|
||||
|
||||
@@ -93,5 +97,4 @@ public interface MaterialbaseService {
|
||||
|
||||
JSONArray getProductSeries(String parent_class_id);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,11 @@ package org.nl.wms.masterdata_manage.备份master.service;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.masterdata_manage.备份master.service.dto.SemirealrawmaterialDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
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;
|
||||
|
||||
@@ -63,4 +67,6 @@ public interface SemirealrawmaterialService {
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
void excelImport(MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws IOException;
|
||||
|
||||
}
|
||||
|
||||
@@ -10,11 +10,11 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.json.XML;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.json.XML;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.common.utils.WebServiceUtil;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.utils.RedisUtils;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
@@ -28,16 +28,19 @@ import org.nl.wms.masterdata_manage.备份master.constant.MaterOptTypeEnum;
|
||||
import org.nl.wms.masterdata_manage.备份master.service.ClassstandardService;
|
||||
import org.nl.wms.masterdata_manage.备份master.service.MaterialbaseService;
|
||||
import org.nl.wms.masterdata_manage.备份master.service.dto.MaterialbaseDto;
|
||||
import org.nl.wms.pda_manage.pda.service.dto.MaterialDto;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.nl.wms.pda_manage.pda.service.dto.MaterialDto;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -169,7 +172,7 @@ public class MaterialbaseServiceImpl implements MaterialbaseService{
|
||||
public void update(JSONObject dto) {
|
||||
|
||||
MdMeMaterialbase materialbase = dto.toJavaObject(MdMeMaterialbase.class);
|
||||
materialbase.setUpdate_time(new Date());
|
||||
materialbase.setUpdate_time(DateUtil.now());
|
||||
materialbase.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
materialbase.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
materialbaseService.updateById(materialbase);
|
||||
@@ -284,7 +287,7 @@ public class MaterialbaseServiceImpl implements MaterialbaseService{
|
||||
material.setMaterial_type_id(class_jo.getString("class_id"));
|
||||
material.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
material.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
material.setCreate_time(new Date());
|
||||
material.setCreate_time(DateUtil.now());
|
||||
material.setIs_used(true);
|
||||
material.setIs_delete(false);
|
||||
materialbaseService.save(material);
|
||||
@@ -305,7 +308,7 @@ public class MaterialbaseServiceImpl implements MaterialbaseService{
|
||||
material.setMaterial_type_id(class_jo.getString("class_id"));
|
||||
material.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
material.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
material.setCreate_time(new Date());
|
||||
material.setCreate_time(DateUtil.now());
|
||||
material.setIs_used(true);
|
||||
material.setIs_delete(false);
|
||||
materialbaseService.updateById(material);
|
||||
|
||||
@@ -7,22 +7,38 @@ import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
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.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.masterdata_manage.service.material.IMdMeMaterialbaseService;
|
||||
import org.nl.wms.masterdata_manage.service.material.dao.MdMeMaterialbase;
|
||||
import org.nl.wms.masterdata_manage.备份master.service.SemirealrawmaterialService;
|
||||
import org.nl.wms.masterdata_manage.备份master.service.dto.SemirealrawmaterialDto;
|
||||
|
||||
import org.nl.wms.product_manage.service.workprocedure.IPdmBiWorkprocedureService;
|
||||
import org.nl.wms.product_manage.service.workprocedure.dao.PdmBiWorkprocedure;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
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;
|
||||
|
||||
@@ -36,6 +52,11 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
public class SemirealrawmaterialServiceImpl implements SemirealrawmaterialService {
|
||||
|
||||
@Autowired
|
||||
private IPdmBiWorkprocedureService workprocedureService;
|
||||
@Autowired
|
||||
private IMdMeMaterialbaseService materialbaseService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String search = MapUtil.getStr(whereJson, "search");
|
||||
@@ -105,9 +126,11 @@ public class SemirealrawmaterialServiceImpl implements SemirealrawmaterialServic
|
||||
String relation_id = param.getString("relation_id");
|
||||
String raw_material_id = param.getString("material_id");
|
||||
String rate_qty = param.getString("rate_qty");
|
||||
String workprocedure_id = param.getString("workprocedure_id");
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("raw_material_id", raw_material_id);
|
||||
map.put("rate_qty", rate_qty);
|
||||
map.put("workprocedure_id", workprocedure_id);
|
||||
map.put("update_optid", currentUserId);
|
||||
map.put("update_optname", nickName);
|
||||
map.put("update_time", DateUtil.now());
|
||||
@@ -133,4 +156,87 @@ public class SemirealrawmaterialServiceImpl implements SemirealrawmaterialServic
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void excelImport(MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
InputStream inputStream = file.getInputStream();
|
||||
ExcelReader excelReader = ExcelUtil.getReader(inputStream);
|
||||
List<List<Object>> read = excelReader.read();
|
||||
|
||||
Map<String, String> errorMap = new HashMap();
|
||||
for (int i = 1; i < read.size(); i++) {
|
||||
List<Object> list = read.get(i);
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
continue;
|
||||
}
|
||||
String workprocedure_code = (String) list.get(0);
|
||||
if (StrUtil.isEmpty(workprocedure_code)){
|
||||
errorMap.put("第" + (i + 1) + "行:", "工序编码为空!");
|
||||
continue;
|
||||
}
|
||||
|
||||
PdmBiWorkprocedure workprocedure = workprocedureService.getOne(new QueryWrapper<PdmBiWorkprocedure>().eq("workprocedure_code", workprocedure_code));
|
||||
if (ObjectUtil.isEmpty(workprocedure)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "为查询到该工序编号对应的工序!");
|
||||
continue;
|
||||
}
|
||||
|
||||
String semi_material_code = (String) list.get(1);
|
||||
if (StrUtil.isEmpty(semi_material_code)){
|
||||
errorMap.put("第" + (i + 1) + "行:", "半成品物料编码为空!");
|
||||
continue;
|
||||
}
|
||||
|
||||
MdMeMaterialbase semi_jo = materialbaseService.getOne(new QueryWrapper<MdMeMaterialbase>().eq("material_code", semi_material_code));
|
||||
|
||||
if (ObjectUtil.isEmpty(semi_jo)){
|
||||
errorMap.put("第" + (i + 1) + "行:", "未查询到:"+semi_material_code+"对应的物料!");
|
||||
continue;
|
||||
}
|
||||
|
||||
String raw_material_code = String.valueOf(list.get(2));
|
||||
if (StrUtil.isEmpty(raw_material_code)){
|
||||
errorMap.put("第" + (i + 1) + "行:", "原材料物料编码为空!");
|
||||
continue;
|
||||
}
|
||||
|
||||
MdMeMaterialbase raw_jo = materialbaseService.getOne(new QueryWrapper<MdMeMaterialbase>().eq("material_code", raw_material_code));
|
||||
|
||||
if (ObjectUtil.isEmpty(raw_jo)){
|
||||
errorMap.put("第" + (i + 1) + "行:", "未查询到:"+semi_material_code+"对应的物料!");
|
||||
continue;
|
||||
}
|
||||
|
||||
String rate_qty = String.valueOf(list.get(3));
|
||||
if (StrUtil.isEmpty(rate_qty)){
|
||||
errorMap.put("第" + (i + 1) + "行:", "原材料消耗重量为空!");
|
||||
continue;
|
||||
}
|
||||
|
||||
//查询当前原材料和半成品是否存在对应关系
|
||||
JSONObject jo = WQLObject.getWQLObject("md_me_semirealrawmaterial").query("semi_material_id = '"+semi_jo.getMaterial_id()+"' AND raw_material_id = '"+raw_jo.getMaterial_id()+"'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jo)){
|
||||
jo.put("rate_qty",rate_qty);
|
||||
jo.put("workprocedure_id",workprocedure.getWorkprocedure_id());
|
||||
WQLObject.getWQLObject("md_me_semirealrawmaterial").update(jo);
|
||||
}else {
|
||||
jo = new JSONObject();
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
jo.put("relation_id",IdUtil.getSnowflake(1, 1).nextId());
|
||||
jo.put("semi_material_id",semi_jo.getMaterial_id());
|
||||
jo.put("raw_material_id",semi_jo.getMaterial_id());
|
||||
jo.put("create_id",currentUserId);
|
||||
jo.put("create_name",nickName);
|
||||
jo.put("create_time",DateUtil.now());
|
||||
jo.put("rate_qty",rate_qty);
|
||||
jo.put("workprocedure_id",workprocedure.getWorkprocedure_id());
|
||||
WQLObject wo = WQLObject.getWQLObject("md_me_semirealrawmaterial");
|
||||
wo.insert(jo);
|
||||
}
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(errorMap)) {
|
||||
throw new BadRequestException(JSON.toJSONString(errorMap));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,13 +53,15 @@
|
||||
material1.material_name ymaterial_name,
|
||||
material1.material_spec ymaterial_spec,
|
||||
material1.product_series yproduct_series,
|
||||
classstandard1.class_name yclass_name
|
||||
classstandard1.class_name yclass_name,
|
||||
wp.workprocedure_name
|
||||
FROM
|
||||
MD_ME_SemiRealRawMaterial semiRealRawMaterial
|
||||
LEFT JOIN MD_ME_MaterialBase material ON semiRealRawMaterial.semi_material_id = material.material_id
|
||||
LEFT JOIN md_pb_classstandard classstandard on material.product_series = classstandard.class_id
|
||||
LEFT JOIN MD_ME_MaterialBase material1 ON semiRealRawMaterial.raw_material_id = material1.material_id
|
||||
LEFT JOIN md_pb_classstandard classstandard1 on material1.product_series = classstandard1.class_id
|
||||
LEFT JOIN pdm_bi_workprocedure wp ON wp.workprocedure_id = semiRealRawMaterial.workprocedure_id
|
||||
WHERE
|
||||
material.is_delete = '0'
|
||||
OPTION 输入.search <> ""
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
|
||||
package org.nl.wms.product_manage.controller.productProcessRoute;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.pagehelper.Page;
|
||||
@@ -14,18 +12,21 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.utils.RedissonUtils;
|
||||
import org.nl.wms.product_manage.service.processroute.IPdmBiProcessrouteService;
|
||||
import org.nl.wms.product_manage.service.processroute.dao.PdmBiProcessroute;
|
||||
import org.nl.wms.product_manage.service.productProcessRoute.IPdmBiProductprocessrouteService;
|
||||
import org.nl.wms.product_manage.service.productProcessRoute.IPdmBiProductprocessroutedtlService;
|
||||
import org.nl.wms.product_manage.service.productProcessRoute.dao.PdmBiProductprocessroute;
|
||||
import org.nl.wms.product_manage.service.productProcessRoute.dao.PdmBiProductprocessroutedtl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
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.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -49,7 +50,7 @@ public class ProductprocessrouteController {
|
||||
|
||||
@GetMapping
|
||||
@Log("查询产品工艺路线")
|
||||
//("查询产品工艺路线")
|
||||
@ApiOperation("查询产品工艺路线")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable pageQuery){
|
||||
Page<Object> page = PageHelper.startPage(pageQuery.getPageNumber() + 1, pageQuery.getPageSize());
|
||||
List list = ipdmBiProductprocessrouteService.queryAll(whereJson);
|
||||
@@ -60,7 +61,7 @@ public class ProductprocessrouteController {
|
||||
|
||||
@PostMapping
|
||||
@Log("新增产品工艺路线")
|
||||
//("新增产品工艺路线")
|
||||
@ApiOperation("新增产品工艺路线")
|
||||
public ResponseEntity<Object> create(@RequestBody Map whereJson){
|
||||
ipdmBiProductprocessrouteService.create(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
@@ -90,8 +91,7 @@ public class ProductprocessrouteController {
|
||||
//("获取工艺路线")
|
||||
//@PreAuthorize("@el.check('materialtype:list')")
|
||||
public ResponseEntity<Object> getRoute(@RequestBody Map whereJson) {
|
||||
List<PdmBiProcessroute> list = pdmBiProcessrouteService.list(new QueryWrapper<PdmBiProcessroute>()
|
||||
.eq("is_delete", "0").eq("processroute_status", 20));
|
||||
List<PdmBiProcessroute> list = pdmBiProcessrouteService.list(new QueryWrapper<PdmBiProcessroute>().eq("is_delete", "0").eq("processroute_status", 20));
|
||||
return new ResponseEntity<>(list, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -107,8 +107,7 @@ public class ProductprocessrouteController {
|
||||
//("查询产品工艺路线明细")
|
||||
public ResponseEntity<Object> getProductRouteDtl(@RequestBody Map whereJson) {
|
||||
JSONObject jo = JSONObject.parseObject(JSON.toJSONString(whereJson));
|
||||
List<PdmBiProductprocessroutedtl> list = iPdmBiProductprocessroutedtlService.list(new QueryWrapper<PdmBiProductprocessroutedtl>()
|
||||
.eq("productprocess_id", jo.getString("productprocess_id")));
|
||||
List<PdmBiProductprocessroutedtl> list = iPdmBiProductprocessroutedtlService.list(new QueryWrapper<PdmBiProductprocessroutedtl>().eq("productprocess_id", jo.getString("productprocess_id")));
|
||||
return new ResponseEntity<>(list, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -127,4 +126,29 @@ public class ProductprocessrouteController {
|
||||
ipdmBiProductprocessrouteService.unSubmit(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("获取设备列表")
|
||||
@ApiOperation("获取设备列表")
|
||||
@PutMapping("/queryDevice")
|
||||
public ResponseEntity<Object> queryDevice(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(ipdmBiProductprocessrouteService.queryDevice(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("获取设备列表")
|
||||
@ApiOperation("获取设备列表")
|
||||
@PostMapping("/saveDevice")
|
||||
public ResponseEntity<Object> saveDevice(@RequestBody JSONObject row) {
|
||||
ipdmBiProductprocessrouteService.saveDevice(row);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/excelImport")
|
||||
@Log("excel导入")
|
||||
@ApiOperation("excel导入")
|
||||
public ResponseEntity<Object> excelImport(@RequestParam("file") MultipartFile file, HttpServletRequest request, HttpServletResponse response) {
|
||||
RedissonUtils.lock(() -> {
|
||||
ipdmBiProductprocessrouteService.excelImport(file, request, response);
|
||||
}, "系列工艺路线导入", null);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package org.nl.wms.product_manage.service.device.dao;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 生产设备基础信息表
|
||||
|
||||
@@ -119,5 +119,10 @@ public class PdmBiProcessroute implements Serializable {
|
||||
*/
|
||||
private String ext_id;
|
||||
|
||||
/**
|
||||
* 生产区域
|
||||
*/
|
||||
private String product_area;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -63,7 +63,9 @@ public class PdmBiProcessrouteServiceImpl extends ServiceImpl<PdmBiProcessrouteM
|
||||
processroutedtl.setWorkprocedure_no(i + 1);
|
||||
if (i == 0) {
|
||||
processroutedtl.setPreworkprocedure_id("");
|
||||
if (jsonDataArr.size() > 1){
|
||||
processroutedtl.setNextworkprocedure_id(jsonDataArr.getJSONObject(i + 1).getString("workprocedure_id"));
|
||||
}
|
||||
} else if ( i == jsonDataArr.size() - 1) {
|
||||
processroutedtl.setPreworkprocedure_id(jsonDataArr.getJSONObject(i - 1).getString("workprocedure_id"));
|
||||
processroutedtl.setNextworkprocedure_id(" ");
|
||||
@@ -84,12 +86,15 @@ public class PdmBiProcessrouteServiceImpl extends ServiceImpl<PdmBiProcessrouteM
|
||||
processroute.setProcessroute_id(org.nl.common.utils.IdUtil.getStringId());
|
||||
processroute.setProcessroute_code(json.getString("processroute_code"));
|
||||
processroute.setProcessroute_name(json.getString("processroute_name"));
|
||||
processroute.setProduct_area(json.getString("product_area"));
|
||||
processroute.setProcessroute_status("10");
|
||||
processroute.setDetail_count(new BigDecimal(jsonDataArr.size()));
|
||||
processroute.setRemark(json.getString("remark"));
|
||||
processroute.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
processroute.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
processroute.setCreate_time(DateUtil.now());
|
||||
processroute.setSyscompanyid("111");
|
||||
processroute.setSysdeptid("111");
|
||||
return processroute;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
package org.nl.wms.product_manage.service.productProcessRoute;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.product_manage.service.productProcessRoute.dao.PdmBiProductprocessroute;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
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;
|
||||
|
||||
@@ -76,4 +81,10 @@ public interface IPdmBiProductprocessrouteService extends IService<PdmBiProductp
|
||||
void submit(JSONObject whereJson);
|
||||
|
||||
void unSubmit(JSONObject whereJson);
|
||||
|
||||
JSONObject queryDevice(JSONObject whereJson);
|
||||
|
||||
void saveDevice(JSONObject jo);
|
||||
|
||||
void excelImport(MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
|
||||
@@ -27,9 +27,9 @@ public class PdmBiProductprocessroute implements Serializable {
|
||||
private String productprocess_id;
|
||||
|
||||
/**
|
||||
* 物料标识
|
||||
* 系列标识
|
||||
*/
|
||||
private String material_id;
|
||||
private String class_id;
|
||||
|
||||
/**
|
||||
* 工艺路线标识
|
||||
@@ -116,5 +116,10 @@ public class PdmBiProductprocessroute implements Serializable {
|
||||
*/
|
||||
private String ext_id;
|
||||
|
||||
/**
|
||||
* 生产车间
|
||||
*/
|
||||
private String product_area;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -5,14 +5,13 @@
|
||||
<select id="queryAll" resultType="java.util.Map">
|
||||
SELECT
|
||||
pp.*,
|
||||
mb.material_code,
|
||||
(case when pp.productprocess_status = '10' then '生成' when pp.productprocess_status = '20' then '提交' end) AS status_name,
|
||||
mb.material_name,
|
||||
route.processroute_name,
|
||||
route.processroute_code
|
||||
route.processroute_code,
|
||||
class.class_name
|
||||
FROM
|
||||
pdm_bi_productprocessroute pp
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = pp.material_id
|
||||
LEFT JOIN md_pb_classstandard class ON class.class_id = pp.class_id
|
||||
LEFT JOIN PDM_BI_ProcessRoute route ON route.processroute_id = pp.processroute_id
|
||||
WHERE
|
||||
pp.is_delete = '0'
|
||||
@@ -25,9 +24,6 @@
|
||||
<if test="productprocess_status != null and productprocess_status != ''">
|
||||
and pp.productprocess_status = #{productprocess_status}
|
||||
</if>
|
||||
<if test="material_code != null and material_code != ''">
|
||||
and mb.material_code like '%${material_code}%'
|
||||
</if>
|
||||
</select>
|
||||
<select id="getRoutDtl" resultType="java.util.Map">
|
||||
SELECT
|
||||
|
||||
@@ -1,34 +1,50 @@
|
||||
package org.nl.wms.product_manage.service.productProcessRoute.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
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.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.masterdata_manage.master.service.classstandard.IMdPbClassstandardService;
|
||||
import org.nl.wms.masterdata_manage.master.service.classstandard.dao.MdPbClassstandard;
|
||||
import org.nl.wms.product_manage.service.device.IPdmBiDeviceService;
|
||||
import org.nl.wms.product_manage.service.device.dao.PdmBiDevice;
|
||||
import org.nl.wms.product_manage.service.processroute.IPdmBiProcessrouteService;
|
||||
import org.nl.wms.product_manage.service.processroute.IPdmBiProcessroutedtlService;
|
||||
import org.nl.wms.product_manage.service.processroute.dao.PdmBiProcessroute;
|
||||
import org.nl.wms.product_manage.service.productProcessRoute.IPdmBiProductprocessroutedtlService;
|
||||
import org.nl.wms.product_manage.service.processroute.dao.PdmBiProcessroutedtl;
|
||||
import org.nl.wms.product_manage.service.productProcessRoute.IPdmBiProductprocessrouteService;
|
||||
import org.nl.wms.product_manage.service.productProcessRoute.dao.PdmBiProductprocessroute;
|
||||
import org.nl.wms.product_manage.service.productProcessRoute.dao.PdmBiProductprocessroutedtl;
|
||||
import org.nl.wms.product_manage.service.productProcessRoute.dao.mapper.PdmBiProductprocessrouteMapper;
|
||||
import org.nl.wms.product_manage.service.productProcessRoute.IPdmBiProductprocessrouteService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.wms.product_manage.service.workorder.dao.PdmProduceWorkorder;
|
||||
import org.nl.wms.product_manage.service.workprocedure.IPdmBiWorkprocedureService;
|
||||
import org.nl.wms.product_manage.service.workprocedure.dao.PdmBiWorkprocedure;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
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.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -43,6 +59,16 @@ public class PdmBiProductprocessrouteServiceImpl extends ServiceImpl<PdmBiProduc
|
||||
|
||||
@Autowired
|
||||
private PdmBiProductprocessroutedtlServiceImpl productprocessroutedtlService;
|
||||
@Autowired
|
||||
private IPdmBiDeviceService pdmBiDeviceService;
|
||||
@Autowired
|
||||
IMdPbClassstandardService classstandardService;
|
||||
@Autowired
|
||||
private IPdmBiProcessrouteService processrouteService;
|
||||
@Autowired
|
||||
private IPdmBiProcessroutedtlService processroutedtlService;
|
||||
@Autowired
|
||||
private IPdmBiWorkprocedureService workprocedureService;
|
||||
|
||||
@Override
|
||||
public List<Map> queryAll(Map whereJson, Pageable page) {
|
||||
@@ -73,17 +99,15 @@ public class PdmBiProductprocessrouteServiceImpl extends ServiceImpl<PdmBiProduc
|
||||
throw new BadRequestException("不存在任何明细!");
|
||||
}
|
||||
//创建主表
|
||||
PdmBiProductprocessroute one = this.getOne(new QueryWrapper<PdmBiProductprocessroute>()
|
||||
.eq("material_id", jo.getString("material_id"))
|
||||
.eq("is_delete", '0'));
|
||||
PdmBiProductprocessroute one = this.getOne(new QueryWrapper<PdmBiProductprocessroute>().eq("class_id", jo.getString("class_id")).eq("is_delete", '0'));
|
||||
if (one != null) {
|
||||
throw new BadRequestException("该产品已经存在工艺路线!");
|
||||
throw new BadRequestException("该系列已经存在工艺路线!");
|
||||
}
|
||||
PdmBiProductprocessroute packageMst = packageMst(jo, rows);
|
||||
this.save(packageMst);
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject row = rows.getJSONObject(i);
|
||||
row.put("productprocessdtl_id", org.nl.common.utils.IdUtil.getStringId());
|
||||
row.put("productprocessdtl_id", IdUtil.getStringId());
|
||||
row.put("productprocess_id", packageMst.getProductprocess_id());
|
||||
PdmBiProductprocessroutedtl item = row.toJavaObject(PdmBiProductprocessroutedtl.class);
|
||||
productprocessroutedtlService.save(item);
|
||||
@@ -92,9 +116,10 @@ public class PdmBiProductprocessrouteServiceImpl extends ServiceImpl<PdmBiProduc
|
||||
|
||||
private PdmBiProductprocessroute packageMst(JSONObject jo, JSONArray rows) {
|
||||
PdmBiProductprocessroute productprocessroute = new PdmBiProductprocessroute();
|
||||
productprocessroute.setProductprocess_id(org.nl.common.utils.IdUtil.getStringId());
|
||||
productprocessroute.setMaterial_id(jo.getString("material_id"));
|
||||
productprocessroute.setProductprocess_id(IdUtil.getStringId());
|
||||
productprocessroute.setClass_id(jo.getString("class_id"));
|
||||
productprocessroute.setProcessroute_id(jo.getString("processroute_id"));
|
||||
productprocessroute.setProduct_area(jo.getString("product_area"));
|
||||
productprocessroute.setProductprocess_status("10");
|
||||
productprocessroute.setDetail_count(rows.size());
|
||||
productprocessroute.setRemark(jo.getString("remark"));
|
||||
@@ -102,6 +127,8 @@ public class PdmBiProductprocessrouteServiceImpl extends ServiceImpl<PdmBiProduc
|
||||
productprocessroute.setCreate_time(DateUtil.now());
|
||||
productprocessroute.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
productprocessroute.setIs_delete("0");
|
||||
productprocessroute.setSyscompanyid("111");
|
||||
productprocessroute.setSysdeptid("111");
|
||||
return productprocessroute;
|
||||
}
|
||||
|
||||
@@ -119,26 +146,16 @@ public class PdmBiProductprocessrouteServiceImpl extends ServiceImpl<PdmBiProduc
|
||||
}
|
||||
String productprocess_id = jo.getString("productprocess_id");
|
||||
|
||||
PdmBiProductprocessroute one = this.getOne(new QueryWrapper<PdmBiProductprocessroute>()
|
||||
.eq("material_id", jo.getString("material_id"))
|
||||
.eq("is_delete", '0')
|
||||
.ne("productprocess_id",productprocess_id));
|
||||
PdmBiProductprocessroute one = this.getOne(new QueryWrapper<PdmBiProductprocessroute>().eq("class_id", jo.getString("class_id")).eq("is_delete", '0').ne("productprocess_id", productprocess_id));
|
||||
if (one != null) {
|
||||
throw new BadRequestException("该产品已经存在工艺路线!");
|
||||
throw new BadRequestException("该系列已经存在工艺路线!");
|
||||
}
|
||||
|
||||
this.update(new UpdateWrapper<PdmBiProductprocessroute>()
|
||||
.set("remark",jo.getString("remark"))
|
||||
.set("material_id",jo.getString("material_id"))
|
||||
.set("detail_count",rows.size())
|
||||
.set("update_optid",SecurityUtils.getCurrentUserId())
|
||||
.set("update_optname",SecurityUtils.getCurrentNickName())
|
||||
.set("update_time",DateUtil.now()).eq("productprocess_id",jo.getString("productprocess_id") ));
|
||||
productprocessroutedtlService.remove(new QueryWrapper<PdmBiProductprocessroutedtl>()
|
||||
.eq("productprocess_id",jo.getString("productprocess_id")));
|
||||
this.update(new UpdateWrapper<PdmBiProductprocessroute>().set("remark", jo.getString("remark")).set("class_id", jo.getString("class_id")).set("detail_count", rows.size()).set("update_optid", SecurityUtils.getCurrentUserId()).set("update_optname", SecurityUtils.getCurrentNickName()).set("update_time", DateUtil.now()).eq("productprocess_id", jo.getString("productprocess_id")));
|
||||
productprocessroutedtlService.remove(new QueryWrapper<PdmBiProductprocessroutedtl>().eq("productprocess_id", jo.getString("productprocess_id")));
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject row = rows.getJSONObject(i);
|
||||
row.put("productprocessdtl_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
row.put("productprocessdtl_id", IdUtil.getStringId());
|
||||
row.put("productprocess_id", productprocess_id);
|
||||
PdmBiProductprocessroutedtl item = row.toJavaObject(PdmBiProductprocessroutedtl.class);
|
||||
productprocessroutedtlService.save(item);
|
||||
@@ -147,12 +164,7 @@ public class PdmBiProductprocessrouteServiceImpl extends ServiceImpl<PdmBiProduc
|
||||
|
||||
@Override
|
||||
public void deleteAll(Long[] ids) {
|
||||
this.update(new UpdateWrapper<PdmBiProductprocessroute>()
|
||||
.set("is_delete","1")
|
||||
.set("update_optid",SecurityUtils.getCurrentUserId())
|
||||
.set("update_optname",SecurityUtils.getCurrentNickName())
|
||||
.set("update_time",DateUtil.now())
|
||||
.in("productprocess_id",ids ));
|
||||
this.update(new UpdateWrapper<PdmBiProductprocessroute>().set("is_delete", "1").set("update_optid", SecurityUtils.getCurrentUserId()).set("update_optname", SecurityUtils.getCurrentNickName()).set("update_time", DateUtil.now()).in("productprocess_id", ids));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -173,27 +185,180 @@ public class PdmBiProductprocessrouteServiceImpl extends ServiceImpl<PdmBiProduc
|
||||
|
||||
@Override
|
||||
public void submit(JSONObject whereJson) {
|
||||
this.update(new UpdateWrapper<PdmBiProductprocessroute>()
|
||||
.set("productprocess_status","20")
|
||||
.set("update_optid",SecurityUtils.getCurrentUserId())
|
||||
.set("update_optname",SecurityUtils.getCurrentNickName())
|
||||
.set("update_time",DateUtil.now())
|
||||
.set("audit_optid",SecurityUtils.getCurrentUserId())
|
||||
.set("audit_optname",SecurityUtils.getCurrentNickName())
|
||||
.set("audit_time",DateUtil.now())
|
||||
.eq("processroute_id",whereJson.getString("processroute_id")));
|
||||
this.update(new UpdateWrapper<PdmBiProductprocessroute>().set("productprocess_status", "20").set("update_optid", SecurityUtils.getCurrentUserId()).set("update_optname", SecurityUtils.getCurrentNickName()).set("update_time", DateUtil.now()).set("audit_optid", SecurityUtils.getCurrentUserId()).set("audit_optname", SecurityUtils.getCurrentNickName()).set("audit_time", DateUtil.now()).eq("processroute_id", whereJson.getString("processroute_id")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unSubmit(JSONObject whereJson) {
|
||||
this.update(new UpdateWrapper<PdmBiProductprocessroute>()
|
||||
.set("productprocess_status","10")
|
||||
.set("update_optid",SecurityUtils.getCurrentUserId())
|
||||
.set("update_optname",SecurityUtils.getCurrentNickName())
|
||||
.set("update_time",DateUtil.now())
|
||||
.set("audit_optid"," ")
|
||||
.set("audit_optname"," ")
|
||||
.set("audit_time"," ")
|
||||
.eq("processroute_id",whereJson.getString("processroute_id")));
|
||||
this.update(new UpdateWrapper<PdmBiProductprocessroute>().set("productprocess_status", "10").set("update_optid", SecurityUtils.getCurrentUserId()).set("update_optname", SecurityUtils.getCurrentNickName()).set("update_time", DateUtil.now()).set("audit_optid", " ").set("audit_optname", " ").set("audit_time", " ").eq("processroute_id", whereJson.getString("processroute_id")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveDevice(JSONObject jo) {
|
||||
String class_id = jo.getString("class_id");
|
||||
String workprocedure_id = jo.getJSONObject("jo").getString("workprocedure_id");
|
||||
JSONArray rows = jo.getJSONArray("rows");
|
||||
|
||||
List<PdmBiDevice> check_list = pdmBiDeviceService.list(new QueryWrapper<PdmBiDevice>().lambda().eq(PdmBiDevice::getWorkprocedure_id, workprocedure_id).eq(PdmBiDevice::getIs_delete, false).like(PdmBiDevice::getProduct_series, class_id));
|
||||
|
||||
for (int j = 0; j < rows.size(); j++) {
|
||||
JSONObject row = rows.getJSONObject(j);
|
||||
PdmBiDevice device = row.toJavaObject(PdmBiDevice.class);
|
||||
String product_series = device.getProduct_series();
|
||||
if (StrUtil.isEmpty(product_series)) {
|
||||
device.setProduct_series(class_id + ",");
|
||||
} else {
|
||||
if (!product_series.contains(class_id)) {
|
||||
product_series = product_series + class_id + ",";
|
||||
device.setProduct_series(product_series);
|
||||
}
|
||||
}
|
||||
pdmBiDeviceService.updateById(device);
|
||||
}
|
||||
|
||||
List<PdmBiDevice> remove_list = check_list.stream().filter(device -> {
|
||||
boolean need_remove = true;
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject row = rows.getJSONObject(i);
|
||||
if (row.getString("device_code").equals(device.getDevice_code())) {
|
||||
need_remove = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return need_remove;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
for (PdmBiDevice device : remove_list) {
|
||||
String product_series = device.getProduct_series();
|
||||
String[] split = product_series.split(class_id + ",");
|
||||
if (split.length == 0) {
|
||||
device.setProduct_series("");
|
||||
} else if (split.length == 1) {
|
||||
device.setProduct_series(split[0]);
|
||||
} else {
|
||||
device.setProduct_series(split[0] + split[1]);
|
||||
}
|
||||
pdmBiDeviceService.updateById(device);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject queryDevice(JSONObject whereJson) {
|
||||
JSONObject jo = new JSONObject();
|
||||
|
||||
//查询当前工序对应的设备
|
||||
String workprocedure_id = whereJson.getString("workprocedure_id");
|
||||
String class_id = whereJson.getString("class_id");
|
||||
List<PdmBiDevice> device_list = pdmBiDeviceService.list(new QueryWrapper<PdmBiDevice>().lambda().eq(PdmBiDevice::getWorkprocedure_id, workprocedure_id).eq(PdmBiDevice::getIs_delete, false));
|
||||
|
||||
jo.put("device_list", device_list);
|
||||
//查询当前系列所选择的设备列表
|
||||
List<PdmBiDevice> check_list = device_list.stream().filter(device -> !StrUtil.isEmpty(device.getProduct_series()) && device.getProduct_series().contains(class_id)).collect(Collectors.toList());
|
||||
jo.put("check_list", check_list);
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void excelImport(MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
InputStream inputStream = file.getInputStream();
|
||||
ExcelReader excelReader = ExcelUtil.getReader(inputStream);
|
||||
List<List<Object>> read = excelReader.read();
|
||||
|
||||
Map<String, String> errorMap = new HashMap();
|
||||
for (int i = 1; i < read.size(); i++) {
|
||||
List<Object> list = read.get(i);
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
continue;
|
||||
}
|
||||
String product_area = (String) list.get(0);
|
||||
if (StrUtil.isEmpty(product_area)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "生产车间为空!");
|
||||
}
|
||||
String class_desc = (String) list.get(1);
|
||||
if (StrUtil.isEmpty(class_desc)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "系列编码为空!");
|
||||
continue;
|
||||
}
|
||||
MdPbClassstandard class_jo = classstandardService.getOne(new QueryWrapper<MdPbClassstandard>().eq("class_desc", class_desc).eq("is_delete", false));
|
||||
if (ObjectUtil.isEmpty(class_jo)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "系列编码对应的系列不存在!");
|
||||
continue;
|
||||
}
|
||||
String processroute_code = (String) list.get(2);
|
||||
if (StrUtil.isEmpty(class_desc)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "工艺路线为空!");
|
||||
continue;
|
||||
}
|
||||
PdmBiProcessroute route_jo = processrouteService.getOne(new QueryWrapper<PdmBiProcessroute>().eq("processroute_code", processroute_code).eq("is_delete", false));
|
||||
if (ObjectUtil.isEmpty(route_jo)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "工艺路线编码对应的工艺路线不存在!");
|
||||
continue;
|
||||
}
|
||||
|
||||
//查询该系列是否存在工艺路线
|
||||
PdmBiProductprocessroute product_jo = this.getOne(new QueryWrapper<PdmBiProductprocessroute>().lambda().eq(PdmBiProductprocessroute::getClass_id, class_jo.getClass_id()).eq(PdmBiProductprocessroute::getIs_delete, false));
|
||||
if (ObjectUtil.isNotEmpty(product_jo)) {
|
||||
if (!product_jo.getProcessroute_id().equals(route_jo.getProcessroute_id())) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "该系列已存在其他的工艺路线!");
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
//为这个系列新增工艺路线
|
||||
Map map = new HashMap();
|
||||
map.put("class_id", class_jo.getClass_id());
|
||||
map.put("product_area", product_area);
|
||||
map.put("processroute_id", route_jo.getProcessroute_id());
|
||||
//查询对应的明细工艺路线明细
|
||||
List<PdmBiProcessroutedtl> dtl_list = processroutedtlService.list(new QueryWrapper<PdmBiProcessroutedtl>().eq("processroute_id", route_jo.getProcessroute_id()));
|
||||
map.put("tableData", dtl_list);
|
||||
this.create(map);
|
||||
}
|
||||
|
||||
String workprocedure_code = (String) list.get(3);
|
||||
if (StrUtil.isEmpty(class_desc)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "工序编号为空!");
|
||||
continue;
|
||||
}
|
||||
PdmBiWorkprocedure workprocedure = workprocedureService.getOne(new QueryWrapper<PdmBiWorkprocedure>().eq("workprocedure_code", workprocedure_code));
|
||||
if (ObjectUtil.isEmpty(workprocedure)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "为查询到该工序编号对应的工序!");
|
||||
continue;
|
||||
}
|
||||
String device_list = (String) list.get(4);
|
||||
if (StrUtil.isNotEmpty(device_list)) {
|
||||
if (device_list.contains(",")) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "设备请用英文逗号隔开!");
|
||||
continue;
|
||||
}
|
||||
String[] split = device_list.split(",");
|
||||
for (String s : split) {
|
||||
if (StrUtil.isNotEmpty(s)) {
|
||||
PdmBiDevice device_jo = pdmBiDeviceService.getOne(new QueryWrapper<PdmBiDevice>().eq("device_code", s).eq("is_delete", false));
|
||||
if (ObjectUtil.isEmpty(device_jo)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "未查询到设备编号:" + s + "对应的设备!");
|
||||
continue;
|
||||
}
|
||||
if (!device_jo.getWorkprocedure_id().equals(workprocedure.getWorkprocedure_id())) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "设备编号:" + s + "和当前填入工序:" + workprocedure.getWorkprocedure_code() + "不匹配!");
|
||||
continue;
|
||||
}
|
||||
String product_series = device_jo.getProduct_series();
|
||||
if (StrUtil.isEmpty(product_series)) {
|
||||
device_jo.setProduct_series(class_jo.getClass_id() + ",");
|
||||
} else {
|
||||
if (!product_series.contains(class_jo.getClass_id())) {
|
||||
product_series = product_series + class_jo.getClass_id() + ",";
|
||||
device_jo.setProduct_series(product_series);
|
||||
}
|
||||
}
|
||||
pdmBiDeviceService.updateById(device_jo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(errorMap)) {
|
||||
throw new BadRequestException(JSON.toJSONString(errorMap));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,12 +9,12 @@ spring:
|
||||
client:
|
||||
reactive:
|
||||
#endpoints: 172.31.185.110:8200,172.31.154.9:8200 #内网
|
||||
# endpoints: 47.96.133.178:8200 #外网
|
||||
endpoints: http://192.168.46.225:9200 #外网
|
||||
endpoints: 47.96.133.178:8200 #外网
|
||||
# endpoints: http://192.168.46.225:9200 #外网
|
||||
elasticsearch:
|
||||
rest:
|
||||
#uris: 172.31.185.110:8200,172.31.154.9:8200 #内网
|
||||
uris: 47.96.133.178:8200 #外网
|
||||
uris: 192.168.81.54:9200 #外网
|
||||
# uris: http://192.168.46.225:9200 #外网
|
||||
# username: elastic
|
||||
# password: 123456
|
||||
|
||||
@@ -64,4 +64,28 @@ export function unSubmit(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getRoute, getRouteDtl, getProductRouteDtl, submit, unSubmit }
|
||||
export function queryDevice(data) {
|
||||
return request({
|
||||
url: 'api/productprocessroute/queryDevice',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function saveDevice(data) {
|
||||
return request({
|
||||
url: 'api/productprocessroute/saveDevice',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function excelImport(data) {
|
||||
return request({
|
||||
url: 'api/productprocessroute/excelImport',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getRoute, getRouteDtl, getProductRouteDtl, submit, unSubmit, queryDevice, saveDevice, excelImport }
|
||||
|
||||
@@ -79,4 +79,12 @@ export function getClassName() {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getClass, getClassSuperior, getClassType, getClassTable, getType, queryClassById, getClassName }
|
||||
export function excelImport(data) {
|
||||
return request({
|
||||
url: 'api/Classstandard/excelImport',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getClass, getClassSuperior, getClassType, getClassTable, getType, queryClassById, getClassName, excelImport }
|
||||
|
||||
@@ -24,6 +24,14 @@ export function edit(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function excelImport(data) {
|
||||
return request({
|
||||
url: 'api/customerbase/excelImport',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function selectList() {
|
||||
return request({
|
||||
url: 'api/customerbase/selectList',
|
||||
@@ -31,4 +39,4 @@ export function selectList() {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, selectList }
|
||||
export default { add, edit, del, selectList, excelImport }
|
||||
|
||||
@@ -55,4 +55,12 @@ export function getProductSeries() {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getMaterOptType, isAlongMaterType, synchronize, getProductSeries }
|
||||
export function excelImport(data) {
|
||||
return request({
|
||||
url: 'api/mdMeMaterialbase/excelImport',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getMaterOptType, isAlongMaterType, synchronize, getProductSeries, excelImport }
|
||||
|
||||
@@ -32,4 +32,12 @@ export function updateRawmaterial(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, updateRawmaterial }
|
||||
export function excelImport(data) {
|
||||
return request({
|
||||
url: 'api/semirealrawmaterial/excelImport',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, updateRawmaterial, excelImport }
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
<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 crudClassstandard from '@/api/wms/basedata/master/classstandard'
|
||||
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:传递参数
|
||||
crudClassstandard.excelImport(formdata).then((res) => {
|
||||
this.crud.notify('导入成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.$emit('tableChanged3', '')
|
||||
this.$emit('update:dialogShow', false)
|
||||
}).catch(err => {
|
||||
debugger
|
||||
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>
|
||||
|
||||
@@ -44,6 +44,16 @@
|
||||
>
|
||||
全部展开
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="warning"
|
||||
icon="el-icon-upload2"
|
||||
size="mini"
|
||||
@click="uploadShow = true"
|
||||
>
|
||||
导入
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
<!--表单组件-->
|
||||
<el-dialog
|
||||
@@ -126,6 +136,7 @@
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
<UploadDialog :dialog-show.sync="uploadShow" @tableChanged3="crud.toQuery()"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -138,6 +149,7 @@ import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import UploadDialog from '@/views/wms/masterdata_manage/master/class/UploadDialog'
|
||||
|
||||
let defaultForm = {
|
||||
class_id: null,
|
||||
@@ -166,7 +178,7 @@ let defaultForm = {
|
||||
export default {
|
||||
name: 'Classstandard',
|
||||
dicts: ['base_data'],
|
||||
components: { pagination, crudOperation, rrOperation, udOperation, Treeselect },
|
||||
components: {UploadDialog, pagination, crudOperation, rrOperation, udOperation, Treeselect },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
@@ -184,6 +196,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
classes: [],
|
||||
uploadShow: false,
|
||||
classNames: [],
|
||||
permission: {},
|
||||
rules: {
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
<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 crudCustomerbase from '@/api/wms/basedata/master/customerbase'
|
||||
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:传递参数
|
||||
crudCustomerbase.excelImport(formdata).then((res) => {
|
||||
this.crud.notify('导入成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.$emit('tableChanged3', '')
|
||||
this.$emit('update:dialogShow', false)
|
||||
}).catch(err => {
|
||||
debugger
|
||||
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>
|
||||
|
||||
@@ -13,7 +13,18 @@
|
||||
/>
|
||||
<rrOperation />
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission" />
|
||||
<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"
|
||||
@@ -159,6 +170,7 @@
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
<UploadDialog :dialog-show.sync="uploadShow" @tableChanged3="crud.toQuery()"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -172,6 +184,7 @@ 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 UploadDialog from '@/views/wms/masterdata_manage/master/customer/UploadDialog'
|
||||
|
||||
const defaultForm = {
|
||||
cust_id: null,
|
||||
@@ -202,7 +215,7 @@ const defaultForm = {
|
||||
export default {
|
||||
name: 'Customerbase',
|
||||
dicts: ['is_used'],
|
||||
components: { pagination, crudOperation, rrOperation, udOperation, Treeselect },
|
||||
components: {UploadDialog, pagination, crudOperation, rrOperation, udOperation, Treeselect },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
@@ -220,6 +233,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
permission: {},
|
||||
uploadShow: false,
|
||||
classes: [],
|
||||
rules: {
|
||||
cust_id: [
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
<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 => {
|
||||
debugger
|
||||
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>
|
||||
|
||||
@@ -49,6 +49,16 @@
|
||||
>
|
||||
同步
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="warning"
|
||||
icon="el-icon-upload2"
|
||||
size="mini"
|
||||
@click="uploadShow = true"
|
||||
>
|
||||
导入
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
<!--表单组件-->
|
||||
<el-dialog
|
||||
@@ -178,6 +188,7 @@
|
||||
<pagination/>
|
||||
</div>
|
||||
<Dialog :dialog-show.sync="dialogShow"/>
|
||||
<UploadDialog :dialog-show.sync="uploadShow" @tableChanged3="crud.toQuery()"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -193,6 +204,7 @@ 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/masterdata_manage/master/material/UploadDialog'
|
||||
|
||||
const defaultForm = {
|
||||
material_id: null,
|
||||
@@ -232,7 +244,7 @@ export default {
|
||||
name: 'Materialbase',
|
||||
// 数据字典
|
||||
dicts: ['is_used'],
|
||||
components: {pagination, crudOperation, rrOperation, udOperation, Treeselect, Dialog},
|
||||
components: {UploadDialog, pagination, crudOperation, rrOperation, udOperation, Treeselect, Dialog},
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
@@ -250,6 +262,7 @@ export default {
|
||||
classes2: [],
|
||||
classes3: [],
|
||||
dialogShow: false,
|
||||
uploadShow: false,
|
||||
fullscreenLoading: false,
|
||||
measure_unit: [],
|
||||
productSeries: [],
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
<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 crudSemirealrawmaterial from '@/api/wms/basedata/master/semirealrawmaterial'
|
||||
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:传递参数
|
||||
crudSemirealrawmaterial.excelImport(formdata).then((res) => {
|
||||
this.crud.notify('导入成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.$emit('tableChanged3', '')
|
||||
this.$emit('update:dialogShow', false)
|
||||
}).catch(err => {
|
||||
debugger
|
||||
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>
|
||||
|
||||
@@ -36,12 +36,38 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="所属工序">
|
||||
<el-select v-model="form.workprocedure_id" filterable clearable size="small" placeholder="所属工序" class="filter-item" style="width: 280px">
|
||||
<el-option
|
||||
v-for="item in workList"
|
||||
:key="item.workprocedure_id"
|
||||
:label="item.workprocedure_name"
|
||||
:value="item.workprocedure_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="selectRawMaterialDialog2 = false">取消</el-button>
|
||||
<el-button :loading="crud.cu === 2" type="primary" @click="submit">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<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-table
|
||||
ref="table"
|
||||
@@ -54,6 +80,7 @@
|
||||
:header-cell-style="{'text-align':'center'}"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column prop="workprocedure_name" label="工序名称" :min-width="100" show-overflow-tooltip/>
|
||||
<el-table-column prop="material_code" label="半成品编码" :min-width="100" show-overflow-tooltip/>
|
||||
<el-table-column prop="material_name" label="半成品名称" :min-width="180" show-overflow-tooltip/>
|
||||
<el-table-column prop="material_spec" label="半成品规格" :min-width="150" show-overflow-tooltip/>
|
||||
@@ -73,6 +100,7 @@
|
||||
<pagination/>
|
||||
<SelectRawMaterialDialog ref="selectRawMaterialDialog" :dialog-show.sync="selectRawMaterialDialog"
|
||||
@tableChanged3="tableChanged3"/>
|
||||
<UploadDialog :dialog-show.sync="uploadShow" @tableChanged3="crud.toQuery()"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -83,6 +111,8 @@ import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import SelectRawMaterialDialog from './SelectRawMaterialDialog'
|
||||
import crudDevice from '@/api/wms/pdm/device'
|
||||
import UploadDialog from './UploadDialog'
|
||||
|
||||
const defaultForm = {
|
||||
relation_id: null,
|
||||
@@ -98,7 +128,7 @@ const defaultForm = {
|
||||
|
||||
export default {
|
||||
name: 'Semirealrawmaterial',
|
||||
components: {pagination, crudOperation, rrOperation, SelectRawMaterialDialog},
|
||||
components: {UploadDialog, pagination, crudOperation, rrOperation, SelectRawMaterialDialog},
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
@@ -117,16 +147,22 @@ export default {
|
||||
return {
|
||||
selectRawMaterialDialog: false,
|
||||
selectRawMaterialDialog2: false,
|
||||
uploadShow: false,
|
||||
workList: [],
|
||||
form: {
|
||||
material_code: '',
|
||||
material_id: '',
|
||||
relation_id: '',
|
||||
workprocedure_id: '',
|
||||
rate_qty: ''
|
||||
},
|
||||
permission: {},
|
||||
rules: {}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getWorkprocedure()
|
||||
},
|
||||
methods: {
|
||||
addMaterial(row) {
|
||||
this.form.relation_id = row.relation_id
|
||||
@@ -140,6 +176,12 @@ export default {
|
||||
this.form.material_id = row.material_id
|
||||
this.form.material_code = row.material_code
|
||||
},
|
||||
getWorkprocedure() { // 获取工序下拉框
|
||||
crudDevice.getWorkprocedure().then(res => {
|
||||
console.log(res)
|
||||
this.workList = res
|
||||
})
|
||||
},
|
||||
submit() {
|
||||
if (this.form.relation_id === '') {
|
||||
this.crud.notify('请选择一条要设置的半成品', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
label-width="90px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="所属区域">
|
||||
<el-form-item label="生产车间">
|
||||
<el-select
|
||||
v-model="query.product_area"
|
||||
clearable
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="success"
|
||||
type="success"Ï
|
||||
icon="el-icon-check"
|
||||
:disabled="crud.selections.length === 0"
|
||||
size="mini"
|
||||
|
||||
@@ -23,21 +23,42 @@
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="mini" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;">
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="mini">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="产品" prop="material_code">
|
||||
<el-input v-model="form.material_code" readonly :disabled="crud.status.edit || crud.status.view > 0 " style="width: 200px;">
|
||||
<el-button
|
||||
slot="append"
|
||||
icon="el-icon-plus"
|
||||
:disabled="crud.status.edit || crud.status.view > 0"
|
||||
@click="queryMater"
|
||||
<el-form-item label="产品系列">
|
||||
<treeselect
|
||||
v-model="form.class_id"
|
||||
:options="classes3"
|
||||
:disabled="crud.status.view > 0"
|
||||
:auto-load-root-options="false"
|
||||
:load-options="loadChildNodes"
|
||||
style="width: 200px;"
|
||||
placeholder="请选择"
|
||||
/>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="生产车间" prop="product_area">
|
||||
<el-select
|
||||
v-model="form.product_area"
|
||||
placeholder=""
|
||||
:disabled="crud.status.view > 0"
|
||||
style="width: 200px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.product_area"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="工艺路线" prop="processroute_id">
|
||||
<el-select
|
||||
@@ -67,72 +88,80 @@
|
||||
</el-form>
|
||||
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<el-row :gutter="10">
|
||||
<el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12" style="margin-bottom: 15px">
|
||||
<el-card class="box-card">
|
||||
<div class="crud-opts2" style="margin-top: 30px;margin-bottom: 12px">
|
||||
<span class="role-span">产品工艺路线明细</span>
|
||||
</div>
|
||||
<span v-if="crud.status.cu > 0 || crud.status.view > 0" class="crud-opts-right2">
|
||||
<!--左侧插槽-->
|
||||
<slot name="left" />
|
||||
<el-button
|
||||
slot="left"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
:disabled="crud.status.view > 0"
|
||||
@click="insertLine"
|
||||
>
|
||||
新增一行
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="left"
|
||||
class="filter-item"
|
||||
type="danger"
|
||||
icon="el-icon-close"
|
||||
size="mini"
|
||||
:disabled="crud.status.view > 0"
|
||||
@click="delLine"
|
||||
>
|
||||
删除一行
|
||||
</el-button>
|
||||
</span>
|
||||
|
||||
<el-table
|
||||
ref="table"
|
||||
:data="form.tableData"
|
||||
style="width: 100%;"
|
||||
border
|
||||
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
@current-change="handleCurrentChange"
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="55" align="center" />
|
||||
<el-table-column prop="processroute_name" label="工艺名称" />
|
||||
<el-table-column prop="workprocedure_no" label="工序顺序" />
|
||||
<el-table-column prop="workprocedure_name" label="当前工序" />
|
||||
</el-table>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12" style="margin-bottom: 10px">
|
||||
<el-card class="box-card">
|
||||
<div class="crud-opts2" style="margin-top: 30px;margin-bottom: 12px">
|
||||
<span class="role-span">设备列表</span>
|
||||
</div>
|
||||
<el-button
|
||||
icon="el-icon-check"
|
||||
size="mini"
|
||||
:disabled="crud.status.view > 0"
|
||||
style="float: right; margin-bottom: 5px;"
|
||||
type="primary"
|
||||
@click="save"
|
||||
>保存
|
||||
</el-button>
|
||||
<el-table
|
||||
ref="multipleTable"
|
||||
:data="deviceList"
|
||||
style="width: 100%;"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="device_code" label="设备编码" />
|
||||
<el-table-column prop="device_name" label="设备名称" />
|
||||
</el-table>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
<MaterDtl :dialog-show.sync="materShow" :mater-opt-code="materType" @setMaterValue="setMaterValue" />
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import MaterDtl from '@/views/wms/pub/MaterDialog'
|
||||
import CRUD, { form, crud } from '@crud/crud'
|
||||
import crudProductRoute from '@/api/productprocessroute'
|
||||
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'
|
||||
|
||||
const defaultForm = {
|
||||
productprocess_id: null,
|
||||
material_id: null,
|
||||
material_code: null,
|
||||
class_id: null,
|
||||
processroute_id: null,
|
||||
remark: null,
|
||||
product_area: null,
|
||||
tableData: []
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'AddDialog',
|
||||
components: { MaterDtl },
|
||||
dicts: ['product_area'],
|
||||
components: {Treeselect },
|
||||
mixins: [form(defaultForm), crud()],
|
||||
props: {
|
||||
dialogShow: {
|
||||
@@ -146,9 +175,10 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
routeList: [],
|
||||
classes3: [],
|
||||
deviceList: [],
|
||||
dialogVisible: false,
|
||||
materType: '03',
|
||||
materShow: false,
|
||||
currentRow: null,
|
||||
serieseList: [],
|
||||
rules: {
|
||||
material_code: [
|
||||
@@ -174,12 +204,29 @@ export default {
|
||||
this.form.tableData = res
|
||||
})
|
||||
},
|
||||
[CRUD.HOOK.beforeToCU](crud, form) {
|
||||
crudMdPbMeasureunit.getUnit().then(res => {
|
||||
this.measure_unit = res.content
|
||||
})
|
||||
// 物料系列为空,新增
|
||||
if (!form.class_id) {
|
||||
form.class_id = null // 必须为null,否则会出现unknown
|
||||
} else { // 更新
|
||||
this.getSubTypes('03', form.class_id)
|
||||
}
|
||||
},
|
||||
[CRUD.HOOK.afterToEdit]() {
|
||||
this.getDtl(this.form.processroute_id)
|
||||
},
|
||||
[CRUD.HOOK.afterToView]() {
|
||||
[CRUD.HOOK.afterToView](crud, form) {
|
||||
this.getRoute()
|
||||
this.getDtl(this.form.processroute_id)
|
||||
// 物料系列为空,新增
|
||||
if (!form.class_id) {
|
||||
form.class_id = null // 必须为null,否则会出现unknown
|
||||
} else { // 更新
|
||||
this.getSubTypes('03', form.class_id)
|
||||
}
|
||||
},
|
||||
handleClose(done) {
|
||||
this.$confirm('确认关闭?')
|
||||
@@ -189,7 +236,51 @@ export default {
|
||||
.catch(_ => {
|
||||
})
|
||||
},
|
||||
initClass3() {
|
||||
const param = {
|
||||
parent_class_code: '07'
|
||||
}
|
||||
crudClassstandard.getClassType(param).then(res => {
|
||||
const data = res.content
|
||||
this.buildTree(data)
|
||||
this.classes3 = data
|
||||
})
|
||||
},
|
||||
save() {
|
||||
if (!this.deviceList) {
|
||||
this.crud.notify('设备列表不能为空!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
const row = {}
|
||||
row.jo = this.currentRow
|
||||
row.class_id = this.form.class_id
|
||||
row.rows = this.$refs.multipleTable.selection
|
||||
crudProductRoute.saveDevice(row).then(res => {
|
||||
this.crud.notify('保存成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
})
|
||||
},
|
||||
getSubTypes(type, id) {
|
||||
const that = this
|
||||
crudClassstandard.getClassSuperior(id).then(res => {
|
||||
const data = res.content
|
||||
that.buildTree(data)
|
||||
if (type === '03') {
|
||||
this.classes3 = data
|
||||
}
|
||||
})
|
||||
},
|
||||
buildTree(classes) {
|
||||
classes.forEach(data => {
|
||||
if (data.children) {
|
||||
this.buildTree(data.children)
|
||||
}
|
||||
if (data.hasChildren && !data.children) {
|
||||
data.children = null // 重点代码
|
||||
}
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.deviceList = []
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('AddChanged')
|
||||
},
|
||||
@@ -197,22 +288,59 @@ export default {
|
||||
this.materShow = true
|
||||
},
|
||||
open() {
|
||||
this.initClass3()
|
||||
this.getRoute()
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
if (val) {
|
||||
if (!this.form.class_id) {
|
||||
this.crud.notify('请先选择系列!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
this.$refs.multipleTable.clearSelection()
|
||||
this.currentRow = val
|
||||
val.class_id = this.form.class_id
|
||||
crudProductRoute.queryDevice(val).then(res => {
|
||||
this.deviceList = res.device_list
|
||||
// toggleRowSelection 需在$nextTick中使用!
|
||||
this.$nextTick(() => {
|
||||
this.deviceList.forEach(row => {
|
||||
res.check_list.forEach(selected => {
|
||||
if (selected.device_code === row.device_code) {
|
||||
debugger
|
||||
this.$refs.multipleTable.toggleRowSelection(row, true)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
getRoute() {
|
||||
// 查询原材料库的仓库
|
||||
crudProductRoute.getRoute({}).then(res => {
|
||||
this.routeList = res
|
||||
})
|
||||
},
|
||||
setMaterValue(row) {
|
||||
console.log(row)
|
||||
this.form.material_code = row.material_code
|
||||
this.form.material_id = row.material_id
|
||||
},
|
||||
insertLine() {
|
||||
this.form.tableData.push({ workprocedure_no: '', is_check: '1' })
|
||||
},
|
||||
// 获取子节点数据
|
||||
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)
|
||||
})
|
||||
}
|
||||
},
|
||||
delLine() {
|
||||
this.form.tableData.splice(-1)
|
||||
},
|
||||
|
||||
125
mes/qd/src/views/wms/pdm/base/productRoute/UploadDialog.vue
Normal file
125
mes/qd/src/views/wms/pdm/base/productRoute/UploadDialog.vue
Normal file
@@ -0,0 +1,125 @@
|
||||
<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 crudProductRoute from '@/api/productprocessroute'
|
||||
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:传递参数
|
||||
crudProductRoute.excelImport(formdata).then((res) => {
|
||||
this.crud.notify('导入成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.$emit('tableChanged3', '')
|
||||
this.$emit('update:dialogShow', false)
|
||||
}).catch(err => {
|
||||
debugger
|
||||
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>
|
||||
|
||||
@@ -50,6 +50,16 @@
|
||||
</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>
|
||||
<el-button
|
||||
slot="right"
|
||||
:disabled="crud.selections.length !== 1"
|
||||
@@ -83,6 +93,8 @@
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="product_area" label="车间" :min-width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="class_name" label="系列名称" :min-width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="processroute_code" label="工艺路线编码" :min-width="100" show-overflow-tooltip >
|
||||
<template slot-scope="scope">
|
||||
<el-link type="warning" @click="crud.toView(scope.row)">{{ scope.row.processroute_code }}</el-link>
|
||||
@@ -90,8 +102,6 @@
|
||||
</el-table-column>
|
||||
<el-table-column prop="processroute_name" label="工艺路线名称" :min-width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="status_name" label="工艺路线状态" :min-width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="material_code" label="产品编码" :min-width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="material_name" label="名称" :min-width="200" show-overflow-tooltip />
|
||||
<el-table-column prop="create_name" label="创建人" />
|
||||
<el-table-column prop="create_time" label="创建时间" width="150" />
|
||||
<el-table-column prop="audit_optname" label="审核人" />
|
||||
@@ -111,6 +121,7 @@
|
||||
<pagination />
|
||||
</div>
|
||||
<AddDialog @AddChanged="queryTable" />
|
||||
<UploadDialog :dialog-show.sync="uploadShow" @tableChanged3="tableChanged3"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -122,10 +133,11 @@ import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import AddDialog from '@/views/wms/pdm/base/productRoute/AddDialog'
|
||||
import UploadDialog from '@/views/wms/pdm/base/productRoute/UploadDialog'
|
||||
|
||||
export default {
|
||||
name: 'Productprocessroute',
|
||||
components: { pagination, crudOperation, rrOperation, udOperation, AddDialog },
|
||||
components: {UploadDialog, pagination, crudOperation, rrOperation, udOperation, AddDialog },
|
||||
mixins: [presenter(), header(), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
@@ -142,6 +154,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
permission: {},
|
||||
uploadShow: false,
|
||||
procStatusList: [
|
||||
{ 'label': '生成', 'code': '10' },
|
||||
{ 'label': '提交', 'code': '20' }
|
||||
@@ -181,6 +194,9 @@ export default {
|
||||
this.crud.notify('提交成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
})
|
||||
},
|
||||
tableChanged3() {
|
||||
this.crud.toQuery()
|
||||
},
|
||||
unSubmit() {
|
||||
const _selectData = this.$refs.table.selection
|
||||
const data = _selectData[0]
|
||||
|
||||
@@ -59,6 +59,28 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="生产车间" prop="processroute_name">
|
||||
<el-select
|
||||
v-model="form.product_area"
|
||||
clearable
|
||||
filterable
|
||||
size="mini"
|
||||
style="width: 210px;"
|
||||
placeholder="区域类型"
|
||||
class="filter-item"
|
||||
@change="crud.toQuery()"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.product_area"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<label slot="label">备 注:</label>
|
||||
@@ -136,6 +158,7 @@ const defaultForm = {
|
||||
processroute_code: null,
|
||||
processroute_name: null,
|
||||
processroute_status: null,
|
||||
product_area: null,
|
||||
remark: null,
|
||||
tableData: []
|
||||
}
|
||||
@@ -143,7 +166,7 @@ const defaultForm = {
|
||||
export default {
|
||||
name: 'AddDialog',
|
||||
mixins: [form(defaultForm), crud()],
|
||||
dicts: ['ST_INV_TYPE_RC'],
|
||||
dicts: ['ST_INV_TYPE_RC', 'product_area'],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
|
||||
@@ -36,6 +36,23 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="生产车间">
|
||||
<el-select
|
||||
v-model="query.product_area"
|
||||
clearable
|
||||
filterable
|
||||
size="mini"
|
||||
placeholder="区域类型"
|
||||
class="filter-item"
|
||||
@change="crud.toQuery()"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.product_area"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<rrOperation/>
|
||||
</el-form>
|
||||
</div>
|
||||
@@ -111,6 +128,7 @@ import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
||||
export default {
|
||||
name: 'Processroute',
|
||||
components: { AddDialog, pagination, crudOperation, rrOperation, udOperation },
|
||||
dicts: ['product_area'],
|
||||
mixins: [presenter(), header(), form(), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
|
||||
@@ -121,17 +121,6 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="产品系列">
|
||||
<treeselect
|
||||
v-model="form.product_series"
|
||||
:options="classes3"
|
||||
:multiple="true"
|
||||
:auto-load-root-options="false"
|
||||
:load-options="loadChildNodes"
|
||||
style="width: 200px;"
|
||||
placeholder="请选择"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="生产物料规格">
|
||||
<el-input v-model="form.spec" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
|
||||
Reference in New Issue
Block a user