From 2efdc243fb9df8364643322a1897ec08abc9d438 Mon Sep 17 00:00:00 2001 From: liyongde <1419499670@qq.com> Date: Wed, 30 Oct 2024 13:28:13 +0800 Subject: [PATCH] =?UTF-8?q?refactor=EF=BC=9A=E7=82=B9=E4=BD=8D=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SchBasePointController.java | 63 ++++-- .../nl/b_lms/sch/point/dao/SchBasePoint.java | 36 ++-- .../point/dao/mapper/SchBasePointMapper.java | 3 + .../point/dao/mapper/SchBasePointMapper.xml | 193 ++++++++++-------- .../sch/point/dto/SchBasePointQuery.java | 18 ++ .../point/service/IschBasePointService.java | 19 +- .../service/impl/SchBasePointServiceImpl.java | 170 +++++++++++++-- .../b_lms/sch/region/dao/SchBaseRegion.java | 2 +- .../region/service/IschBaseRegionService.java | 4 +- .../structattr/service/StructattrService.java | 7 + .../service/dao/mapper/StructattrMapper.java | 3 + .../service/dao/mapper/StructattrMapper.xml | 9 + .../service/dto/PointToStructattrDto.java | 15 ++ .../service/impl/StructattrServiceImpl.java | 6 + .../main/java/org/nl/wms/sch/PointUtils.java | 28 +++ .../org/nl/wms/sch/rest/PointController.java | 3 +- .../src/views/wms/sch/point/index.vue | 36 +++- 17 files changed, 467 insertions(+), 148 deletions(-) create mode 100644 lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/dto/SchBasePointQuery.java create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/structattr/service/dto/PointToStructattrDto.java create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/sch/PointUtils.java diff --git a/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/controller/SchBasePointController.java b/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/controller/SchBasePointController.java index 1ef66a5..c3542b3 100644 --- a/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/controller/SchBasePointController.java +++ b/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/controller/SchBasePointController.java @@ -1,9 +1,14 @@ package org.nl.b_lms.sch.point.controller; +import java.util.List; import java.util.Set; import java.util.Map; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import org.nl.b_lms.sch.point.dao.SchBasePoint; +import org.nl.b_lms.sch.point.dto.SchBasePointQuery; +import org.nl.b_lms.sch.region.service.IschBaseRegionService; import org.nl.common.TableDataInfo; import org.springframework.web.bind.annotation.*; import lombok.RequiredArgsConstructor; @@ -19,21 +24,19 @@ import org.nl.b_lms.sch.point.service.IschBasePointService; /** - * {@code @Description:} 点位基础表(SchBasePoint)控制层 - * {@code @Author:} gbx - * + * 点位控制层 + * @author gbx * @since 2024-01-24 */ @RestController -@RequiredArgsConstructor -@RequestMapping("/api/schBasePoint") +@RequestMapping("/api/point") @Slf4j public class SchBasePointController { - @Resource private IschBasePointService schBasePointService; - + @Resource + private IschBaseRegionService schBaseRegionService; /** * 分页查询 @@ -43,11 +46,10 @@ public class SchBasePointController { */ @GetMapping @Log("查询点位基础表") - public ResponseEntity query(@RequestParam Map whereJson, PageQuery page) { + public ResponseEntity query(SchBasePointQuery whereJson, PageQuery page) { return new ResponseEntity<>(TableDataInfo.build(schBasePointService.queryAll(whereJson, page)), HttpStatus.OK); } - /** * 新增数据 * @@ -56,12 +58,11 @@ public class SchBasePointController { */ @PostMapping @Log("新增点位基础表") - public ResponseEntity create(SchBasePoint entity) { + public ResponseEntity create(@RequestBody SchBasePoint entity) { schBasePointService.create(entity); return new ResponseEntity<>(HttpStatus.OK); } - /** * 修改数据 * @@ -71,7 +72,7 @@ public class SchBasePointController { @PutMapping @Log("修改点位基础表") //@SaCheckPermission("@el.check(SchBasePoint:edit')") - public ResponseEntity update(SchBasePoint entity) { + public ResponseEntity update(@RequestBody SchBasePoint entity) { schBasePointService.update(entity); return new ResponseEntity<>(HttpStatus.OK); } @@ -91,6 +92,42 @@ public class SchBasePointController { return new ResponseEntity<>(HttpStatus.OK); } + @PutMapping("/changeActive") + @Log("修改点位启用状态") + //@SaCheckPermission("store:edit") + public ResponseEntity update(@RequestBody JSONObject json) { + schBasePointService.changeActive(json); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } -} + @GetMapping("/getRegion") + @Log("获取区域") + public ResponseEntity getRegion() { + return new ResponseEntity<>(schBaseRegionService.list(), HttpStatus.OK); + } + @PutMapping("/changeActives") + @Log("批量修改点位启用状态") + //@SaCheckPermission("store:edit") + public ResponseEntity update2(@RequestBody JSONArray rows) { + for (int i = 0; i < rows.size(); i++) { + JSONObject json = rows.getJSONObject(i); + schBasePointService.changeActive(json); + } + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @PostMapping("/getPoint") + @Log("查询点位下拉框") + //@SaCheckPermission("materialtype:list") + public ResponseEntity queryPoint(@RequestBody List areas) { + return new ResponseEntity<>(schBasePointService.getPoint(areas), HttpStatus.OK); + } + + @Log("仓位同步") + @PostMapping("/sync") + public ResponseEntity sync() { + schBasePointService.sync(); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/dao/SchBasePoint.java b/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/dao/SchBasePoint.java index 22dd573..c080896 100644 --- a/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/dao/SchBasePoint.java +++ b/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/dao/SchBasePoint.java @@ -2,6 +2,7 @@ package org.nl.b_lms.sch.point.dao; import java.math.BigDecimal; import java.io.Serializable; +import java.util.List; import lombok.Data; import lombok.EqualsAndHashCode; @@ -22,14 +23,12 @@ import com.baomidou.mybatisplus.extension.activerecord.Model; public class SchBasePoint extends Model { private static final long serialVersionUID = -7739291296662381393L; - //@TableId(value = "id", type = IdType.NONE) - /** * 点位标识 */ @TableId(value = "point_id", type = IdType.NONE) - private Long point_id; + private String point_id; /** @@ -47,7 +46,7 @@ public class SchBasePoint extends Model { /** * 所属区域 */ - private Long region_id; + private String region_id; /** @@ -83,7 +82,7 @@ public class SchBasePoint extends Model { /** * 物料标识 */ - private Long material_id; + private String material_id; /** @@ -125,7 +124,7 @@ public class SchBasePoint extends Model { /** * 载具数量 */ - private BigDecimal vehicle_qty; + private Integer vehicle_qty; /** @@ -191,7 +190,7 @@ public class SchBasePoint extends Model { /** * 在执行的任务标识 */ - private Long task_id; + private String task_id; /** @@ -209,7 +208,7 @@ public class SchBasePoint extends Model { /** * 来源标识 */ - private Long source_id; + private String source_id; /** @@ -227,7 +226,7 @@ public class SchBasePoint extends Model { /** * 创建人 */ - private Long create_id; + private String create_id; /** @@ -246,13 +245,13 @@ public class SchBasePoint extends Model { /** * 修改人 */ - private Long update_optid; + private String update_id; /** * 修改人 */ - private String update_optname; + private String update_name; /** @@ -273,17 +272,14 @@ public class SchBasePoint extends Model { */ private String material_code; + @TableField(exist = false) + private List can_vehicle_types; - /** - * 获取主键值 - * - * @return 主键值 - */ - @Override - protected Serializable pkVal() { - return this.point_id; - } + @TableField(exist = false) + private String point_type_name; + @TableField(exist = false) + private String point_status_name; } diff --git a/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/dao/mapper/SchBasePointMapper.java b/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/dao/mapper/SchBasePointMapper.java index 0035424..32b3997 100644 --- a/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/dao/mapper/SchBasePointMapper.java +++ b/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/dao/mapper/SchBasePointMapper.java @@ -2,7 +2,9 @@ package org.nl.b_lms.sch.point.dao.mapper; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import org.nl.b_lms.sch.point.dao.SchBasePoint; +import org.nl.b_lms.sch.point.dto.SchBasePointQuery; import java.util.List; @@ -50,4 +52,5 @@ public interface SchBasePointMapper extends BaseMapper { List isBlock(JSONObject whereJson); + IPage selectPageLeftJoin(IPage pages, SchBasePointQuery whereJson); } diff --git a/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/dao/mapper/SchBasePointMapper.xml b/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/dao/mapper/SchBasePointMapper.xml index 1d2286b..44607df 100644 --- a/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/dao/mapper/SchBasePointMapper.xml +++ b/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/dao/mapper/SchBasePointMapper.xml @@ -8,8 +8,8 @@ sub.sale_order_name FROM sch_base_point point - LEFT JOIN bst_ivt_boxinfo box ON point.vehicle_code = box.box_no - LEFT JOIN ( + LEFT JOIN bst_ivt_boxinfo box ON point.vehicle_code = box.box_no + LEFT JOIN ( SELECT MAX(sale_order_name) AS sale_order_name, package_box_sn @@ -21,20 +21,20 @@ ) sub ON point.vehicle_code = sub.package_box_sn WHERE point.is_used = '1' - AND point.is_delete = '0' - AND point.region_code = 'BKZ01' - ORDER BY out_empty_seq + AND point.is_delete = '0' + AND point.region_code = 'BKZ01' + ORDER BY out_empty_seq SELECT - * + * + FROM + ( + SELECT + po.row_num FROM - ( - SELECT - po.row_num - FROM - sch_base_point po - WHERE - po.is_delete = '0' - AND is_used = '1' - - - AND po.region_id= #{region_id} - - - GROUP BY - po.row_num - ) a + sch_base_point po WHERE - NOT EXISTS ( - SELECT - * - FROM - ( - SELECT - row_num - FROM - sch_base_point po2 - WHERE - IFNULL( po2.vehicle_code, '' ) != '' - - - AND po2.region_id= #{region_id} - - - GROUP BY - po2.row_num - ) b - WHERE - b.row_num = a.row_num - ) + po.is_delete = '0' + AND is_used = '1' + + + AND po.region_id= #{region_id} + + + GROUP BY + po.row_num + ) a + WHERE + NOT EXISTS ( + SELECT + * + FROM + ( + SELECT + row_num + FROM + sch_base_point po2 + WHERE + IFNULL( po2.vehicle_code, '' ) != '' + + + AND po2.region_id= #{region_id} + + + GROUP BY + po2.row_num + ) b + WHERE + b.row_num = a.row_num + ) ORDER BY row_num ASC @@ -100,51 +100,82 @@ + diff --git a/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/dto/SchBasePointQuery.java b/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/dto/SchBasePointQuery.java new file mode 100644 index 0000000..897d72d --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/dto/SchBasePointQuery.java @@ -0,0 +1,18 @@ +package org.nl.b_lms.sch.point.dto; + +import lombok.Data; + +/** + * 点位查询实体 + * @Author: lyd + * @Date: 2024/10/21 + */ +@Data +public class SchBasePointQuery { + private String name; + private String region_id; + private String point_type; + private String point_status; + private String lock_type; + private String is_used; +} diff --git a/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/service/IschBasePointService.java b/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/service/IschBasePointService.java index c24ac89..5e4a361 100644 --- a/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/service/IschBasePointService.java +++ b/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/service/IschBasePointService.java @@ -1,9 +1,14 @@ package org.nl.b_lms.sch.point.service; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; import java.util.Map; import java.util.Set; import com.baomidou.mybatisplus.core.metadata.IPage; import org.nl.b_lms.sch.point.dao.SchBasePoint; +import org.nl.b_lms.sch.point.dto.SchBasePointQuery; +import org.nl.b_lms.sch.region.dao.SchBaseRegion; import org.nl.common.domain.query.PageQuery; @@ -17,7 +22,7 @@ public interface IschBasePointService extends IService { * @param pageable 分页参数 * @return IPage */ - IPage queryAll(Map whereJson, PageQuery pageable); + IPage queryAll(SchBasePointQuery whereJson, PageQuery pageable); /** @@ -43,6 +48,18 @@ public interface IschBasePointService extends IService { void deleteAll(Set ids); + /** + * 修改点位启用状态 + * @param json + */ + void changeActive(JSONObject json); + + List getPoint(List areas); + + /** + * 仓位同步 + */ + void sync(); } diff --git a/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/service/impl/SchBasePointServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/service/impl/SchBasePointServiceImpl.java index 370cabf..85a87c9 100644 --- a/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/service/impl/SchBasePointServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/service/impl/SchBasePointServiceImpl.java @@ -1,18 +1,35 @@ package org.nl.b_lms.sch.point.service.impl; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import org.nl.b_lms.sch.point.dao.SchBasePoint; import org.nl.b_lms.sch.point.dao.mapper.SchBasePointMapper; +import org.nl.b_lms.sch.point.dto.SchBasePointQuery; import org.nl.b_lms.sch.point.service.IschBasePointService; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.nl.b_lms.sch.region.dao.SchBaseRegion; +import org.nl.b_lms.sch.region.dao.mapper.SchBaseRegionMapper; +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.basedata.st.structattr.service.StructattrService; +import org.nl.wms.basedata.st.structattr.service.dto.PointToStructattrDto; +import org.nl.wms.sch.PointUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.metadata.IPage; import org.nl.common.domain.query.PageQuery; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; -import java.util.Map; -import java.util.Set; +import java.math.BigDecimal; +import java.util.*; /** @@ -27,6 +44,10 @@ public class SchBasePointServiceImpl extends ServiceImpl queryAll(Map whereJson, PageQuery page) { - return schBasePointMapper.selectPage(new Page<>(page.getPage() + 1, page.getSize()), new QueryWrapper() - .lambda()); + public IPage queryAll(SchBasePointQuery whereJson, PageQuery page) { + IPage pages = new Page<>(page.getPage() + 1, page.getSize()); + pages = schBasePointMapper.selectPageLeftJoin(pages, whereJson); + // 可以存放的载具类型 + pages.getRecords().forEach(point -> { + if (ObjectUtil.isNotEmpty(point.getCan_vehicle_type())) { + point.setCan_vehicle_types(Arrays.asList(point.getCan_vehicle_type().split(","))); + } + String pointStatus = point.getPoint_status(); // 点位状态 + String pointType = point.getPoint_type(); // 点位类型 + SchBaseRegion regionObj = regionMapper.selectById(point.getRegion_id()); + if (ObjectUtil.isNotEmpty(regionObj)) { + if (ObjectUtil.isNotEmpty(pointStatus) && ObjectUtil.isNotEmpty(regionObj.getPoint_status_explain())) { + // 设置 + point.setPoint_status_name(PointUtils.getStatusOrTypeName( + regionObj.getPoint_status_explain(), pointStatus)); + } + if (ObjectUtil.isNotEmpty(pointType) && ObjectUtil.isNotEmpty(regionObj.getPoint_type_explain())) { + // 设置 + point.setPoint_type_name(PointUtils.getStatusOrTypeName( + regionObj.getPoint_type_explain(), pointType)); + } + } + }); + return pages; } @@ -60,10 +103,17 @@ public class SchBasePointServiceImpl extends ServiceImpl lam = new LambdaUpdateWrapper<>(); + lam.set(SchBasePoint::getIs_used, "1".equals(isUsed) ? "0" : "1") + .set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId()) + .set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName()) + .set(SchBasePoint::getUpdate_time, DateUtil.now()) + .eq(SchBasePoint::getPoint_code, pointType); + update(lam); + // 如果启用,则同步更新仓位的状态 + // todo: 未修改mp + json = new JSONObject(); + json.put("is_used", "1".equals(isUsed) ? "0" : "1"); + json.put("update_optid", SecurityUtils.getCurrentUserId()); + json.put("update_optname", SecurityUtils.getCurrentNickName()); + json.put("update_time", DateUtil.now()); + json.put("struct_code", structCode); + WQLObject.getWQLObject("ST_IVT_StructAttr").update(json, " struct_code = '" + structCode + "'"); + } + + @Override + public List getPoint(List areas) { + LambdaQueryWrapper lam = new QueryWrapper().lambda(); + lam.eq(SchBasePoint::getIs_used, "1") + .eq(SchBasePoint::getIs_delete, "0") + .in(SchBasePoint::getRegion_id, areas); + return schBasePointMapper.selectList(lam); + } + + @Override + public void sync() { + // 先删除所有点位类型为仓位的点位 + schBasePointMapper.delete(new LambdaQueryWrapper() + .eq(SchBasePoint::getPoint_type, "2")); + String currentUserId = SecurityUtils.getCurrentUserId(); + String nickName = SecurityUtils.getCurrentNickName(); + String now = DateUtil.now(); + List structattrDtos = structattrService.getAllPointToShippingSpace(); + List waitAddList = new ArrayList<>(); + for (PointToStructattrDto dto : structattrDtos) { + SchBasePoint point = new SchBasePoint(); + point.setPoint_id(IdUtil.getSnowflake(1,1).nextIdStr()); + point.setPoint_code(dto.getStruct_code()); + point.setPoint_name(dto.getStruct_name()); + point.setRegion_id(String.valueOf(dto.getSect_id())); + point.setRegion_code(dto.getSect_code()); + point.setRegion_name(dto.getSect_name()); + point.setPoint_type("2"); + point.setPoint_status("1"); + point.setLock_type(dto.getLock_type()); + point.setBlock_num(new BigDecimal(dto.getBlock_num())); + point.setRow_num(new BigDecimal(dto.getRow_num())); + point.setCol_num(new BigDecimal(dto.getCol_num())); + point.setLayer_num(new BigDecimal(dto.getLayer_num())); + point.setSource_id(String.valueOf(dto.getStruct_id())); + point.setCreate_id(currentUserId); + point.setCreate_name(nickName); + point.setCreate_time(now); + point.setUpdate_id(currentUserId); + point.setUpdate_name(nickName); + point.setUpdate_time(now); + waitAddList.add(point); + } + this.saveBatch(waitAddList); + } + /** * 获取实体基础信息 @@ -87,14 +219,18 @@ public class SchBasePointServiceImpl extends ServiceImpl { * 区域标识 */ @TableId(value = "region_id", type = IdType.NONE) - private Long region_id; + private String region_id; /** diff --git a/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/region/service/IschBaseRegionService.java b/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/region/service/IschBaseRegionService.java index d4137e9..2e1fe71 100644 --- a/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/region/service/IschBaseRegionService.java +++ b/lms/nladmin-system/src/main/java/org/nl/b_lms/sch/region/service/IschBaseRegionService.java @@ -11,8 +11,8 @@ import org.nl.common.domain.query.PageQuery; /** - * {@code @Description:} 区域基础表(SchBaseRegion)服务接口层 - * {@code @Author:} gbx + * 区域基础表(SchBaseRegion)服务接口层 + * @author gbx * * @since 2024-01-23 19:45:03 */ diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/structattr/service/StructattrService.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/structattr/service/StructattrService.java index 718b1a4..f961832 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/structattr/service/StructattrService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/structattr/service/StructattrService.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import org.nl.common.domain.query.PageQuery; import org.nl.wms.basedata.st.structattr.service.dao.Structattr; +import org.nl.wms.basedata.st.structattr.service.dto.PointToStructattrDto; import org.nl.wms.basedata.st.structattr.service.dto.StructQuery; import org.nl.wms.basedata.st.structattr.service.dto.StructattrDto; import org.springframework.data.domain.Pageable; @@ -153,4 +154,10 @@ public interface StructattrService extends IService { * @return Map */ IPage twoVehicleIvt(Map whereJson, Pageable page); + + /** + * 获取仓位数据,提供给点位表 + * @return / + */ + List getAllPointToShippingSpace(); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/structattr/service/dao/mapper/StructattrMapper.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/structattr/service/dao/mapper/StructattrMapper.java index 82c0526..7212a5f 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/structattr/service/dao/mapper/StructattrMapper.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/structattr/service/dao/mapper/StructattrMapper.java @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; import org.nl.wms.basedata.st.structattr.service.dao.Structattr; +import org.nl.wms.basedata.st.structattr.service.dto.PointToStructattrDto; import java.util.List; @@ -29,4 +30,6 @@ public interface StructattrMapper extends BaseMapper { * @return */ JSONArray queryAll(@Param("struct_id")String struct_id); + + List getAllPointToShippingSpace(); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/structattr/service/dao/mapper/StructattrMapper.xml b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/structattr/service/dao/mapper/StructattrMapper.xml index 3f282f6..960986d 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/structattr/service/dao/mapper/StructattrMapper.xml +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/structattr/service/dao/mapper/StructattrMapper.xml @@ -43,4 +43,13 @@ LEFT JOIN pdm_bi_subpackagerelation sub ON sub.package_box_sn = attr.storagevehicle_code WHERE attr.struct_id = #{struct_id} + diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/structattr/service/dto/PointToStructattrDto.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/structattr/service/dto/PointToStructattrDto.java new file mode 100644 index 0000000..613813c --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/structattr/service/dto/PointToStructattrDto.java @@ -0,0 +1,15 @@ +package org.nl.wms.basedata.st.structattr.service.dto; + +import lombok.Data; +import org.nl.wms.basedata.st.structattr.service.dao.Structattr; + +/** + * 点位转仓位实体 + * @Author: lyd + * @Date: 2024/10/30 + */ +@Data +public class PointToStructattrDto extends Structattr { + /** 区域id */ + private String region_id; +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/structattr/service/impl/StructattrServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/structattr/service/impl/StructattrServiceImpl.java index aed6fe5..b149000 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/structattr/service/impl/StructattrServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/structattr/service/impl/StructattrServiceImpl.java @@ -39,6 +39,7 @@ import org.nl.wms.basedata.st.structattr.service.StructattrService; import org.nl.wms.basedata.st.sectattr.service.dto.SectattrDto; import org.nl.wms.basedata.st.storattr.service.dto.StorattrDto; import org.nl.wms.basedata.st.structattr.service.dto.StructQuery; +import org.nl.wms.basedata.st.structattr.service.dto.PointToStructattrDto; import org.nl.wms.basedata.st.structattr.service.dto.StructattrDto; import org.nl.wms.basedata.st.service.impl.UserStorServiceImpl; import org.springframework.beans.factory.annotation.Autowired; @@ -836,4 +837,9 @@ public class StructattrServiceImpl extends ServiceImpl getAllPointToShippingSpace() { + return structattrMapper.getAllPointToShippingSpace (); + } + } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/PointUtils.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/PointUtils.java new file mode 100644 index 0000000..9be4902 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/PointUtils.java @@ -0,0 +1,28 @@ +package org.nl.wms.sch; + +import com.alibaba.fastjson.JSONObject; + +/** + * 点位工具类 + * @Author: lyd + * @Date: 2024/10/21 + */ +public class PointUtils { + /** + * 获取状态名或者类型名 + * + * @param explain + * @param label + * @return + */ + public static String getStatusOrTypeName(String explain, String label) { + JSONObject statusArr = new JSONObject(); + String[] split = explain.split(","); + for (int j = 0; j < split.length; j++) { + String[] status = split[j].split("-"); + statusArr.put(status[0], status[1]); + } + // 设置 + return statusArr.getString(label); + } +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/rest/PointController.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/rest/PointController.java index b47fbbb..2a103cf 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/rest/PointController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/rest/PointController.java @@ -25,7 +25,7 @@ import java.util.Map; @RestController @RequiredArgsConstructor -@RequestMapping("/api/point") +@RequestMapping("/api/point/2") @Slf4j public class PointController { @@ -112,7 +112,6 @@ public class PointController { @GetMapping("/getRegion") @Log("获取区域") - public ResponseEntity getRegion() { return new ResponseEntity<>(pointService.getRegion(), HttpStatus.OK); } diff --git a/lms/nladmin-ui/src/views/wms/sch/point/index.vue b/lms/nladmin-ui/src/views/wms/sch/point/index.vue index e18c27d..8e9b7a1 100644 --- a/lms/nladmin-ui/src/views/wms/sch/point/index.vue +++ b/lms/nladmin-ui/src/views/wms/sch/point/index.vue @@ -292,7 +292,9 @@ - + @@ -322,17 +324,25 @@ - + + + - - @@ -342,7 +352,7 @@ {{ scope.row.is_used == '1' ? '是' : '否' }} - + { - this.regionList = res - }) - this.$set(this.query, 'region_id', '1582991348217286656') + this.initPointStatusAndTypeList() this.crud.toQuery() }, methods: { + initPointStatusAndTypeList() { + crudPoint.getRegion().then(res => { + this.regionList = res + }) + this.$set(this.query, 'region_id', '1582991348217286656') + this.getPointStatusAndTypeList('1582991348217286656', 1) + }, // 钩子:在获取表格数据之前执行,false 则代表不获取数据 [CRUD.HOOK.beforeRefresh]() { return true