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.*;
|
||||
|
||||
/**
|
||||
@@ -66,25 +69,36 @@ public class MdCsCustomerbaseController {
|
||||
//("删除客户基础表")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
if (ids.length>0) {
|
||||
if (ids.length > 0) {
|
||||
icustomerbaseService.removeByIds(Arrays.asList(ids));
|
||||
}
|
||||
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() {
|
||||
List<Map> selectList = new ArrayList<>();
|
||||
List<MdCsCustomerbase> list = icustomerbaseService.list();
|
||||
if (!CollectionUtils.isEmpty(list)){
|
||||
list.forEach(cus->{
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
list.forEach(cus -> {
|
||||
Map<String, String> item = new HashMap<>();
|
||||
item.put("value",cus.getCust_code());
|
||||
item.put("label",cus.getCust_name());
|
||||
item.put("value", cus.getCust_code());
|
||||
item.put("label", cus.getCust_name());
|
||||
selectList.add(item);
|
||||
});
|
||||
}
|
||||
return new ResponseEntity<>(TableDataInfo.build(selectList),HttpStatus.OK);
|
||||
return new ResponseEntity<>(TableDataInfo.build(selectList), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,23 +49,24 @@ public class MdPbClassstandardServiceImpl extends ServiceImpl<MdPbClassstandardM
|
||||
|
||||
@Autowired
|
||||
private IMdMeMaterialbaseService materialbaseService;
|
||||
|
||||
@Override
|
||||
public List<Map> dropdownList(Map whereJson) {
|
||||
Assert.notNull(whereJson,"参数不能为空");
|
||||
Assert.notNull(whereJson, "参数不能为空");
|
||||
QueryWrapper<MdPbClassstandard> query = new QueryWrapper<MdPbClassstandard>()
|
||||
.eq("parent_class_id", "0")
|
||||
.eq("is_delete",false);
|
||||
if (whereJson.get("class_code") !=null) {
|
||||
query.eq("class_code",whereJson.get("class_code"));
|
||||
.eq("is_delete", false);
|
||||
if (whereJson.get("class_code") != null) {
|
||||
query.eq("class_code", whereJson.get("class_code"));
|
||||
}
|
||||
return getMaps(this.listMaps(query));
|
||||
return getMaps(this.listMaps(query));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map> loadClass(Map whereJson) {
|
||||
public List<Map> loadClass(Map whereJson) {
|
||||
List<Map<String, Object>> list = this.listMaps(new QueryWrapper<MdPbClassstandard>()
|
||||
.eq("is_delete", false)
|
||||
.eq("parent_class_id", whereJson.get("pid") == null ? "0":whereJson.get("pid")));
|
||||
.eq("parent_class_id", whereJson.get("pid") == null ? "0" : whereJson.get("pid")));
|
||||
List<Map> result = getMaps(list);
|
||||
return result;
|
||||
}
|
||||
@@ -72,7 +76,7 @@ public class MdPbClassstandardServiceImpl extends ServiceImpl<MdPbClassstandardM
|
||||
List<Map> result = new ArrayList<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
Map<String, Object> item = list.get(i);
|
||||
if ((int)item.get("sub_count") > 0) {
|
||||
if ((int) item.get("sub_count") > 0) {
|
||||
item.put("hasChildren", true);
|
||||
item.put("leaf", false);
|
||||
} else {
|
||||
@@ -98,15 +102,15 @@ public class MdPbClassstandardServiceImpl extends ServiceImpl<MdPbClassstandardM
|
||||
throw new BadRequestException("请输入正确的父节点编号!");
|
||||
}
|
||||
}
|
||||
QueryWrapper<MdPbClassstandard> query = new QueryWrapper<MdPbClassstandard>().eq("is_delete",false);
|
||||
QueryWrapper<MdPbClassstandard> query = new QueryWrapper<MdPbClassstandard>().eq("is_delete", false);
|
||||
if (ObjectUtil.isNotEmpty(whereJson.get("class_code"))) {
|
||||
query.in("class_code",whereJson.get("class_code"));
|
||||
query.in("class_code", whereJson.get("class_code"));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(whereJson.get("parent_class_code"))&&!whereJson.get("parent_class_code").equals("0")){
|
||||
query.eq("class_id",classstandard.getClass_id());
|
||||
if (ObjectUtil.isNotEmpty(whereJson.get("parent_class_code")) && !whereJson.get("parent_class_code").equals("0")) {
|
||||
query.eq("class_id", classstandard.getClass_id());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(whereJson.get("parent_class_code")) || whereJson.get("parent_class_code").equals("0")){
|
||||
query.eq("parent_class_id","0").or().isNull("parent_class_id");
|
||||
if (ObjectUtil.isNotEmpty(whereJson.get("parent_class_code")) || whereJson.get("parent_class_code").equals("0")) {
|
||||
query.eq("parent_class_id", "0").or().isNull("parent_class_id");
|
||||
}
|
||||
return getMaps(this.listMaps(query));
|
||||
}
|
||||
@@ -115,21 +119,29 @@ public class MdPbClassstandardServiceImpl extends ServiceImpl<MdPbClassstandardM
|
||||
@Override
|
||||
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")));
|
||||
if(null != one) {
|
||||
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")));
|
||||
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) {
|
||||
whereJson.put("class_idStr", one.getMaterial_type_id());
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(whereJson.get("whereStr"))) {
|
||||
query.last((String) whereJson.get("whereStr"));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(whereJson.get("parent_class_id"))) {
|
||||
query.eq("parent_class_id",whereJson.get("parent_class_id"));
|
||||
query.eq("parent_class_id", whereJson.get("parent_class_id"));
|
||||
}
|
||||
if(ObjectUtil.isNotEmpty(whereJson.get("class_idStr"))) {
|
||||
query.last("and class_id in (" + whereJson.get("class_idStr") + ")");
|
||||
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);
|
||||
@@ -140,7 +152,7 @@ public class MdPbClassstandardServiceImpl extends ServiceImpl<MdPbClassstandardM
|
||||
public String create(JSONObject form) {
|
||||
MdPbClassstandard one = this.getOne(new QueryWrapper<MdPbClassstandard>().eq("class_code", form.getString("class_code")));
|
||||
if (one != null) {
|
||||
throw new BadRequestException(form.getString("class_code")+"存在相同的基础类别编号");
|
||||
throw new BadRequestException(form.getString("class_code") + "存在相同的基础类别编号");
|
||||
}
|
||||
MdPbClassstandard classstandard = form.toJavaObject(MdPbClassstandard.class);
|
||||
classstandard.setClass_id(IdUtil.getStringId());
|
||||
@@ -160,16 +172,16 @@ public class MdPbClassstandardServiceImpl extends ServiceImpl<MdPbClassstandardM
|
||||
}
|
||||
|
||||
public void updateSubCnt(String class_id) {
|
||||
if (!StringUtils.isEmpty(class_id)){
|
||||
MdPbClassstandard one = this.getOne(new QueryWrapper<MdPbClassstandard>().eq("class_id", class_id).eq("is_delete",false));
|
||||
if (one == null){
|
||||
throw new BadRequestException(class_id+"没有对应分类数据");
|
||||
if (!StringUtils.isEmpty(class_id)) {
|
||||
MdPbClassstandard one = this.getOne(new QueryWrapper<MdPbClassstandard>().eq("class_id", class_id).eq("is_delete", false));
|
||||
if (one == null) {
|
||||
throw new BadRequestException(class_id + "没有对应分类数据");
|
||||
}
|
||||
int count = this.count(new QueryWrapper<MdPbClassstandard>()
|
||||
.eq("parent_class_id", class_id));
|
||||
|
||||
one.setSub_count( count);
|
||||
one.setIs_leaf(count > 0?false:true);
|
||||
one.setSub_count(count);
|
||||
one.setIs_leaf(count > 0 ? false : true);
|
||||
this.updateById(one);
|
||||
}
|
||||
}
|
||||
@@ -192,10 +204,10 @@ public class MdPbClassstandardServiceImpl extends ServiceImpl<MdPbClassstandardM
|
||||
}
|
||||
|
||||
private void checkParam(JSONObject form) {
|
||||
Assert.notNull(form,"参数不能为空");
|
||||
Assert.notNull(form, "参数不能为空");
|
||||
MdPbClassstandard onebyid = this.getOne(new QueryWrapper<MdPbClassstandard>().eq("class_id", form.getString("class_id")));
|
||||
if (onebyid == null) {
|
||||
throw new BadRequestException(form.getString("class_id")+"被删除或无权限,操作失败!");
|
||||
throw new BadRequestException(form.getString("class_id") + "被删除或无权限,操作失败!");
|
||||
}
|
||||
if (form.getString("parent_class_id") != null && form.getString("class_id").equals(form.getString("parent_class_id"))) {
|
||||
throw new BadRequestException("上级不能为自己");
|
||||
@@ -205,7 +217,7 @@ public class MdPbClassstandardServiceImpl extends ServiceImpl<MdPbClassstandardM
|
||||
@Override
|
||||
public void deleteAll(String[] ids) {
|
||||
final String TOP_PARENT_ID = "0";
|
||||
if (ids == null || ids.length==0){
|
||||
if (ids == null || ids.length == 0) {
|
||||
return;
|
||||
}
|
||||
List<MdPbClassstandardTree> list = CopyUtil.copyList(this.list(), MdPbClassstandardTree.class);
|
||||
@@ -215,31 +227,31 @@ public class MdPbClassstandardServiceImpl extends ServiceImpl<MdPbClassstandardM
|
||||
for (String id : ids) {
|
||||
removeCollect.add(id);
|
||||
List<MdPbClassstandardTree> top_parent = collect.remove(id);
|
||||
if (!CollectionUtils.isEmpty(top_parent)){
|
||||
if (!CollectionUtils.isEmpty(top_parent)) {
|
||||
this.getChildTree(top_parent, collect, removeCollect);
|
||||
}
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(removeCollect)){
|
||||
if (!CollectionUtils.isEmpty(removeCollect)) {
|
||||
this.update(new UpdateWrapper<MdPbClassstandard>()
|
||||
.set("is_delete",true)
|
||||
.set("update_id",SecurityUtils.getCurrentUserId())
|
||||
.set("update_name",SecurityUtils.getCurrentNickName()).set("update_time",DateUtil.now()).in("class_id",removeCollect));
|
||||
.set("is_delete", true)
|
||||
.set("update_id", SecurityUtils.getCurrentUserId())
|
||||
.set("update_name", SecurityUtils.getCurrentNickName()).set("update_time", DateUtil.now()).in("class_id", removeCollect));
|
||||
}
|
||||
}
|
||||
|
||||
private List<MdPbClassstandardTree> getChildTree(List<MdPbClassstandardTree> top_parent, Map<String, List<MdPbClassstandardTree>> collect,Set<String> removeCollect){
|
||||
private List<MdPbClassstandardTree> getChildTree(List<MdPbClassstandardTree> top_parent, Map<String, List<MdPbClassstandardTree>> collect, Set<String> removeCollect) {
|
||||
removeCollect.addAll(top_parent.stream().map(MdPbClassstandardTree::getClass_id).collect(Collectors.toList()));
|
||||
|
||||
if (CollectionUtils.isEmpty(collect)){
|
||||
if (CollectionUtils.isEmpty(collect)) {
|
||||
return top_parent;
|
||||
}
|
||||
for (MdPbClassstandardTree parent : top_parent) {
|
||||
List<MdPbClassstandardTree> child = collect.remove(parent.getClass_id());
|
||||
if (CollectionUtils.isEmpty(child)){
|
||||
if (CollectionUtils.isEmpty(child)) {
|
||||
continue;
|
||||
}
|
||||
List<MdPbClassstandardTree> childMenuTree = getChildTree(child, collect,removeCollect);
|
||||
if (!CollectionUtils.isEmpty(childMenuTree)){
|
||||
List<MdPbClassstandardTree> childMenuTree = getChildTree(child, collect, removeCollect);
|
||||
if (!CollectionUtils.isEmpty(childMenuTree)) {
|
||||
parent.setItemClassstrandard(childMenuTree);
|
||||
}
|
||||
}
|
||||
@@ -249,7 +261,7 @@ public class MdPbClassstandardServiceImpl extends ServiceImpl<MdPbClassstandardM
|
||||
|
||||
@Override
|
||||
public List<String> getChildIdStr(String class_id) {
|
||||
if (StringUtils.isEmpty(class_id)){
|
||||
if (StringUtils.isEmpty(class_id)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return this.baseMapper.getChildIdStr(class_id);
|
||||
@@ -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>
|
||||
@@ -35,7 +48,7 @@ public class MdCsCustomerbaseServiceImpl extends ServiceImpl<MdCsCustomerbaseMap
|
||||
|
||||
@Override
|
||||
public void create(JSONObject dto) {
|
||||
Assert.notNull(dto,"请求参数不能为空");
|
||||
Assert.notNull(dto, "请求参数不能为空");
|
||||
String cust_code = dto.getString("cust_code");
|
||||
MdCsCustomerbase custCode = this.getOne(new QueryWrapper<MdCsCustomerbase>().eq("cust_code", cust_code));
|
||||
if (custCode != null) {
|
||||
@@ -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 lombok.RequiredArgsConstructor;
|
||||
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,25 +12,28 @@ 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;
|
||||
|
||||
/**
|
||||
* @author zhouz
|
||||
* @date 2022-03-22
|
||||
**/
|
||||
* @author zhouz
|
||||
* @date 2022-03-22
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "产品工艺路线管理")
|
||||
@@ -41,26 +42,26 @@ import java.util.Map;
|
||||
public class ProductprocessrouteController {
|
||||
|
||||
@Autowired
|
||||
private IPdmBiProductprocessrouteService ipdmBiProductprocessrouteService;
|
||||
private IPdmBiProductprocessrouteService ipdmBiProductprocessrouteService;
|
||||
@Autowired
|
||||
private IPdmBiProductprocessroutedtlService iPdmBiProductprocessroutedtlService;
|
||||
private IPdmBiProductprocessroutedtlService iPdmBiProductprocessroutedtlService;
|
||||
@Autowired
|
||||
private IPdmBiProcessrouteService pdmBiProcessrouteService;
|
||||
|
||||
@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);
|
||||
TableDataInfo build = TableDataInfo.build(list);
|
||||
build.setTotalElements(page.getTotal());
|
||||
return new ResponseEntity<>(build,HttpStatus.OK);
|
||||
return new ResponseEntity<>(build, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增产品工艺路线")
|
||||
//("新增产品工艺路线")
|
||||
@ApiOperation("新增产品工艺路线")
|
||||
public ResponseEntity<Object> create(@RequestBody Map whereJson){
|
||||
ipdmBiProductprocessrouteService.create(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
@@ -70,7 +71,7 @@ public class ProductprocessrouteController {
|
||||
@Log("修改产品工艺路线")
|
||||
//("修改产品工艺路线")
|
||||
//@PreAuthorize("@el.check('productprocessroute:edit')")
|
||||
public ResponseEntity<Object> update(@RequestBody Map whereJson){
|
||||
public ResponseEntity<Object> update(@RequestBody Map whereJson) {
|
||||
ipdmBiProductprocessrouteService.update(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@@ -90,16 +91,15 @@ 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));
|
||||
return new ResponseEntity<>(list,HttpStatus.OK);
|
||||
List<PdmBiProcessroute> list = pdmBiProcessrouteService.list(new QueryWrapper<PdmBiProcessroute>().eq("is_delete", "0").eq("processroute_status", 20));
|
||||
return new ResponseEntity<>(list, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getRouteDtl")
|
||||
@Log("获取工艺路线明细")
|
||||
//("获取工艺路线明细")
|
||||
public ResponseEntity<Object> getRouteDtl(@RequestBody Map whereJson) {
|
||||
return new ResponseEntity<>(ipdmBiProductprocessrouteService.getRouteDtl(whereJson),HttpStatus.OK);
|
||||
return new ResponseEntity<>(ipdmBiProductprocessrouteService.getRouteDtl(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getProductRouteDtl")
|
||||
@@ -107,9 +107,8 @@ 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")));
|
||||
return new ResponseEntity<>(list,HttpStatus.OK);
|
||||
List<PdmBiProductprocessroutedtl> list = iPdmBiProductprocessroutedtlService.list(new QueryWrapper<PdmBiProductprocessroutedtl>().eq("productprocess_id", jo.getString("productprocess_id")));
|
||||
return new ResponseEntity<>(list, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("提交")
|
||||
@@ -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;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -62,8 +62,10 @@ public class PdmBiProcessrouteServiceImpl extends ServiceImpl<PdmBiProcessrouteM
|
||||
processroutedtl.setWorkprocedure_id(jsonObject.getString("workprocedure_id"));
|
||||
processroutedtl.setWorkprocedure_no(i + 1);
|
||||
if (i == 0) {
|
||||
processroutedtl.setPreworkprocedure_id(" ");
|
||||
processroutedtl.setNextworkprocedure_id(jsonDataArr.getJSONObject(i + 1).getString("workprocedure_id"));
|
||||
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'));
|
||||
if (one!=null) {
|
||||
throw new BadRequestException("该产品已经存在工艺路线!");
|
||||
PdmBiProductprocessroute one = this.getOne(new QueryWrapper<PdmBiProductprocessroute>().eq("class_id", jo.getString("class_id")).eq("is_delete", '0'));
|
||||
if (one != null) {
|
||||
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));
|
||||
if (one !=null) {
|
||||
throw new BadRequestException("该产品已经存在工艺路线!");
|
||||
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("该系列已经存在工艺路线!");
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user