rev:PC组盘
This commit is contained in:
@@ -65,8 +65,7 @@ public class GroupController {
|
||||
@PostMapping("/checkVehicle")
|
||||
@Log("校验载具")
|
||||
public ResponseEntity<Object> checkVehicle(@RequestBody JSONObject whereJson) {
|
||||
iMdPbGroupplateService.checkVehicle(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
return new ResponseEntity<>(iMdPbGroupplateService.checkVehicle(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/querySupp")
|
||||
@@ -82,13 +81,6 @@ public class GroupController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/copySave")
|
||||
@Log("复制新增")
|
||||
public ResponseEntity<Object> copySave(@RequestBody GroupPlate dto) {
|
||||
iMdPbGroupplateService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/printDelete")
|
||||
@Log("打印物料标签后删除")
|
||||
public ResponseEntity<Object> printDelete(@RequestBody GroupPlate dto) {
|
||||
|
||||
@@ -20,40 +20,46 @@ import java.util.Set;
|
||||
public interface IMdMeMaterialbaseService extends IService<MdMeMaterialbase> {
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param whereJson : {查询参数}
|
||||
* @param pageable : 分页对象
|
||||
* @param pageable : 分页对象
|
||||
* @return 返回结果
|
||||
*/
|
||||
IPage<MdMeMaterialbase> queryAll(Map whereJson, PageQuery pageable);
|
||||
IPage<JSONObject> queryAll(Map whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 新增物料
|
||||
*
|
||||
* @param dto 物料实体类
|
||||
*/
|
||||
void create(MdMeMaterialbase dto);
|
||||
|
||||
/**
|
||||
* 修改物料
|
||||
*
|
||||
* @param dto 物料实体类
|
||||
*/
|
||||
void update(MdMeMaterialbase dto);
|
||||
|
||||
/**
|
||||
* 删除物料
|
||||
*
|
||||
* @param ids 物料标识集合
|
||||
*/
|
||||
void delete(Set<String> ids);
|
||||
|
||||
/**
|
||||
* 物料同步
|
||||
*
|
||||
* @param whereJson {
|
||||
* --
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
void materialSync(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 根据编码获取物料
|
||||
*
|
||||
* @param material_code 物料编码
|
||||
* @return 返回结果
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
package org.nl.wms.basedata_manage.service.dao.mapper;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 物料基本信息表 Mapper 接口
|
||||
@@ -13,4 +19,12 @@ import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
|
||||
*/
|
||||
public interface MdMeMaterialbaseMapper extends BaseMapper<MdMeMaterialbase> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页条件
|
||||
* @param whereJson 查询条件
|
||||
* @return IPage<JSONObject>
|
||||
*/
|
||||
IPage<JSONObject> queryAllByPage(Page<JSONObject> page, @Param("param") Map whereJson);
|
||||
}
|
||||
|
||||
@@ -2,4 +2,22 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.basedata_manage.service.dao.mapper.MdMeMaterialbaseMapper">
|
||||
|
||||
<select id="queryAllByPage" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
mater.*,
|
||||
class.class_name
|
||||
FROM
|
||||
md_me_materialbase mater
|
||||
LEFT JOIN md_pb_classstandard class ON class.class_id = mater.material_type_id
|
||||
<where>
|
||||
1 = 1
|
||||
<if test="param.search != null and param.search != ''">
|
||||
AND
|
||||
(mater.material_code LIKE #{param.search} or
|
||||
mater.material_name LIKE #{param.search})
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY mater.update_time Desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package org.nl.wms.basedata_manage.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
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.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -37,20 +35,9 @@ import java.util.stream.Collectors;
|
||||
public class MdMeMaterialbaseServiceImpl extends ServiceImpl<MdMeMaterialbaseMapper, MdMeMaterialbase> implements IMdMeMaterialbaseService {
|
||||
|
||||
@Override
|
||||
public IPage<MdMeMaterialbase> queryAll(Map whereJson, PageQuery page) {
|
||||
// 查询条件
|
||||
LambdaQueryWrapper<MdMeMaterialbase> queryWrapper = new QueryWrapper<MdMeMaterialbase>().lambda();
|
||||
String search = MapUtil.getStr(whereJson, "search");
|
||||
|
||||
if (ObjectUtil.isNotEmpty(search)) {
|
||||
queryWrapper.likeRight(MdMeMaterialbase::getMaterial_code, search)
|
||||
.or(item -> item.likeRight(MdMeMaterialbase::getMaterial_name, search));
|
||||
}
|
||||
queryWrapper.orderByDesc(MdMeMaterialbase::getUpdate_time);
|
||||
|
||||
return this.baseMapper.selectPage(new Page<>(page.getPage() + 1, page.getSize()),
|
||||
queryWrapper
|
||||
);
|
||||
public IPage<JSONObject> queryAll(Map whereJson, PageQuery page) {
|
||||
return this.baseMapper.queryAllByPage(new Page<>(page.getPage() + 1, page.getSize()),
|
||||
whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -62,7 +62,7 @@ public interface IMdPbGroupplateService extends IService<GroupPlate> {
|
||||
* storagevehicle_code
|
||||
* }
|
||||
*/
|
||||
void checkVehicle(JSONObject whereJson);
|
||||
List<JSONObject> checkVehicle(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 获取供应商信息
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package org.nl.wms.warehouse_management.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
@@ -87,4 +89,11 @@ public class GroupPlate implements Serializable {
|
||||
* 组盘时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 袋明细
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<GroupPlate> tableData;
|
||||
|
||||
}
|
||||
|
||||
@@ -93,6 +93,11 @@ public class IOStorInvDis implements Serializable {
|
||||
*/
|
||||
private String storagevehicle_code;
|
||||
|
||||
/**
|
||||
* 袋码
|
||||
*/
|
||||
private String bag_code;
|
||||
|
||||
/**
|
||||
* 是否已下发
|
||||
*/
|
||||
|
||||
@@ -38,13 +38,13 @@ public interface MdPbGroupplateMapper extends BaseMapper<GroupPlate> {
|
||||
IPage<JSONObject> queryAllByPage(Page<JSONObject> page, @Param("param") Map whereJson);
|
||||
|
||||
/**
|
||||
* 手持小料箱公共查询
|
||||
* 根据载具编码公共查询
|
||||
* @param whereJson {
|
||||
* storagevehicle_code: 载具编码
|
||||
* vahicle_code: 载具编码
|
||||
* }
|
||||
* @return List<JSONObject>
|
||||
*/
|
||||
List<JSONObject> pdaQueryGroupInfo(@Param("param") JSONObject whereJson);
|
||||
List<JSONObject> queryVehicleGroupInfo(@Param("param") JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 手持通用功能公共查询
|
||||
|
||||
@@ -50,6 +50,11 @@
|
||||
late.vehicle_code LIKE #{param.storagevehicle_code}
|
||||
</if>
|
||||
|
||||
<if test="param.bag_code != null and param.bag_code != ''">
|
||||
AND
|
||||
late.bag_code LIKE #{param.bag_code}
|
||||
</if>
|
||||
|
||||
<if test="param.status != null and param.status != ''">
|
||||
AND
|
||||
late.status = #{param.status}
|
||||
@@ -58,25 +63,24 @@
|
||||
ORDER BY late.create_time Desc
|
||||
</select>
|
||||
|
||||
<select id="pdaQueryGroupInfo" resultType="com.alibaba.fastjson.JSONObject">
|
||||
<select id="queryVehicleGroupInfo" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
late.*,
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
mater.material_spec,
|
||||
mater.material_model,
|
||||
mater.quality_time AS quality_time_day,
|
||||
supp.supp_name
|
||||
FROM
|
||||
md_pb_groupplate late
|
||||
INNER JOIN md_me_materialbase mater ON mater.material_id = late.material_id
|
||||
INNER JOIN md_cs_supplierbase supp ON supp.supp_code = late.supp_code
|
||||
<where>
|
||||
late.status = '1'
|
||||
1 = 1
|
||||
|
||||
<if test="param.storagevehicle_code != null and param.storagevehicle_code != ''">
|
||||
<if test="param.vehicle_code != null and param.vehicle_code != ''">
|
||||
AND
|
||||
late.storagevehicle_code = #{param.storagevehicle_code}
|
||||
late.vehicle_code = #{param.vehicle_code}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -77,32 +78,53 @@ public class MdPbGroupplateServiceImpl extends ServiceImpl<MdPbGroupplateMapper,
|
||||
@Override
|
||||
@Transactional
|
||||
public void create(GroupPlate dto) {
|
||||
// 校验载具信息
|
||||
MdPbStoragevehicleinfo vehicleDao = iMdPbStoragevehicleinfoService.getByCode(dto.getVehicle_code());
|
||||
if (ObjectUtil.isEmpty(vehicleDao.getWeigth())) {
|
||||
throw new BadRequestException("请先维护载具重量信息!");
|
||||
}
|
||||
// 校验是组盘还是组袋
|
||||
List<GroupPlate> tableData = dto.getTableData();
|
||||
if (ObjectUtil.isEmpty(tableData)) {
|
||||
// 组袋
|
||||
dto.setGroup_id(IdUtil.getStringId());
|
||||
// 计量单位默认重量KG
|
||||
MdPbMeasureunit unitDao = iMdPbMeasureunitService.getByCode("KG");
|
||||
dto.setQty_unit_id(unitDao.getMeasure_unit_id());
|
||||
dto.setQty_unit_name(unitDao.getUnit_name());
|
||||
// 状态默认组盘
|
||||
dto.setStatus(IOSEnum.GROUP_PLATE_STATUS.code("生成"));
|
||||
dto.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
dto.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
dto.setCreate_time(DateUtil.now());
|
||||
this.save(dto);
|
||||
} else {
|
||||
// 组盘
|
||||
String vehicle_code = dto.getVehicle_code();
|
||||
if (ObjectUtil.isEmpty(vehicle_code)) {
|
||||
throw new BadRequestException("托盘不能为空");
|
||||
}
|
||||
|
||||
// 校验此载具是否已经组盘
|
||||
List<GroupPlate> groupList = this.list(
|
||||
new QueryWrapper<GroupPlate>().lambda()
|
||||
.eq(GroupPlate::getVehicle_code, dto.getVehicle_code())
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(groupList)) {
|
||||
throw new BadRequestException("当前载具已经组盘【" + dto.getVehicle_code() + "】");
|
||||
}
|
||||
// 校验原料组盘时必须物料相同
|
||||
boolean is_yl = tableData.stream()
|
||||
.anyMatch(row -> row.getBag_code().contains("YL"));
|
||||
if (is_yl) {
|
||||
GroupPlate groupPlate = tableData.get(0);
|
||||
boolean is_like = tableData.stream()
|
||||
.allMatch(row -> row.getMaterial_id().equals(groupPlate.getMaterial_id()));
|
||||
}
|
||||
if (!is_yl) {
|
||||
throw new BadRequestException("原料组盘物料必须相同!");
|
||||
}
|
||||
|
||||
dto.setGroup_id(IdUtil.getStringId());
|
||||
// 计量单位默认重量KG
|
||||
MdPbMeasureunit unitDao = iMdPbMeasureunitService.getByCode("KG");
|
||||
dto.setQty_unit_id(unitDao.getMeasure_unit_id());
|
||||
dto.setQty_unit_name(unitDao.getUnit_name());
|
||||
// 状态默认组盘
|
||||
dto.setStatus(IOSEnum.GROUP_PLATE_STATUS.code("组盘"));
|
||||
dto.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
dto.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
dto.setCreate_time(DateUtil.now());
|
||||
this.save(dto);
|
||||
List<GroupPlate> createList = tableData.stream()
|
||||
.filter(row -> row.getStatus().equals(IOSEnum.GROUP_PLATE_STATUS.code("生成")))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (GroupPlate dao : createList) {
|
||||
dao.setStatus(IOSEnum.GROUP_PLATE_STATUS.code("组盘"));
|
||||
dao.setVehicle_code(vehicle_code);
|
||||
dao.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
dao.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
dao.setCreate_time(DateUtil.now());
|
||||
}
|
||||
this.updateBatchById(createList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -117,11 +139,21 @@ public class MdPbGroupplateServiceImpl extends ServiceImpl<MdPbGroupplateMapper,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkVehicle(JSONObject whereJson) {
|
||||
MdPbStoragevehicleinfo vehicleDao = iMdPbStoragevehicleinfoService.getByCode(whereJson.getString("storagevehicle_code"));
|
||||
public List<JSONObject> checkVehicle(JSONObject whereJson) {
|
||||
MdPbStoragevehicleinfo vehicleDao = iMdPbStoragevehicleinfoService.getByCode(whereJson.getString("vehicle_code"));
|
||||
if (ObjectUtil.isEmpty(vehicleDao)) {
|
||||
throw new BadRequestException("此载具不存在【" + whereJson.getString("storagevehicle_code") + "】");
|
||||
throw new BadRequestException("此载具不存在【" + whereJson.getString("vehicle_code") + "】");
|
||||
}
|
||||
// 校验此载具下的组盘信息是否有入库或者出库的信息
|
||||
List<JSONObject> groupList = this.baseMapper.queryVehicleGroupInfo(whereJson);
|
||||
boolean is_all = groupList.stream()
|
||||
.allMatch(row -> row.getString("status").equals(IOSEnum.GROUP_PLATE_STATUS.code("生成"))
|
||||
|| row.getString("status").equals(IOSEnum.GROUP_PLATE_STATUS.code("组盘"))
|
||||
);
|
||||
if (!is_all) {
|
||||
throw new BadRequestException("当前载具【" + whereJson.getString("vehicle_code") + "】已经入库");
|
||||
}
|
||||
return groupList;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user