Browse Source

refactor:点位管理

master
李永德 3 weeks ago
parent
commit
2efdc243fb
  1. 63
      lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/controller/SchBasePointController.java
  2. 36
      lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/dao/SchBasePoint.java
  3. 3
      lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/dao/mapper/SchBasePointMapper.java
  4. 193
      lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/dao/mapper/SchBasePointMapper.xml
  5. 18
      lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/dto/SchBasePointQuery.java
  6. 19
      lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/service/IschBasePointService.java
  7. 170
      lms/nladmin-system/src/main/java/org/nl/b_lms/sch/point/service/impl/SchBasePointServiceImpl.java
  8. 2
      lms/nladmin-system/src/main/java/org/nl/b_lms/sch/region/dao/SchBaseRegion.java
  9. 4
      lms/nladmin-system/src/main/java/org/nl/b_lms/sch/region/service/IschBaseRegionService.java
  10. 7
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/structattr/service/StructattrService.java
  11. 3
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/structattr/service/dao/mapper/StructattrMapper.java
  12. 9
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/structattr/service/dao/mapper/StructattrMapper.xml
  13. 15
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/structattr/service/dto/PointToStructattrDto.java
  14. 6
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/structattr/service/impl/StructattrServiceImpl.java
  15. 28
      lms/nladmin-system/src/main/java/org/nl/wms/sch/PointUtils.java
  16. 3
      lms/nladmin-system/src/main/java/org/nl/wms/sch/rest/PointController.java
  17. 36
      lms/nladmin-ui/src/views/wms/sch/point/index.vue

63
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<Object> query(@RequestParam Map whereJson, PageQuery page) {
public ResponseEntity<Object> 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<Object> create(SchBasePoint entity) {
public ResponseEntity<Object> 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<Object> update(SchBasePoint entity) {
public ResponseEntity<Object> 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<Object> update(@RequestBody JSONObject json) {
schBasePointService.changeActive(json);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
}
@GetMapping("/getRegion")
@Log("获取区域")
public ResponseEntity<Object> getRegion() {
return new ResponseEntity<>(schBaseRegionService.list(), HttpStatus.OK);
}
@PutMapping("/changeActives")
@Log("批量修改点位启用状态")
//@SaCheckPermission("store:edit")
public ResponseEntity<Object> 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<Object> queryPoint(@RequestBody List<String> areas) {
return new ResponseEntity<>(schBasePointService.getPoint(areas), HttpStatus.OK);
}
@Log("仓位同步")
@PostMapping("/sync")
public ResponseEntity<Object> sync() {
schBasePointService.sync();
return new ResponseEntity<>(HttpStatus.OK);
}
}

36
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<SchBasePoint> {
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<SchBasePoint> {
/**
* 所属区域
*/
private Long region_id;
private String region_id;
/**
@ -83,7 +82,7 @@ public class SchBasePoint extends Model<SchBasePoint> {
/**
* 物料标识
*/
private Long material_id;
private String material_id;
/**
@ -125,7 +124,7 @@ public class SchBasePoint extends Model<SchBasePoint> {
/**
* 载具数量
*/
private BigDecimal vehicle_qty;
private Integer vehicle_qty;
/**
@ -191,7 +190,7 @@ public class SchBasePoint extends Model<SchBasePoint> {
/**
* 在执行的任务标识
*/
private Long task_id;
private String task_id;
/**
@ -209,7 +208,7 @@ public class SchBasePoint extends Model<SchBasePoint> {
/**
* 来源标识
*/
private Long source_id;
private String source_id;
/**
@ -227,7 +226,7 @@ public class SchBasePoint extends Model<SchBasePoint> {
/**
* 创建人
*/
private Long create_id;
private String create_id;
/**
@ -246,13 +245,13 @@ public class SchBasePoint extends Model<SchBasePoint> {
/**
* 修改人
*/
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<SchBasePoint> {
*/
private String material_code;
@TableField(exist = false)
private List<String> 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;
}

3
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<SchBasePoint> {
List<JSONObject> isBlock(JSONObject whereJson);
IPage<SchBasePoint> selectPageLeftJoin(IPage<SchBasePoint> pages, SchBasePointQuery whereJson);
}

193
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>
<select id="queryLikeOrderRow" resultType="com.alibaba.fastjson.JSONObject">
SELECT
max(point.row_num) AS row_num
max(point.row_num) AS row_num
FROM
sch_base_point point
LEFT JOIN pdm_bi_subpackagerelation sub ON sub.package_box_sn = point.vehicle_code
sch_base_point point
LEFT JOIN pdm_bi_subpackagerelation sub ON sub.package_box_sn = point.vehicle_code
WHERE
point.is_used = '1'
AND point.is_delete = '0'
point.is_used = '1'
AND point.is_delete = '0'
<if test="region_id != null and region_id != ''">
AND point.region_id= #{region_id}
@ -52,47 +52,47 @@
<select id="queryNewRow" resultType="com.alibaba.fastjson.JSONObject">
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'
<if test="region_id != null and region_id != ''">
AND po.region_id= #{region_id}
</if>
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, '' ) != ''
<if test="region_id != null and region_id != ''">
AND po2.region_id= #{region_id}
</if>
GROUP BY
po2.row_num
) b
WHERE
b.row_num = a.row_num
)
po.is_delete = '0'
AND is_used = '1'
<if test="region_id != null and region_id != ''">
AND po.region_id= #{region_id}
</if>
GROUP BY
po.row_num
) a
WHERE
NOT EXISTS (
SELECT
*
FROM
(
SELECT
row_num
FROM
sch_base_point po2
WHERE
IFNULL( po2.vehicle_code, '' ) != ''
<if test="region_id != null and region_id != ''">
AND po2.region_id= #{region_id}
</if>
GROUP BY
po2.row_num
) b
WHERE
b.row_num = a.row_num
)
ORDER BY row_num ASC
@ -100,51 +100,82 @@
<select id="isBlock" resultType="com.alibaba.fastjson.JSONObject">
SELECT
point2.*
point2.*
FROM
sch_base_point point1
LEFT JOIN sch_base_point point2 ON point1.row_num = point2.row_num
sch_base_point point1
LEFT JOIN sch_base_point point2 ON point1.row_num = point2.row_num
WHERE
IFNULL( point2.vehicle_code, '' ) != ''
AND point1.out_order_seq > point2.out_order_seq
IFNULL( point2.vehicle_code, '' ) != ''
AND point1.out_order_seq > point2.out_order_seq
<if test="point_code != null and point_code != ''">
AND point1.point_code= #{point_code}
</if>
<if test="point_code != null and point_code != ''">
AND point1.point_code= #{point_code}
</if>
<if test="region_id != null and region_id != ''">
AND point2.region_id= #{region_id}
</if>
<if test="region_id != null and region_id != ''">
AND point2.region_id= #{region_id}
</if>
UNION
SELECT
point2.*
point2.*
FROM
sch_base_point point1
LEFT JOIN sch_base_point point2 ON point1.row_num = point2.row_num
sch_base_point point1
LEFT JOIN sch_base_point point2 ON point1.row_num = point2.row_num
WHERE
IFNULL( point2.vehicle_code, '' ) = ''
AND point1.out_order_seq > point2.out_order_seq
IFNULL( point2.vehicle_code, '' ) = ''
AND point1.out_order_seq > point2.out_order_seq
<if test="point_code != null and point_code != ''">
AND point1.point_code= #{point_code}
</if>
<if test="point_code != null and point_code != ''">
AND point1.point_code= #{point_code}
</if>
<if test="region_id != null and region_id != ''">
AND point2.region_id= #{region_id}
</if>
<if test="region_id != null and region_id != ''">
AND point2.region_id= #{region_id}
</if>
AND EXISTS (
SELECT
*
FROM
sch_base_task
WHERE
( point_code1 = point2.point_code OR point_code2 = point2.point_code )
AND '07' > task_status
AND is_delete = '0'
)
AND EXISTS (
SELECT
*
FROM
sch_base_task
WHERE
( point_code1 = point2.point_code OR point_code2 = point2.point_code )
AND '07' > task_status
AND is_delete = '0'
)
</select>
<select id="selectPageLeftJoin" resultType="org.nl.b_lms.sch.point.dao.SchBasePoint"
parameterType="org.nl.b_lms.sch.point.dto.SchBasePointQuery">
SELECT
point.*
FROM
sch_base_point point
LEFT JOIN SCH_BASE_Region region ON point.region_id = region.region_id
WHERE
point.is_delete = '0'
<if test="whereJson.region_id != null">
AND point.region_id = #{whereJson.region_id}
</if>
<if test="whereJson.point_type != null">
AND point.point_type = #{whereJson.point_type}
</if>
<if test="whereJson.lock_type != null">
AND point.lock_type = #{whereJson.lock_type}
</if>
<if test="whereJson.point_status != null">
AND point.point_status = #{whereJson.point_status}
</if>
<if test="whereJson.lock_type == '00'">
AND (point.vehicle_code is null or point.vehicle_code = '')
</if>
<if test="whereJson.is_used != null">
AND point.is_used = #{whereJson.is_used}
</if>
<if test="whereJson.name != null">
AND ( point.point_code like "%" 输入.name "%" or point.point_name like "%" 输入.name "%" )
</if>
</select>
</mapper>

18
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;
}

19
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<SchBasePoint> {
* @param pageable 分页参数
* @return IPage<SchBasePoint>
*/
IPage<SchBasePoint> queryAll(Map whereJson, PageQuery pageable);
IPage<SchBasePoint> queryAll(SchBasePointQuery whereJson, PageQuery pageable);
/**
@ -43,6 +48,18 @@ public interface IschBasePointService extends IService<SchBasePoint> {
void deleteAll(Set<String> ids);
/**
* 修改点位启用状态
* @param json
*/
void changeActive(JSONObject json);
List<SchBasePoint> getPoint(List<String> areas);
/**
* 仓位同步
*/
void sync();
}

170
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<SchBasePointMapper, Sch
@Resource
private SchBasePointMapper schBasePointMapper;
@Autowired
private SchBaseRegionMapper regionMapper;
@Autowired
private StructattrService structattrService;
/**
@ -36,9 +57,31 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
* @param page 分页参数
*/
@Override
public IPage<SchBasePoint> queryAll(Map whereJson, PageQuery page) {
return schBasePointMapper.selectPage(new Page<>(page.getPage() + 1, page.getSize()), new QueryWrapper<SchBasePoint>()
.lambda());
public IPage<SchBasePoint> queryAll(SchBasePointQuery whereJson, PageQuery page) {
IPage<SchBasePoint> 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<SchBasePointMapper, Sch
*/
@Override
public void update(SchBasePoint entity) {
// SchBasePoint dto = schBasePointMapper.selectById(entity.getId);
// if (dto == null) {
// throw new BadRequestException("不存在该数据!");
// }
SchBasePoint dto = schBasePointMapper.selectById(entity.getPoint_id());
if (dto == null) {
throw new BadRequestException("不存在该数据!");
}
String pointStatus = dto.getPoint_status();
if (ObjectUtil.isNotEmpty(pointStatus) && "1".equals(pointStatus)) {
entity.setMaterial_id("");
entity.setVehicle_type("");
entity.setVehicle_code("");
entity.setVehicle_qty(0);
}
schBasePointMapper.updateById(getBasicInfo(entity, false));
}
@ -79,6 +129,88 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
schBasePointMapper.deleteBatchIds(ids);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void changeActive(JSONObject json) {
//如果是仓位点位,更新状态前,先去查询仓位点位所对应的库区是否启用,如果禁用抛出异常
String structCode = json.getString("point_code");
String pointType = json.getString("point_type");
String isUsed = json.getString("is_used");
// todo: 未修改mp
if ("01".equals(pointType)) {
JSONObject st_ivt_bsRealStorAttr = WQLObject.getWQLObject("ST_IVT_StructAttr").query(" struct_code = '" + structCode + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(st_ivt_bsRealStorAttr)) {
String sect_id = st_ivt_bsRealStorAttr.getString("sect_id");
JSONObject st_ivt_sectAttr = WQLObject.getWQLObject("ST_IVT_SectAttr").query(" sect_id = '" + sect_id + "' and is_used = '1'").uniqueResult(0);
if (ObjectUtil.isEmpty(st_ivt_sectAttr)) {
throw new BadRequestException("启用失败,请检查仓位点位所属库区是否启用!");
}
}
}
LambdaUpdateWrapper<SchBasePoint> 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<SchBasePoint> getPoint(List<String> areas) {
LambdaQueryWrapper<SchBasePoint> lam = new QueryWrapper<SchBasePoint>().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<SchBasePoint>()
.eq(SchBasePoint::getPoint_type, "2"));
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
List<PointToStructattrDto> structattrDtos = structattrService.getAllPointToShippingSpace();
List<SchBasePoint> 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<SchBasePointMapper, Sch
* @param isCreate 是否创建
*/
private SchBasePoint getBasicInfo(SchBasePoint entity, boolean isCreate) {
// if (isCreate) {
// entity.setCreate_id(Long.valueOf(SecurityUtils.getCurrentUserId()));
// entity.setCreate_name(SecurityUtils.getCurrentNickName());
// entity.setCreate_time(DateUtil.now());
// }
// entity.setUpdate_optid(Long.valueOf(SecurityUtils.getCurrentUserId()));
// entity.setUpdate_optname(SecurityUtils.getCurrentNickName());
// entity.setUpdate_time(DateUtil.now());
if (isCreate) {
entity.setPoint_id(IdUtil.getSnowflake(1,1).nextIdStr());
entity.setCreate_id(SecurityUtils.getCurrentUserId());
entity.setCreate_name(SecurityUtils.getCurrentNickName());
entity.setCreate_time(DateUtil.now());
}
entity.setUpdate_id(SecurityUtils.getCurrentUserId());
entity.setUpdate_name(SecurityUtils.getCurrentNickName());
entity.setUpdate_time(DateUtil.now());
SchBaseRegion regionDto = regionMapper.selectById(entity.getRegion_id());
entity.setRegion_code(regionDto.getRegion_code());
entity.setRegion_name(regionDto.getRegion_name());
return entity;
}

2
lms/nladmin-system/src/main/java/org/nl/b_lms/sch/region/dao/SchBaseRegion.java

@ -31,7 +31,7 @@ public class SchBaseRegion extends Model<SchBaseRegion> {
* 区域标识
*/
@TableId(value = "region_id", type = IdType.NONE)
private Long region_id;
private String region_id;
/**

4
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
*/

7
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<Structattr> {
* @return Map<String, Object>
*/
IPage<Structattr> twoVehicleIvt(Map whereJson, Pageable page);
/**
* 获取仓位数据提供给点位表
* @return /
*/
List<PointToStructattrDto> getAllPointToShippingSpace();
}

3
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<Structattr> {
* @return
*/
JSONArray queryAll(@Param("struct_id")String struct_id);
List<PointToStructattrDto> getAllPointToShippingSpace();
}

9
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}
</select>
<select id="getAllPointToShippingSpace"
resultType="org.nl.wms.basedata.st.structattr.service.dto.PointToStructattrDto">
SELECT struct.*,
region.region_id
FROM ST_IVT_StructAttr struct
left join
SCH_BASE_Region region on struct.sect_id = region.region_id
WHERE struct.is_delete = '0'
</select>
</mapper>

15
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;
}

6
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<StructattrMapper, Structa
return structattrIPage;
}
@Override
public List<PointToStructattrDto> getAllPointToShippingSpace() {
return structattrMapper.getAllPointToShippingSpace ();
}
}

28
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);
}
}

3
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<Object> getRegion() {
return new ResponseEntity<>(pointService.getRegion(), HttpStatus.OK);
}

36
lms/nladmin-ui/src/views/wms/sch/point/index.vue

@ -292,7 +292,9 @@
<el-input v-model="form.vehicle_code" clearable style="width: 370px;"/>
</el-form-item>
<el-form-item label="载具数量" prop="vehicle_qty">
<el-input-number v-model="form.vehicle_qty" :precision="0" :controls="false" :min="0" style="width: 370px;"/>
<el-input-number v-model="form.vehicle_qty" :precision="0" :controls="false" :min="0"
style="width: 370px;"
/>
</el-form-item>
<el-form-item label="物料批次" prop="material_code">
<el-input v-model="form.material_code" clearable style="width: 370px;"/>
@ -322,17 +324,25 @@
<el-table-column prop="region_name" label="区域名称" min-width="120" show-overflow-tooltip/>
<el-table-column prop="point_type_name" label="点位类型"/>
<el-table-column prop="point_status_name" label="点位状态"/>
<el-table-column prop="lock_type_name" label="锁定类型"/>
<el-table-column prop="lock_type" label="锁定类型">
<template slot-scope="scope">
{{ dict.label.d_lock_type[scope.row.lock_type] }}
</template>
</el-table-column>
<!-- <el-table-column prop="vehicle_type" label="载具类型" min-width="120">
<template slot-scope="scope">
{{ dict.label.vehicle_type[scope.row.vehicle_type] }}
</template>
</el-table-column>-->
<el-table-column prop="vehicle_code" label="载具编码"
:min-width="flexWidth('vehicle_code',crud.data,'载具编码')"
<el-table-column
prop="vehicle_code"
label="载具编码"
:min-width="flexWidth('vehicle_code',crud.data,'载具编码')"
/>
<el-table-column prop="material_code" label="物料批次"
:min-width="flexWidth('material_code',crud.data,'物料批次')"
<el-table-column
prop="material_code"
label="物料批次"
:min-width="flexWidth('material_code',crud.data,'物料批次')"
/>
<el-table-column prop="vehicle_qty" label="载具数量"/>
<el-table-column prop="product_area" label="生产区域"/>
@ -342,7 +352,7 @@
{{ scope.row.is_used == '1' ? '是' : '否' }}
</template>
</el-table-column>
<el-table-column prop="update_optname" label="修改人"/>
<el-table-column prop="update_name" label="修改人"/>
<el-table-column prop="update_time" label="修改时间" width="150"/>
<el-table-column
v-permission="[]"
@ -453,13 +463,17 @@ export default {
}
},
created() {
crudPoint.getRegion().then(res => {
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

Loading…
Cancel
Save