Browse Source

opt:基础分类表相关代码替换

master
zds 1 month ago
parent
commit
7586f3645a
  1. 11
      lms/nladmin-system/src/main/java/org/nl/b_lms/storage_manage/ios/service/iostorInv/impl/StIvtIostorinvOutServiceImpl.java
  2. 2
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/sales/service/SalesService.java
  3. 134
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/service/ClassstandardService.java
  4. 61
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/service/dto/ClassstandardDto.java
  5. 600
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/service/impl/ClassstandardServiceImpl.java
  6. 81
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/wql/QMD_PB_CLASSBASE.wql
  7. 59
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/wql/QMD_PB_INTERFACEBACK.wql
  8. 83
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/wql/QMD_PB_STORAGEVEHICLEINFO.wql
  9. 82
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/rest/StructrelamaterialController.java
  10. 7
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/sectattr/service/impl/SectattrServiceImpl.java
  11. 75
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/StructrelamaterialService.java
  12. 34
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/dto/StructrelamaterialDto.java
  13. 2
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/impl/StructivtServiceImpl.java
  14. 175
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/impl/StructrelamaterialServiceImpl.java
  15. 10
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/structattr/service/impl/StructattrServiceImpl.java
  16. 78
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/QST_IVT_MATERIALSET.wql
  17. 17
      lms/nladmin-system/src/main/java/org/nl/wms/sch/service/impl/TaskServiceImpl.java

11
lms/nladmin-system/src/main/java/org/nl/b_lms/storage_manage/ios/service/iostorInv/impl/StIvtIostorinvOutServiceImpl.java

@ -39,6 +39,8 @@ import org.nl.system.service.param.ISysParamService;
import org.nl.wms.basedata.master.storagevehicleinfo.service.dao.Storagevehicleex;
import org.nl.wms.basedata.master.storagevehicleinfo.service.dao.mapper.StoragevehicleexMapper;
import org.nl.wms.basedata.st.storattr.service.StorattrService;
import org.nl.wms.basedata.st.storattr.service.dao.Storattr;
import org.nl.wms.basedata.st.storattr.service.dao.mapper.StorattrMapper;
import org.nl.wms.basedata.st.storattr.service.dto.StorattrDto;
import org.nl.wms.pda.mps.eum.RegionTypeEnum;
import org.nl.wms.sch.manage.TaskStatusEnum;
@ -64,6 +66,8 @@ import java.util.stream.Collectors;
@Service
public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutMapper, StIvtIostorinv> implements IStIvtIostorinvOutService {
@Autowired
private StorattrMapper storattrMapper;
/**
* 仓库服务
*/
@ -1052,9 +1056,6 @@ public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutM
* @param mstDao 出库单据对象
*/
private void createOutIos(List<StIvtIostorinvdis> disDaoList, StIvtIostorinv mstDao) {
// 仓库表
WQLObject attrTab = WQLObject.getWQLObject("st_ivt_bsrealstorattr");
// 子卷包装表
WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
@ -1065,7 +1066,7 @@ public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutM
* 准备数据
*/
// 查询移入仓库
JSONObject jsonAttr = attrTab.query("stor_id = '" + mstDao.getOut_stor_id().toString() + "'").uniqueResult(0);
Storattr jsonAttr = storattrMapper.selectById(mstDao.getOut_stor_id());
if (ObjectUtil.isEmpty(jsonAttr)) {
throw new BadRequestException("未查询到对应的移入仓库信息!");
@ -1082,7 +1083,7 @@ public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutM
.map(row -> BigDecimal.valueOf(row.getPlan_qty().doubleValue()))
.reduce(BigDecimal.ZERO, BigDecimal::add);
paramMap.put("stor_id",jsonAttr.getString("stor_id"));
paramMap.put("stor_id",jsonAttr.getStor_id());
paramMap.put("bill_status",IOSEnum.BILL_STATUS.code("分配中"));
paramMap.put("total_qty",total_qty);
paramMap.put("detail_count",disDaoList.size());

2
lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/sales/service/SalesService.java

@ -1,4 +1,4 @@
package org.nl.wms.basedata.master.sales.service;//package org.nl.wms.basedata.master.service;
package org.nl.wms.basedata.master.sales.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;

134
lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/service/ClassstandardService.java

@ -1,134 +0,0 @@
package org.nl.wms.basedata.master.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.nl.wms.basedata.master.service.dto.ClassstandardDto;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @author zhouz
* @description 服务接口
* @date 2021-12-07
**/
public interface ClassstandardService {
/**
* 查询数据分页
*
* @param whereJson 条件
* @param page 分页参数
* @return Map<String, Object>
*/
Map<String, Object> queryAll(Map whereJson, Pageable page);
/**
* 查询所有数据不分页
*
* @param whereJson 条件参数
* @return List<ClassstandardDto>
*/
List<ClassstandardDto> queryAll(Map whereJson);
/**
* 根据ID查询
*
* @param class_id ID
* @return Classstandard
*/
ClassstandardDto findById(String class_id);
/**
* 根据编码查询
*
* @param code code
* @return Classstandard
*/
ClassstandardDto findByCode(String code);
/**
* 创建
*
* @param dto /
*/
void create(ClassstandardDto dto);
/**
* 编辑
*
* @param dto /
*/
void update(ClassstandardDto dto);
/**
* 多选删除
*
* @param ids /
*/
void deleteAll(Long[] ids);
JSONObject loadClass(Map whereJson);
JSONArray getSuperior(JSONObject jo, JSONArray ja);
JSONObject buildTree(JSONArray ja);
@SuppressWarnings("unchecked")
JSONObject queryClassBycode(Map whereJson);
JSONObject queryClassById(Map whereJson);
JSONObject queryClassTable(Map whereJson, Pageable page);
/**
* @param type_id 类型标识
* @param level 级别
* @return
*/
JSONObject getType(String type_id, int level);
/**
* 获取当前节点的所有子类节点集合数据
*
* @param class_id
* @return
*/
Set<String> getChildIdSet(String class_id);
/**
* 获取查询条件的所有子节点集合
*
* @param class_idStr
* @return
*/
Set<String> getAllChildIdSet(String class_idStr);
/**
* 获取当前节点的所有子类节点集合串,用于拼接SQLin
*
* @param class_id
* @return
*/
String getChildIdStr(String class_id);
/**
* 获取所有节点的子节点的ID串
*
* @param class_idStr
* @return
*/
String getAllChildIdStr(String class_idStr);
/**
* 获取分类名称下拉框
*
* @return
*/
JSONArray getClassName();
JSONObject getCasClass(JSONObject jo);
}

61
lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/service/dto/ClassstandardDto.java

@ -1,61 +0,0 @@
package org.nl.wms.basedata.master.service.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author zhouz
* @description /
* @date 2021-12-07
**/
@Data
public class ClassstandardDto implements Serializable {
/**
* 防止精度丢失
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long class_id;
private String path_code;
private String class_code;
private String long_class_code;
private String class_name;
private String class_desc;
private Long parent_class_id;
private String is_leaf;
private BigDecimal sub_count;
private String is_modify;
private String is_delete;
private String class_level;
private String ext_id;
private String ext_parent_id;
private String create_id;
private String create_name;
private String create_time;
private String update_optid;
private String update_optname;
private String update_time;
}

600
lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/service/impl/ClassstandardServiceImpl.java

@ -1,600 +0,0 @@
package org.nl.wms.basedata.master.service.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.db.Db;
import cn.hutool.db.Entity;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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.ResultBean;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.modules.wql.util.WqlUtil;
import org.nl.wms.basedata.master.service.ClassstandardService;
import org.nl.wms.basedata.master.service.dto.ClassstandardDto;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.sql.DataSource;
import java.math.BigDecimal;
import java.sql.SQLException;
import java.util.*;
/**
* @author zhouz
* @description 服务实现
* @date 2021-12-07
**/
@Service
@RequiredArgsConstructor
@Slf4j
public class ClassstandardServiceImpl implements ClassstandardService {
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
String class_code = (String) whereJson.get("class_code");
String where = "";
if (!StrUtil.isEmpty(class_code)) {
where = "AND class_code = '" + class_code + "'";
}
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "(parent_class_id is null OR parent_class_id = '0') AND is_delete = '0'" + where + "", "update_time desc");
final JSONObject json = rb.pageResult();
JSONArray ja = json.getJSONArray("content");
JSONArray new_ja = new JSONArray();
for (int i = 0; i < ja.size(); i++) {
JSONObject mater_jo = ja.getJSONObject(i);
if (mater_jo.getInteger("sub_count") > 0) {
mater_jo.put("hasChildren", true);
mater_jo.put("leaf", false);
} else {
mater_jo.put("hasChildren", false);
mater_jo.put("leaf", true);
}
mater_jo.put("id", mater_jo.getString("class_id"));
mater_jo.put("label", mater_jo.getString("class_name"));
new_ja.add(mater_jo);
}
json.put("content", new_ja);
return json;
}
@Override
public List<ClassstandardDto> queryAll(Map whereJson) {
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
JSONArray arr = wo.query().getResultJSONArray(0);
List<ClassstandardDto> list = arr.toJavaList(ClassstandardDto.class);
return list;
}
@Override
public ClassstandardDto findById(String class_id) {
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
JSONObject json = wo.query("class_id = '" + class_id + "'").uniqueResult(0);
final ClassstandardDto obj = json.toJavaObject(ClassstandardDto.class);
return obj;
}
@Override
public ClassstandardDto findByCode(String code) {
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
JSONObject json = wo.query("class_code ='" + code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(json)) {
return null;
}
final ClassstandardDto obj = json.toJavaObject(ClassstandardDto.class);
return obj;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(ClassstandardDto dto) {
String class_code = dto.getClass_code();
ClassstandardDto classstandardDto = this.findByCode(class_code);
if (classstandardDto != null && "0".equals(classstandardDto.getIs_delete())) {
throw new BadRequestException("存在相同的基础类别编号");
}
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
dto.setClass_id(IdUtil.getSnowflake(1, 1).nextId());
dto.setCreate_id(currentUserId);
dto.setCreate_name(nickName);
dto.setUpdate_optid(currentUserId);
dto.setUpdate_optname(nickName);
dto.setUpdate_time(now);
dto.setCreate_time(now);
dto.setIs_leaf("1");
dto.setClass_level(Math.ceil(dto.getClass_code().length() / 2.0) + "");
dto.setSub_count(new BigDecimal(0));
dto.setPath_code(dto.getClass_code());
dto.setLong_class_code(dto.getClass_code());
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
wo.insert(json);
///更新节点
if (dto.getParent_class_id() != null) {
updateSubCnt(dto.getParent_class_id());
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(ClassstandardDto dto) {
ClassstandardDto entity = this.findById(dto.getClass_id() + "");
if (entity == null) {
throw new BadRequestException("被删除或无权限,操作失败!");
}
String class_code = dto.getClass_code();
ClassstandardDto classstandardDto = this.findByCode(class_code);
if (classstandardDto != null && !dto.getClass_id().equals(classstandardDto.getClass_id()) && "0".equals(classstandardDto.getIs_delete())) {
throw new BadRequestException("存在相同的供应商编号");
}
Long oldPid = findById(dto.getClass_id() + "").getParent_class_id();
Long newPid = dto.getParent_class_id();
if (dto.getParent_class_id() != null && dto.getClass_id().equals(dto.getParent_class_id())) {
throw new BadRequestException("上级不能为自己");
}
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
dto.setUpdate_time(now);
dto.setUpdate_optid(currentUserId);
dto.setUpdate_optname(nickName);
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
wo.update(json);
//更新父节点中子节点数目
updateSubCnt(oldPid);
updateSubCnt(newPid);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteAll(Long[] ids) {
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
for (Long class_id : ids) {
JSONObject param = new JSONObject();
param.put("class_id", String.valueOf(class_id));
ClassstandardDto classstandardDto = findById(class_id + "");
param.put("is_delete", "1");
param.put("update_optid", currentUserId);
param.put("update_optname", nickName);
param.put("update_time", now);
wo.update(param);
JSONArray child_rows = wo.query("parent_class_id = '" + String.valueOf(class_id) + "'").getResultJSONArray(0);
if (child_rows.size() > 0) {
Long[] child_ids = new Long[child_rows.size()];
for (int i = 0; i < child_rows.size(); i++) {
JSONObject child_row = child_rows.getJSONObject(i);
Long id = child_row.getLong
("class_id");
child_ids[i] = id;
}
this.deleteAll(child_ids);
}
updateSubCnt(classstandardDto.getParent_class_id());
}
}
@Override
public JSONObject loadClass(Map whereJson) {
JSONObject jo = new JSONObject();
JSONArray ja = new JSONArray();
String pid = (String) whereJson.get("pid");
String base_data_type = (String) whereJson.get("base_data_type");
String where = "";
if (!StrUtil.isEmpty(base_data_type)) {
where = "AND base_data_type = '" + base_data_type + "'";
}
if (pid == null || "0".equals(pid)) {
ja = WQLObject.getWQLObject("MD_PB_ClassStandard").query("(parent_class_id = '0' OR parent_class_id is null) and is_delete = '0' " + where + " order by class_id").getResultJSONArray(0);
} else {
ja = WQLObject.getWQLObject("MD_PB_ClassStandard").query("parent_class_id = '" + pid + "' AND is_delete = '0'" + where + " order by class_id").getResultJSONArray(0);
}
for (int i = 0; i < ja.size(); i++) {
JSONObject mater_jo = ja.getJSONObject(i);
if (mater_jo.getInteger("sub_count") > 0) {
mater_jo.put("hasChildren", true);
mater_jo.put("leaf", false);
} else {
mater_jo.put("hasChildren", false);
mater_jo.put("leaf", true);
}
mater_jo.put("id", mater_jo.get("class_id"));
mater_jo.put("label", mater_jo.getString("class_name"));
mater_jo.put("create_user_name", mater_jo.getString("create_name"));
mater_jo.put("update_user_name", mater_jo.getString("update_optname"));
}
jo.put("content", ja);
return jo;
}
@Override
public JSONArray getSuperior(JSONObject jo, JSONArray ja) {
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
if (StrUtil.isEmpty(jo.getString("parent_class_id")) || "0".equals(jo.getString("parent_class_id"))) {
JSONArray null_pids = new JSONArray();
null_pids = wo.query("(parent_class_id = '0' OR parent_class_id is null) and is_delete = '0'").getResultJSONArray(0);
for (int m = 0; m < null_pids.size(); m++) {
JSONObject null_pid = null_pids.getJSONObject(m);
ja.add(null_pid);
}
return ja;
}
JSONArray pid_rows = wo.query("parent_class_id = '" + jo.getString("parent_class_id") + "'").getResultJSONArray(0);
for (int n = 0; n < pid_rows.size(); n++) {
JSONObject pid_row = pid_rows.getJSONObject(n);
ja.add(pid_row);
}
JSONObject id_row = wo.query("class_id = '" + jo.getString("parent_class_id") + "'").uniqueResult(0);
return getSuperior(id_row, ja);
}
@Override
public JSONObject buildTree(JSONArray ja) {
Set<JSONObject> trees = new LinkedHashSet<>();
Set<JSONObject> maters = new LinkedHashSet<>();
List<String> mater_name = new LinkedList<>();
for (int i = 0; i < ja.size(); i++) {
JSONObject jo = ja.getJSONObject(i);
mater_name.add(jo.getString("class_name"));
}
boolean isChild;
for (int m = 0; m < ja.size(); m++) {
JSONObject jo1 = ja.getJSONObject(m);
isChild = false;
if ("0".equals(jo1.getString("parent_class_id")) || StrUtil.isEmpty(jo1.getString("parent_class_id"))) {
jo1.put("id", jo1.getString("class_id"));
jo1.put("label", jo1.getString("class_name"));
if (jo1.getInteger("sub_count") > 0) {
jo1.put("hasChildren", true);
jo1.put("leaf", false);
} else {
jo1.put("hasChildren", false);
jo1.put("leaf", true);
}
trees.add(jo1);
}
for (int n = 0; n < ja.size(); n++) {
JSONObject jo2 = ja.getJSONObject(n);
if (!"0".equals(jo2.getString("class_id")) && jo1.getString("class_id").equals(jo2.getString("parent_class_id"))) {
isChild = true;
if (jo1.getJSONArray("children") == null) {
jo1.put("children", new JSONArray());
}
JSONArray child_ja = jo1.getJSONArray("children");
jo2.put("id", jo2.getString("class_id"));
jo2.put("label", jo2.getString("class_name"));
if (jo2.getInteger("sub_count") > 0) {
jo2.put("hasChildren", true);
jo2.put("leaf", false);
} else {
jo2.put("hasChildren", false);
jo2.put("leaf", true);
}
child_ja.add(jo2);
}
}
if (isChild) {
jo1.put("id", jo1.getString("class_id"));
jo1.put("label", jo1.getString("class_name"));
if (jo1.getInteger("sub_count") > 0) {
jo1.put("hasChildren", true);
jo1.put("leaf", false);
} else {
jo1.put("hasChildren", false);
jo1.put("leaf", true);
}
maters.add(jo1);
} else if (!"0".equals(jo1.getString("class_id")) && !mater_name.contains(jo1.getString("material_type_name"))) {
jo1.put("id", jo1.getString("class_id"));
jo1.put("label", jo1.getString("class_name"));
if (jo1.getInteger("sub_count") > 0) {
jo1.put("hasChildren", true);
jo1.put("leaf", false);
} else {
jo1.put("hasChildren", false);
jo1.put("leaf", true);
}
maters.add(jo1);
}
}
if (maters.size() == 0) {
maters = trees;
}
JSONObject jo = new JSONObject();
jo.put("totalElements", ja.size());
jo.put("content", maters.size() == 0 ? ja : trees);
return jo;
}
@Override
public JSONObject queryClassBycode(Map whereJson) {
String parent_class_code = (String) whereJson.get("parent_class_code");
String class_code = (String) whereJson.get("class_code");
JSONObject jo = new JSONObject();
JSONArray ja = new JSONArray();
String where = "";
ClassstandardDto classstandardDto = null;
if (!StrUtil.isEmpty(parent_class_code)) {
classstandardDto = this.findByCode(parent_class_code);
if (classstandardDto == null) {
throw new BadRequestException("请输入正确的父节点编号!");
}
}
if (!StrUtil.isEmpty(class_code)) {
where = " AND class_code IN ('" + class_code + "')";
}
//parent_class_code不为空,查出 id等于classstandardDto.getClass_id()
if (StrUtil.isNotEmpty(parent_class_code)) {
ja = WQLObject.getWQLObject("MD_PB_ClassStandard").query("class_id = '" + classstandardDto.getClass_id() + "' order by class_id").getResultJSONArray(0);
} else if (StrUtil.isNotEmpty(where)) {
ja = WQLObject.getWQLObject("MD_PB_ClassStandard").query("1=1 " + where + " order by class_id").getResultJSONArray(0);
} else if (StrUtil.isEmpty(parent_class_code) || "0".equals(parent_class_code)) {
ja = WQLObject.getWQLObject("MD_PB_ClassStandard").query("(parent_class_id = '0' OR parent_class_id is null) and is_delete = '0' order by class_id").getResultJSONArray(0);
}
for (int i = 0; i < ja.size(); i++) {
JSONObject mater_jo = ja.getJSONObject(i);
if (mater_jo.getInteger("sub_count") > 0) {
mater_jo.put("hasChildren", true);
mater_jo.put("leaf", false);
} else {
mater_jo.put("hasChildren", false);
mater_jo.put("leaf", true);
}
mater_jo.put("id", mater_jo.getString("class_id"));
mater_jo.put("label", mater_jo.getString("class_name"));
mater_jo.put("create_user_name", mater_jo.getString("create_name"));
mater_jo.put("update_user_name", mater_jo.getString("update_optname"));
}
jo.put("content", ja);
return jo;
}
@Override
public JSONObject queryClassById(Map whereJson) {
String parent_class_id = (String) whereJson.get("parent_class_id");
/*where条件*/
String class_idStr = (String) whereJson.get("class_idStr");
String whereStr = (String) whereJson.get("whereStr");
JSONObject jo = new JSONObject();
JSONArray ja = new JSONArray();
String where = "1=1";
if (!StrUtil.isEmpty(whereStr)) {
where += whereStr;
}
if (StrUtil.isNotEmpty(class_idStr)) {
where += " AND class_id IN " + class_idStr;
//"('1','2','3')"
}
if (!StrUtil.isEmpty(parent_class_id)) {
where += " AND parent_class_id = " + parent_class_id;
}
ja = WQLObject.getWQLObject("MD_PB_ClassStandard").query(where + " order by class_id").getResultJSONArray(0);
for (int i = 0; i < ja.size(); i++) {
JSONObject mater_jo = ja.getJSONObject(i);
if (mater_jo.getInteger("sub_count") > 0) {
mater_jo.put("hasChildren", true);
mater_jo.put("leaf", false);
} else {
mater_jo.put("hasChildren", false);
mater_jo.put("leaf", true);
}
mater_jo.put("id", mater_jo.getString("class_id"));
mater_jo.put("label", mater_jo.getString("class_name"));
mater_jo.put("create_user_name", mater_jo.getString("create_name"));
mater_jo.put("update_user_name", mater_jo.getString("update_optname"));
}
jo.put("content", ja);
return jo;
}
@Override
public JSONObject queryClassTable(Map whereJson, Pageable page) {
HashMap<String, String> map = new HashMap<>();
map.put("flag", "1");
String material_type_id = (String) whereJson.get("material_type_id");
String class_idStr = (String) whereJson.get("class_idStr");
//处理物料当前节点的所有子节点
if (!StrUtil.isEmpty(material_type_id)) {
map.put("material_type_id", material_type_id);
String classIds = this.getChildIdStr(material_type_id);
map.put("classIds", classIds);
} else if (ObjectUtil.isNotEmpty(class_idStr)) {
String classIds = this.getAllChildIdStr(class_idStr);
map.put("classIds", classIds);
}
JSONObject jo = WQL.getWO("QMD_PB_CLASSBASE").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "update_time desc");
JSONArray content = jo.getJSONArray("content");
JSONArray jsonArr = new JSONArray();
for (int i = 0; i < content.size(); i++) {
JSONObject json = content.getJSONObject(i);
JSONObject jsonParent = WQLObject.getWQLObject("md_pb_classstandard").query("class_id = '" + json.getString("parent_class_id") + "'").uniqueResult(0);
json.put("address", jsonParent.getString("class_name"));
jsonArr.add(json);
}
jo.put("content", jsonArr);
return jo;
}
@Override
public JSONObject getType(String type_id, int level) {
WQLObject classTab = WQLObject.getWQLObject("md_pb_classstandard");
JSONObject json = classTab.query("class_id= " + type_id + "").uniqueResult(0);
if (ObjectUtil.isEmpty(json)) {
return null;
}
String class_code = json.getString("class_code");
if (class_code.length() / 2 == level) {
return json;
} else {
return getType(json.getString("parent_class_id"), level);
}
}
@Override
public Set<String> getChildIdSet(String class_id) {
String sql = "select DISTINCT class_id from (\n" +
" select t1.class_id,\n" +
" if(find_in_set(parent_class_id, @pids) > 0, @pids := concat(@pids, ',', class_id), 0) as ischild\n" +
" from (\n" +
" select class_id,parent_class_id from md_pb_classstandard t where t.is_delete = '0' order by class_code\n" +
" ) t1,\n" +
" (select @pids := '" + class_id + "') t2\n" +
" ) t3 where ischild != 0";
Set<String> set = new HashSet<>();
//添加本级
set.add(class_id);
//添加子节点
try {
List<Entity> list = Db.use((DataSource) SpringContextHolder.getBean("dataSource")).query(sql);
list.forEach(item -> {
set.add(item.getStr("class_id"));
});
} catch (SQLException e) {
e.printStackTrace();
}
return set;
}
@Override
public Set<String> getAllChildIdSet(String class_idStr) {
JSONArray arr = WQLObject.getWQLObject("md_pb_classstandard").query("class_id IN " + class_idStr).getResultJSONArray(0);
Set<String> set = new HashSet<>();
for (int i = 0; i < arr.size(); i++) {
set.addAll(this.getChildIdSet(arr.getJSONObject(i).getString("class_id")));
}
return set;
}
@Override
public String getChildIdStr(String class_id) {
Set<String> set = this.getChildIdSet(class_id);
StringBuilder sb = new StringBuilder();
set.forEach(item -> {
sb.append(",'" + item + "'");
});
String str = sb.toString();
if (StrUtil.isNotEmpty(str)) {
str = "(" + str.substring(1) + ")";
}
return str;
}
@Override
public String getAllChildIdStr(String class_idStr) {
Set<String> set = this.getAllChildIdSet(class_idStr);
StringBuilder sb = new StringBuilder();
set.forEach(item -> {
sb.append(",'" + item + "'");
});
String str = sb.toString();
if (StrUtil.isNotEmpty(str)) {
str = "(" + str.substring(1) + ")";
}
return str;
}
@Override
public JSONObject getCasClass(JSONObject whereJson) {
/*
* 获取人员对应仓库下拉框公共方法 多级下拉框
*/
JSONArray new_ja = new JSONArray();
HashMap<String, String> stor_map = new HashMap<>();
stor_map.put("flag", "2");
stor_map.put("class_code", whereJson.getString("class_code"));
JSONArray class_ja = WQL.getWO("QMD_PB_CLASSBASE").addParamMap(stor_map).process().getResultJSONArray(0);
for (int i = 0; i < class_ja.size(); i++) {
JSONObject class_jo = class_ja.getJSONObject(i);
JSONObject class_cas = new JSONObject();
class_cas.put("value", class_jo.getString("class_code"));
class_cas.put("label", class_jo.getString("class_name"));
HashMap<String, String> map = new HashMap<>();
map.put("flag", "2");
map.put("class_code", class_jo.getString("class_code"));
JSONArray ja = WQL.getWO("QMD_PB_CLASSBASE").addParamMap(map).process().getResultJSONArray(0);
if (ja.size() > 0) {
JSONArray sect_ja = new JSONArray();
for (int j = 0; j < ja.size(); j++) {
JSONObject sect_jo = ja.getJSONObject(j);
JSONObject sect_cas = new JSONObject();
sect_cas.put("value", sect_jo.getString("class_code"));
sect_cas.put("label", sect_jo.getString("class_name"));
sect_ja.add(sect_cas);
}
class_cas.put("children", sect_ja);
}
new_ja.add(class_cas);
}
JSONObject jo = new JSONObject();
jo.put("content", new_ja);
return jo;
}
@Override
public JSONArray getClassName() {
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
// 获取的是父节点
JSONArray result = wo.query("(parent_class_id is null OR parent_class_id = '0') AND is_delete = '0'").getResultJSONArray(0);
JSONArray res = new JSONArray();
for (int i = 0; i < result.size(); i++) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("label", result.getJSONObject(i).get("class_name"));
jsonObject.put("value", result.getJSONObject(i).get("class_code"));
res.add(jsonObject);
}
return res;
}
public void updateSubCnt(Long Id) {
if (Id != null && Id != 0) {
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
int count = wo.query("parent_class_id = '" + Id + "' AND is_delete = '0'").getResultJSONArray(0).size();
JSONObject pid = wo.query("class_id = '" + Id + "'").uniqueResult(0);
pid.put("sub_count", count);
if (count > 0) {
pid.put("is_leaf", "0");
} else {
pid.put("is_leaf", "1");
}
wo.update(pid);
}
}
}

81
lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/wql/QMD_PB_CLASSBASE.wql

@ -1,81 +0,0 @@
[交易说明]
交易名: 基础点位分页查询
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.search TYPEAS s_string
输入.class_code TYPEAS class_code
输入.classIds TYPEAS f_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
PAGEQUERY
SELECT
*
FROM
md_pb_classstandard class
LEFT JOIN ST_IVT_StructRelaMaterial sr ON sr.material_type_id = class.class_id
WHERE
is_leaf = '1'
AND
base_data_type = '03'
AND
sr.sect_id IS NULL
AND
is_delete = '0'
OPTION 输入.classIds <> ""
class.class_id in 输入.classIds
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF
IF 输入.flag = "2"
QUERY
SELECT
class2.*
FROM
md_pb_classstandard class
left join
md_pb_classstandard class2 ON class.class_id = class2.parent_class_id
where
class.class_code = 输入.class_code
ENDSELECT
ENDQUERY
ENDIF

59
lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/wql/QMD_PB_INTERFACEBACK.wql

@ -1,59 +0,0 @@
[交易说明]
交易名: 接口回传设置分页查询
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.interface_name TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
PAGEQUERY
SELECT
*
FROM
md_pb_interfaceback
WHERE
1=1
OPTION 输入.interface_name <> ""
interface_name like 输入.interface_name
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF

83
lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/wql/QMD_PB_STORAGEVEHICLEINFO.wql

@ -1,83 +0,0 @@
[交易说明]
交易名: 载具维护分页查询
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.storagevehicle_code_begin TYPEAS s_string
输入.storagevehicle_code_end TYPEAS s_string
输入.storagevehicle_type TYPEAS f_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
PAGEQUERY
SELECT
s.*,
ext.pcsn,
ext.qty,
ext.update_time AS change_time,
mater.material_code,
mater.material_name,
point.point_code,
point.point_name,
class.class_name AS storagevehicle_type_name
FROM
md_pb_storagevehicleinfo s
LEFT JOIN sch_base_point point ON point.vehicle_code = s.storagevehicle_code
LEFT JOIN ST_IVT_StructIvt ivt ON point.source_id = ivt.struct_id
LEFT JOIN md_me_materialbase mater ON mater.material_id = ivt.material_id
LEFT JOIN md_pb_classstandard class ON class.class_code = s.storagevehicle_type
LEFT JOIN md_pb_storagevehicleext ext ON ext.storagevehicle_code = s.storagevehicle_code
WHERE
s.is_delete = '0'
ENDOPTION
OPTION 输入.storagevehicle_code_begin <> ""
s.storagevehicle_code >= 输入.storagevehicle_code_begin
ENDOPTION
ENDOPTION
OPTION 输入.storagevehicle_code_end <> ""
s.storagevehicle_code <= 输入.storagevehicle_code_end
ENDOPTION
OPTION 输入.storagevehicle_type <> ""
class.class_id in 输入.storagevehicle_type
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF

82
lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/rest/StructrelamaterialController.java

@ -1,82 +0,0 @@
package org.nl.wms.basedata.st.rest;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.logging.annotation.Log;
import org.nl.wms.basedata.st.service.StructrelamaterialService;
import org.nl.wms.basedata.st.service.dto.StructrelamaterialDto;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* @author zhouz
* @date 2021-12-09
**/
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/structrelamaterial")
@Slf4j
public class StructrelamaterialController {
private final StructrelamaterialService structrelamaterialService;
@GetMapping
@Log("查询物料存放设置")
//@PreAuthorize("@el.check('structrelamaterial:list')")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(structrelamaterialService.queryAll(whereJson, page), HttpStatus.OK);
}
@PostMapping
@Log("新增物料存放设置")
//@PreAuthorize("@el.check('structrelamaterial:add')")
public ResponseEntity<Object> create(@Validated @RequestBody StructrelamaterialDto dto) {
structrelamaterialService.create(dto);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PutMapping
@Log("修改物料存放设置")
//@PreAuthorize("@el.check('structrelamaterial:edit')")
public ResponseEntity<Object> update(@Validated @RequestBody StructrelamaterialDto dto) {
structrelamaterialService.update(dto);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Log("删除物料存放设置")
//@PreAuthorize("@el.check('structrelamaterial:del')")
@DeleteMapping
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
structrelamaterialService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/insertSet")
@Log("插入物料存放设置")
//@PreAuthorize("@el.check('structrelamaterial:edit')")
public ResponseEntity<Object> insertSet(@RequestBody Map whereJson) {
structrelamaterialService.insertSet(whereJson);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PostMapping("/delSet")
@Log("删除物料存放设置")
//@PreAuthorize("@el.check('structrelamaterial:edit')")
public ResponseEntity<Object> delSet(@RequestBody Map whereJson) {
structrelamaterialService.delSet(whereJson);
return new ResponseEntity<>(HttpStatus.OK);
}
}

7
lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/sectattr/service/impl/SectattrServiceImpl.java

@ -258,8 +258,11 @@ public class SectattrServiceImpl extends ServiceImpl<SectattrMapper, Sectattr> i
public void changeActive(JSONObject json) {
String stor_id = json.getString("stor_id");
JSONObject st_ivt_bsRealStorAttr = WQLObject.getWQLObject("ST_IVT_BSRealStorAttr").query(" stor_id = '" + stor_id + "' and is_used = '1'").uniqueResult(0);
if (ObjectUtil.isEmpty(st_ivt_bsRealStorAttr)) {
StorattrDto StorAttr = storattrService.findById(Long.valueOf(stor_id));
if (ObjectUtil.isEmpty(StorAttr)) {
throw new BadRequestException("该库区所属的仓库不存在!");
}
if ("0".equals(StorAttr.getIs_used())) {
throw new BadRequestException("该库区所属的仓库已禁用,请先启用该仓库!");
}

75
lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/StructrelamaterialService.java

@ -1,75 +0,0 @@
package org.nl.wms.basedata.st.service;
import org.nl.wms.basedata.st.service.dto.StructrelamaterialDto;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
/**
* @author zhouz
* @description 服务接口
* @date 2021-12-09
**/
public interface StructrelamaterialService {
/**
* 查询数据分页
*
* @param whereJson 条件
* @param page 分页参数
* @return Map<String, Object>
*/
Map<String, Object> queryAll(Map whereJson, Pageable page);
/**
* 查询所有数据不分页
*
* @param whereJson 条件参数
* @return List<StructrelamaterialDto>
*/
List<StructrelamaterialDto> queryAll(Map whereJson);
/**
* 根据ID查询
*
* @param material_type_id ID
* @return Structrelamaterial
*/
StructrelamaterialDto findById(Long material_type_id);
/**
* 根据编码查询
*
* @param code code
* @return Structrelamaterial
*/
StructrelamaterialDto findByCode(String code);
/**
* 创建
*
* @param dto /
*/
void create(StructrelamaterialDto dto);
/**
* 编辑
*
* @param dto /
*/
void update(StructrelamaterialDto dto);
/**
* 多选删除
*
* @param ids /
*/
void deleteAll(Long[] ids);
void insertSet(Map whereJson);
void delSet(Map whereJson);
}

34
lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/dto/StructrelamaterialDto.java

@ -1,34 +0,0 @@
package org.nl.wms.basedata.st.service.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhouz
* @description /
* @date 2021-12-09
**/
@Data
public class StructrelamaterialDto implements Serializable {
/**
* 防止精度丢失
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long sect_id;
/**
* 防止精度丢失
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long material_type_id;
private Long set_id;
private String set_name;
private String set_time;
}

2
lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/impl/StructivtServiceImpl.java

@ -19,7 +19,6 @@ import org.nl.modules.common.utils.FileUtil;
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.basedata.master.service.ClassstandardService;
import org.nl.wms.basedata.st.service.StructivtService;
import org.nl.wms.basedata.st.service.dto.StructivtDto;
import org.springframework.data.domain.Pageable;
@ -42,7 +41,6 @@ import java.util.*;
@RequiredArgsConstructor
@Slf4j
public class StructivtServiceImpl implements StructivtService {
private final ClassstandardService classstandardService;
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page, String[] product_area, String[] ivt_flag) {

175
lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/impl/StructrelamaterialServiceImpl.java

@ -1,175 +0,0 @@
package org.nl.wms.basedata.st.service.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 com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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.basedata.master.service.ClassstandardService;
import org.nl.wms.basedata.st.service.StructrelamaterialService;
import org.nl.wms.basedata.st.service.dto.StructrelamaterialDto;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author zhouz
* @description 服务实现
* @date 2021-12-09
**/
@Service
@RequiredArgsConstructor
@Slf4j
public class StructrelamaterialServiceImpl implements StructrelamaterialService {
private final ClassstandardService classstandardService;
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
String search = (String) whereJson.get("search");
HashMap<String, String> map = new HashMap<>();
if (!StrUtil.isEmpty(search)) {
map.put("search", "%" + search + "%");
}
map.put("flag", "1");
map.put("stor_id", (String) whereJson.get("stor_id"));
map.put("sect_id", (String) whereJson.get("sect_id"));
String material_type_id = (String) whereJson.get("material_type_id");
String class_idStr = (String) whereJson.get("class_idStr");
//处理物料当前节点的所有子节点
if (!StrUtil.isEmpty(material_type_id)) {
map.put("material_type_id", material_type_id);
String classIds = classstandardService.getChildIdStr(material_type_id);
map.put("classIds", classIds);
} else if (ObjectUtil.isNotEmpty(class_idStr)) {
String classIds = classstandardService.getAllChildIdStr(class_idStr);
map.put("classIds", classIds);
}
JSONObject jo = WQL.getWO("QST_IVT_MATERIALSET").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "set_time desc");
return jo;
}
@Override
public List<StructrelamaterialDto> queryAll(Map whereJson) {
WQLObject wo = WQLObject.getWQLObject("st_ivt_structrelamaterial");
JSONArray arr = wo.query().getResultJSONArray(0);
List<StructrelamaterialDto> list = arr.toJavaList(StructrelamaterialDto.class);
return list;
}
@Override
public StructrelamaterialDto findById(Long material_type_id) {
WQLObject wo = WQLObject.getWQLObject("st_ivt_structrelamaterial");
JSONObject json = wo.query("material_type_id =" + material_type_id + "").uniqueResult(0);
final StructrelamaterialDto obj = json.toJavaObject(StructrelamaterialDto.class);
return obj;
}
@Override
public StructrelamaterialDto findByCode(String code) {
WQLObject wo = WQLObject.getWQLObject("st_ivt_structrelamaterial");
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
final StructrelamaterialDto obj = json.toJavaObject(StructrelamaterialDto.class);
return obj;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(StructrelamaterialDto dto) {
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
dto.setMaterial_type_id(IdUtil.getSnowflake(1, 1).nextId());
dto.setSet_name(nickName);
dto.setSet_time(now);
WQLObject wo = WQLObject.getWQLObject("st_ivt_structrelamaterial");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
wo.insert(json);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(StructrelamaterialDto dto) {
StructrelamaterialDto entity = this.findById(dto.getMaterial_type_id());
if (entity == null) {
throw new BadRequestException("被删除或无权限,操作失败!");
}
WQLObject wo = WQLObject.getWQLObject("st_ivt_structrelamaterial");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
wo.update(json);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteAll(Long[] ids) {
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
WQLObject wo = WQLObject.getWQLObject("st_ivt_structrelamaterial");
for (Long material_type_id : ids) {
JSONObject param = new JSONObject();
param.put("material_type_id", String.valueOf(material_type_id));
param.put("is_delete", "1");
param.put("update_optid", currentUserId);
param.put("update_optname", nickName);
param.put("update_time", now);
wo.update(param);
}
}
@Override
public void insertSet(Map whereJson) {
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
WQLObject mater = WQLObject.getWQLObject("ST_IVT_StructRelaMaterial");
String sect_id = (String) whereJson.get("sect_id");
ArrayList<HashMap> class_rows = (ArrayList<HashMap>) whereJson.get("class_rows");
for (int i = 0; i < class_rows.size(); i++) {
HashMap<String, String> class_row = class_rows.get(i);
JSONObject material_set = mater.query("sect_id = '" + sect_id + "' AND material_type_id = '" + class_row.get("class_id") + "'")
.uniqueResult(0);
if (material_set != null) {
HashMap<String, String> update_map = new HashMap<>();
update_map.put("set_id", currentUserId + "");
update_map.put("set_name", nickName);
update_map.put("set_time", now);
mater.update(update_map, "sect_id = '" + sect_id + "' AND material_type_id = '" + class_row.get("class_id") + "'");
} else {
JSONObject jo = new JSONObject();
jo.put("sect_id", sect_id);
jo.put("material_type_id", class_row.get("class_id"));
jo.put("set_id", currentUserId + "");
jo.put("set_name", nickName);
jo.put("set_time", now);
mater.insert(jo);
}
}
}
@Override
public void delSet(Map whereJson) {
String sect_id = (String) whereJson.get("sect_id");
String material_type_id = (String) whereJson.get("material_type_id");
WQLObject.getWQLObject("ST_IVT_StructRelaMaterial").delete("sect_id = '" + sect_id + "' AND material_type_id = '" + material_type_id + "'");
}
}

10
lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/structattr/service/impl/StructattrServiceImpl.java

@ -618,8 +618,6 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
// 点位表
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
// 仓库表
WQLObject storTab = WQLObject.getWQLObject("st_ivt_bsrealstorattr");
// 判断库区是否是虚拟区
Sectattr sectattr = sectattrService.getOne(Wrappers.lambdaQuery(Sectattr.class)
.eq(StrUtil.isNotEmpty(whereJson.getString("sect_id")), Sectattr::getSect_id, whereJson.getString("sect_id")));
@ -695,7 +693,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
json.put("struct_code", prefix + "-" + i + "-01");
json.put("struct_name", prefix + "排-" + i + "列-01层");
}
JSONObject jsonObject = storTab.query("stor_id = '" + whereJson.getString("stor_id") + "'").uniqueResult(0);
StorattrDto jsonObject = storattrService.findById(Long.valueOf(whereJson.getString("stor_id")));
Sectattr sectattr1 = sectattrService.getOne(Wrappers.lambdaQuery(Sectattr.class)
.eq(ObjectUtil.isNotEmpty(whereJson.getLong("sect_id")), Sectattr::getSect_id, whereJson.getLong("sect_id"))
.eq(ObjectUtil.isNotEmpty(whereJson.getLong("stor_id")), Sectattr::getStor_id, whereJson.getLong("stor_id")));
@ -705,9 +703,9 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
json.put("sect_id", sectattr1.getSect_id());
json.put("sect_code", sectattr1.getSect_code());
json.put("sect_name", sectattr1.getSect_name());
json.put("stor_id", jsonObject.getString("stor_id"));
json.put("stor_code", jsonObject.getString("stor_code"));
json.put("stor_name", jsonObject.getString("stor_name"));
json.put("stor_id", jsonObject.getStor_id());
json.put("stor_code", jsonObject.getStor_code());
json.put("stor_name", jsonObject.getStor_name());
json.put("lock_type", "1");
json.put("row_num", 1);
json.put("col_num", i);

78
lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/QST_IVT_MATERIALSET.wql

@ -1,78 +0,0 @@
[交易说明]
交易名: 基础点位分页查询
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.search TYPEAS s_string
输入.stor_id TYPEAS s_string
输入.sect_id TYPEAS s_string
输入.classIds TYPEAS f_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
PAGEQUERY
SELECT
se.sect_code,
se.sect_name,
class.class_code,
class.class_name,
sm.*
FROM
st_ivt_structrelamaterial sm
INNER JOIN st_ivt_sectattr se ON se.sect_id = sm.sect_id
INNER JOIN md_pb_classstandard class ON class.class_id = sm.material_type_id
OPTION 输入.search <> ""
(
class.class_code like 输入.search
OR
class.class_name like 输入.search
)
ENDOPTION
OPTION 输入.stor_id <> ""
se.stor_id = 输入.stor_id
ENDOPTION
OPTION 输入.sect_id <> ""
se.sect_id = 输入.sect_id
ENDOPTION
OPTION 输入.classIds <> ""
class.class_id in 输入.classIds
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF

17
lms/nladmin-system/src/main/java/org/nl/wms/sch/service/impl/TaskServiceImpl.java

@ -17,13 +17,14 @@ import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.modules.wql.util.WqlUtil;
import org.nl.wms.basedata.master.service.ClassstandardService;
import org.nl.wms.basedata.master.service.dto.ClassstandardDto;
import org.nl.wms.basedata.master.classstandard.service.dao.ClassStandard;
import org.nl.wms.basedata.master.classstandard.service.dao.mapper.ClassStandardMapper;
import org.nl.wms.basedata.st.service.impl.UserAreaServiceImpl;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.sch.service.TaskService;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -32,7 +33,6 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
/**
@ -45,9 +45,9 @@ import java.util.concurrent.TimeUnit;
@Slf4j
public class TaskServiceImpl implements TaskService {
private final ClassstandardService classstandardService;
private final RedissonClient redissonClient;
@Autowired
private ClassStandardMapper classStandardMapper;
@Override
public Map<String, Object> queryAll(Map form, Pageable page) {
@ -80,9 +80,10 @@ public class TaskServiceImpl implements TaskService {
map.put("vehicle_code", "%" + whereJson.getString("vehicle_code") + "%");
}
if (StrUtil.isNotEmpty(whereJson.getString("task_type"))) {
ClassstandardDto dto = classstandardService.findById(whereJson.getString("task_type"));
String task_type = classstandardService.getChildIdStr(dto.getClass_id().toString());
map.put("task_type", task_type);
ClassStandard dto = classStandardMapper.selectById(whereJson.getString("task_type"));
//需要优化为myb plus版本查询
//String task_type = classstandardService.getChildIdStr(dto.getClass_id());
//map.put("task_type", task_type);
}
if (StrUtil.isNotEmpty(whereJson.getString("finishTypeList"))) {
map.put("finishTypeList", whereJson.getString("finishTypeList"));

Loading…
Cancel
Save