add:增加子卷装箱页面功能。
This commit is contained in:
@@ -3,6 +3,7 @@ package org.nl.b_lms.pdm.subpackagerelation.controller;
|
||||
import java.util.Set;
|
||||
import java.util.Map;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -48,6 +49,31 @@ public class PdmBiSubpackagerelationController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询订单装箱信息
|
||||
*
|
||||
* @param whereJson 查询条件
|
||||
* @param page 分页参数
|
||||
*/
|
||||
@GetMapping("/queryContainerization")
|
||||
@Log("查询订单装箱信息")
|
||||
public ResponseEntity<Object> queryContainerization(@RequestParam Map whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(pdmBiSubpackagerelationService.queryContainerization(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据订单号查询子卷信息
|
||||
*
|
||||
* @param whereJson 查询条件
|
||||
*/
|
||||
@GetMapping("/queryContainerNameBySaleOrder")
|
||||
@Log("查询订单装箱信息")
|
||||
public ResponseEntity<Object> queryContainerNameBySaleOrder(@RequestParam Map whereJson) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(pdmBiSubpackagerelationService.queryContainerNameBySaleOrder(whereJson)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
@@ -76,6 +102,14 @@ public class PdmBiSubpackagerelationController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/updateEntityList")
|
||||
@Log("子卷分配木箱规格")
|
||||
//@SaCheckPermission("@el.check(updateEntityList)")
|
||||
public ResponseEntity<Object> updateEntityList(@RequestBody JSONObject whereJson) {
|
||||
pdmBiSubpackagerelationService.updateEntityList(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.nl.b_lms.pdm.subpackagerelation.dao;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
import jdk.nashorn.internal.ir.annotations.Ignore;
|
||||
import lombok.*;
|
||||
import lombok.Data;
|
||||
import lombok.Builder;
|
||||
@@ -20,11 +21,7 @@ import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
* @since 2024-02-01
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@ToString
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@SuppressWarnings("serial")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("pdm_bi_subpackagerelation")
|
||||
public class PdmBiSubpackagerelation extends Model<PdmBiSubpackagerelation> {
|
||||
|
||||
@@ -36,7 +33,7 @@ public class PdmBiSubpackagerelation extends Model<PdmBiSubpackagerelation> {
|
||||
* 子卷包装标识
|
||||
*/
|
||||
@TableId(value = "workorder_id", type = IdType.NONE)
|
||||
private Long workorder_id;
|
||||
private String workorder_id;
|
||||
|
||||
|
||||
/**
|
||||
@@ -186,7 +183,6 @@ public class PdmBiSubpackagerelation extends Model<PdmBiSubpackagerelation> {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private String create_time;
|
||||
|
||||
|
||||
@@ -309,6 +305,11 @@ public class PdmBiSubpackagerelation extends Model<PdmBiSubpackagerelation> {
|
||||
*/
|
||||
private String ext_code;
|
||||
|
||||
/**
|
||||
* 木箱组
|
||||
*/
|
||||
private String box_group;
|
||||
|
||||
|
||||
/**
|
||||
* 获取主键值
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
package org.nl.b_lms.pdm.subpackagerelation.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* {@code @Description:} 子卷包装关系表(PdmBiSubpackagerelation)数据持久层
|
||||
* {@code @Author:} gbx
|
||||
@@ -12,4 +17,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
public interface PdmBiSubpackagerelationMapper extends BaseMapper<PdmBiSubpackagerelation> {
|
||||
|
||||
|
||||
List<PdmBiSubpackagerelation> selectGroupedSubPackageRelation(Page<PdmBiSubpackagerelation> page, Map<String, Object> whereJson);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,5 +2,19 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.b_lms.pdm.subpackagerelation.dao.mapper.PdmBiSubpackagerelationMapper">
|
||||
|
||||
<select id="selectGroupedSubPackageRelation" resultType="org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation">
|
||||
SELECT *
|
||||
FROM pdm_bi_subpackagerelation
|
||||
WHERE (sale_order_name, create_time) IN (
|
||||
SELECT sale_order_name, MAX(create_time) AS create_time
|
||||
FROM pdm_bi_subpackagerelation
|
||||
<if test="_parameter.containsKey('customer_name')">
|
||||
WHERE customer_name = #{customer_name}
|
||||
</if>
|
||||
GROUP BY sale_order_name
|
||||
)
|
||||
ORDER BY create_time DESC
|
||||
LIMIT #{page.offset}, #{page.size}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -22,7 +22,7 @@ public class PdmBiSubpackagerelationDto implements Serializable {
|
||||
/**
|
||||
* 子卷包装标识
|
||||
*/
|
||||
private Long workorder_id;
|
||||
private String workorder_id;
|
||||
/**
|
||||
* 木箱唯一码
|
||||
*/
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package org.nl.b_lms.pdm.subpackagerelation.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
|
||||
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.common.domain.query.PageQuery;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
|
||||
/**
|
||||
@@ -29,6 +32,33 @@ public interface IpdmBiSubpackagerelationService extends IService<PdmBiSubpackag
|
||||
IPage<PdmBiSubpackagerelation> queryAll(Map whereJson, PageQuery pageable);
|
||||
|
||||
|
||||
/**
|
||||
* 查询订单装箱信息
|
||||
*
|
||||
* @param whereJson 查询条件
|
||||
* @param pageable 分页参数
|
||||
* @return IPage<PdmBiSubpackagerelation>
|
||||
*/
|
||||
IPage<PdmBiSubpackagerelation> queryContainerization(Map whereJson, PageQuery pageable);
|
||||
|
||||
|
||||
/**
|
||||
* 根据订单号查询子卷信息
|
||||
*
|
||||
* @param whereJson 查询条件
|
||||
* @return List<PdmBiSubpackagerelation>
|
||||
*/
|
||||
List<PdmBiSubpackagerelation> queryContainerNameBySaleOrder(Map whereJson);
|
||||
|
||||
|
||||
/**
|
||||
* 子卷分配木箱规格
|
||||
*
|
||||
* @param whereJson 分配信息
|
||||
*/
|
||||
void updateEntityList(@RequestBody JSONObject whereJson);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
package org.nl.b_lms.pdm.subpackagerelation.service.impl;
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
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.UpdateWrapper;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.dao.mapper.PdmBiSubpackagerelationMapper;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.service.IpdmBiSubpackagerelationService;
|
||||
@@ -13,8 +19,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
@@ -39,11 +46,85 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
*/
|
||||
@Override
|
||||
public IPage<PdmBiSubpackagerelation> queryAll(Map whereJson, PageQuery page) {
|
||||
|
||||
return pdmBiSubpackagerelationMapper.selectPage(new Page<>(page.getPage() + 1, page.getSize()), new QueryWrapper<PdmBiSubpackagerelation>()
|
||||
.lambda());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询订单装箱信息
|
||||
*
|
||||
* @param whereJson 查询条件
|
||||
* @param pageable 分页参数
|
||||
*/
|
||||
@Override
|
||||
public IPage<PdmBiSubpackagerelation> queryContainerization(Map whereJson, PageQuery pageable) {
|
||||
IPage<PdmBiSubpackagerelation> resultPage = new Page<>(pageable.getPage(), pageable.getSize());
|
||||
LambdaQueryWrapper<PdmBiSubpackagerelation> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (whereJson.containsKey("customer_description")) {
|
||||
queryWrapper.like(PdmBiSubpackagerelation::getCustomer_description, whereJson.get("customer_description"));
|
||||
}
|
||||
if (whereJson.containsKey("sale_order_name")) {
|
||||
queryWrapper.like(PdmBiSubpackagerelation::getSale_order_name, whereJson.get("sale_order_name"));
|
||||
}
|
||||
if (whereJson.containsKey("customer_name")) {
|
||||
queryWrapper.like(PdmBiSubpackagerelation::getCustomer_name, whereJson.get("customer_name"));
|
||||
}
|
||||
if (whereJson.containsKey("status")) {
|
||||
if ("99".equals(whereJson.get("status"))) {
|
||||
queryWrapper.eq(PdmBiSubpackagerelation::getStatus, whereJson.get("status"));
|
||||
} else {
|
||||
queryWrapper.lt(PdmBiSubpackagerelation::getStatus, "99");
|
||||
}
|
||||
}
|
||||
queryWrapper.groupBy(PdmBiSubpackagerelation::getSale_order_name)
|
||||
.orderByDesc(PdmBiSubpackagerelation::getCreate_time);
|
||||
return pdmBiSubpackagerelationMapper.selectPage(resultPage, queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据订单号查询子卷信息
|
||||
*
|
||||
* @param whereJson 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<PdmBiSubpackagerelation> queryContainerNameBySaleOrder(Map whereJson) {
|
||||
LambdaQueryWrapper<PdmBiSubpackagerelation> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (whereJson.containsKey("customer_description")) {
|
||||
queryWrapper.like(PdmBiSubpackagerelation::getCustomer_description, whereJson.get("customer_description"));
|
||||
}
|
||||
if (whereJson.containsKey("sale_order_name")) {
|
||||
queryWrapper.eq(PdmBiSubpackagerelation::getSale_order_name, whereJson.get("sale_order_name"));
|
||||
}
|
||||
if (whereJson.containsKey("customer_name")) {
|
||||
queryWrapper.like(PdmBiSubpackagerelation::getCustomer_name, whereJson.get("customer_name"));
|
||||
}
|
||||
if (whereJson.containsKey("status")) {
|
||||
if ("99".equals(whereJson.get("status"))) {
|
||||
queryWrapper.eq(PdmBiSubpackagerelation::getStatus, whereJson.get("status"));
|
||||
} else {
|
||||
queryWrapper.ge(PdmBiSubpackagerelation::getStatus, whereJson.get("status"));
|
||||
}
|
||||
}
|
||||
queryWrapper.orderByDesc(PdmBiSubpackagerelation::getBox_group);
|
||||
List<PdmBiSubpackagerelation> pdmBiSubpackagerelationList = pdmBiSubpackagerelationMapper.selectList(queryWrapper);
|
||||
Map<String, Long> countByGroup = pdmBiSubpackagerelationList.stream()
|
||||
.filter(item -> item.getBox_group() != null)
|
||||
.collect(Collectors.groupingBy(PdmBiSubpackagerelation::getBox_group, Collectors.counting()));
|
||||
pdmBiSubpackagerelationList.forEach(item -> {
|
||||
if (item.getBox_group() != null) {
|
||||
item.setQuanlity_in_box(BigDecimal.valueOf(countByGroup.getOrDefault(item.getBox_group(), null)));
|
||||
} else {
|
||||
item.setQuanlity_in_box(BigDecimal.ZERO);
|
||||
item.setBox_group("0");
|
||||
}
|
||||
});
|
||||
return pdmBiSubpackagerelationList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
@@ -69,6 +150,36 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
pdmBiSubpackagerelationMapper.updateById(getBasicInfo(entity, false));
|
||||
}
|
||||
|
||||
/**
|
||||
* 子卷分配木箱规格
|
||||
*
|
||||
* @param whereJson 分配信息
|
||||
*/
|
||||
@Override
|
||||
public void updateEntityList(JSONObject whereJson) {
|
||||
List<String> entityList = JSONObject.parseArray(whereJson.getJSONArray("tableMater").toJSONString(), PdmBiSubpackagerelation.class).stream()
|
||||
.map(PdmBiSubpackagerelation::getWorkorder_id)
|
||||
.map(String::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
;
|
||||
if (entityList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
List<PdmBiSubpackagerelation> pdmBiSubpackagerelationList = pdmBiSubpackagerelationMapper
|
||||
.selectList(new LambdaQueryWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getSale_order_name, whereJson.getString("sale_order_name")));
|
||||
Integer maxBoxGroup = pdmBiSubpackagerelationList.stream()
|
||||
.map(PdmBiSubpackagerelation::getBox_group)
|
||||
.filter(Objects::nonNull)
|
||||
.map(Integer::parseInt)
|
||||
.max(Integer::compareTo)
|
||||
.orElse(0) + 1;
|
||||
UpdateWrapper<PdmBiSubpackagerelation> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.set("box_type", whereJson.getString("checked"));
|
||||
updateWrapper.set("box_group", maxBoxGroup);
|
||||
updateWrapper.in("workorder_id", entityList);
|
||||
pdmBiSubpackagerelationMapper.update(null, updateWrapper);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
@@ -89,11 +200,11 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
* @param isCreate 是否创建
|
||||
*/
|
||||
private PdmBiSubpackagerelation getBasicInfo(PdmBiSubpackagerelation entity, boolean isCreate) {
|
||||
if (isCreate) {
|
||||
entity.setCreate_id(Long.valueOf(SecurityUtils.getCurrentUserId()));
|
||||
entity.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
entity.setCreate_time(DateUtil.now());
|
||||
}
|
||||
if (isCreate) {
|
||||
entity.setCreate_id(Long.valueOf(SecurityUtils.getCurrentUserId()));
|
||||
entity.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
entity.setCreate_time(DateUtil.now());
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user