Browse Source

1.仓库分拣功能提交

dev-warehouse
zhenghaoyu 2 years ago
parent
commit
1130b768ad
  1. 2
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataTrayClient.java
  2. 4
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockArticleEntity.java
  3. 2
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseWayBillDetail.java
  4. 4
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseWaybillEntity.java
  5. 2
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseTrayTypeVO.java
  6. 18
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataTrayClient.java
  7. 206
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseTrayTypeApiController.java
  8. 2
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/TrayTypeDTO.java
  9. 2
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.java
  10. 11
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.xml
  11. 5
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayTypeMapper.java
  12. 14
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayTypeMapper.xml
  13. 6
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseTrayGoodsService.java
  14. 13
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseTrayTypeService.java
  15. 25
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayGoodsServiceImpl.java
  16. 161
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java
  17. 2
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/wrapper/WarehouseTrayTypeWrapper.java

2
blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataTrayClient.java

@ -54,4 +54,6 @@ public interface IBasicdataTrayClient {
@GetMapping(API_PREFIX+"/getTrayByTrayCode")
BasicdataTrayEntity getTrayByTrayCode(@RequestParam("trayCode") String trayCode);
void updateTrayStatus(@RequestParam("trayId") Long trayId, @RequestParam("trayStatus") int trayStatus);
}

4
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockArticleEntity.java

@ -248,7 +248,7 @@ public class DistributionStockArticleEntity extends TenantEntity {
* 运单号
*/
@ApiModelProperty(value = "运单号")
private String waybillNumber;
private String waybillCode;
/**
* 收货单位
*/
@ -430,7 +430,7 @@ public class DistributionStockArticleEntity extends TenantEntity {
@ApiModelProperty(value = "工厂车次")
private String factoryTrain;
private String isZero;//是否零担 0否 1是

2
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseWayBillDetail.java

@ -13,7 +13,7 @@ public class WarehouseWayBillDetail extends BaseEntity {
/** 运单号 */
@ApiModelProperty(name = "运单号",notes = "")
private String waybillNo;
private String waybillCode;
/** 运单号id */
@ApiModelProperty(name = "运单id",notes = "")

4
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseWaybillEntity.java

@ -43,12 +43,12 @@ public class WarehouseWaybillEntity extends TenantEntity {
* 运单号
*/
@ApiModelProperty(value = "运单号")
private String waybillNo;
private String waybillCode;
/**
* 订单自编号
*/
@ApiModelProperty(value = "订单自编号")
private String orderNo;
private String orderCode;
/**
* 目的仓
*/

2
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseTrayTypeVO.java

@ -8,8 +8,6 @@ import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
public class WarehouseTrayTypeVO extends WarehouseTrayTypeEntity {
private Integer orderTotalNum;//所有订单总件数
private String trayTypeName;
}

18
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataTrayClient.java

@ -17,6 +17,7 @@
package com.logpm.basicdata.feign;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.basicdata.entity.BasicdataTrayEntity;
import com.logpm.basicdata.service.IBasicdataTrayService;
@ -39,7 +40,7 @@ import springfox.documentation.annotations.ApiIgnore;
@AllArgsConstructor
public class BasicdataTrayClient implements IBasicdataTrayClient {
private final IBasicdataTrayService BasicdataTrayService;
private final IBasicdataTrayService basicdataTrayService;
@Override
@GetMapping(TOP)
@ -47,13 +48,13 @@ public class BasicdataTrayClient implements IBasicdataTrayClient {
Query query = new Query();
query.setCurrent(current);
query.setSize(size);
IPage<BasicdataTrayEntity> page = BasicdataTrayService.page(Condition.getPage(query));
IPage<BasicdataTrayEntity> page = basicdataTrayService.page(Condition.getPage(query));
return BladePage.of(page);
}
@Override
public Long addTray(BasicdataTrayEntity basicdataTrayEntity) {
boolean saveFlag = BasicdataTrayService.save(basicdataTrayEntity);
boolean saveFlag = basicdataTrayService.save(basicdataTrayEntity);
if(saveFlag){
return basicdataTrayEntity.getId();
}else {
@ -66,7 +67,16 @@ public class BasicdataTrayClient implements IBasicdataTrayClient {
QueryWrapper<BasicdataTrayEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("pallet_code",trayCode)
.eq("is_deleted",0);
return BasicdataTrayService.getOne(queryWrapper);
return basicdataTrayService.getOne(queryWrapper);
}
@Override
public void updateTrayStatus(Long trayId, int trayStatus) {
UpdateWrapper<BasicdataTrayEntity> updateWrapper = new UpdateWrapper<>();
updateWrapper.set("tray_status",trayStatus)
.eq("id",trayId)
.eq("is_deleted",0);
basicdataTrayService.update(updateWrapper);
}
}

206
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseTrayTypeApiController.java

@ -2,8 +2,10 @@ package com.logpm.warehouse.api;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.distribution.feign.IDistributionStockArticleClient;
import com.logpm.warehouse.dto.TrayTypeDTO;
import com.logpm.warehouse.service.IWarehouseTrayTypeService;
import com.logpm.warehouse.vo.TrayTypeDataListVO;
import com.logpm.warehouse.vo.TrayTypeDataVO;
import com.logpm.warehouse.vo.WarehouseTrayTypeVO;
import io.swagger.annotations.Api;
@ -32,75 +34,7 @@ public class WarehouseTrayTypeApiController {
private final IWarehouseTrayTypeService warehouseTrayTypeService;
/**
* 已分拣打托的列表
*/
@ResponseBody
@PostMapping("/pageList")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "已分拣打托列表", notes = "传入trayTypeDTO")
public R<IPage<WarehouseTrayTypeVO>> pageList(@RequestBody TrayTypeDTO trayTypeDTO) {
log.info("###############pageList: 已分拣打托列表 参数:{}",trayTypeDTO);
Integer pageNum = trayTypeDTO.getPageNum();//当前页码
Integer pageSize = trayTypeDTO.getPageSize();//每页条数
if(Objects.isNull(pageNum)){
trayTypeDTO.setPageNum(1);
}
if(Objects.isNull(pageSize)){
trayTypeDTO.setPageSize(10);
}
IPage<WarehouseTrayTypeVO> pages = warehouseTrayTypeService.pageList(trayTypeDTO);
return R.data(pages);
}
@ResponseBody
@PostMapping("/scanTrayInfo")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "打托扫码", notes = "传入trayTypeDTO")
public R<IPage<WarehouseTrayTypeVO>> scanTrayInfo(@RequestBody TrayTypeDTO trayTypeDTO) {
log.info("#######scanTrayInfo: trayTypeDTO={}",trayTypeDTO);
String trayCode = trayTypeDTO.getTrayCode();//托盘码
if(!StringUtil.hasLength(trayCode)){
log.warn("#######scanTrayInfo: 托盘码为空 trayCode={}",trayCode);
return R.fail(403,"托盘码为空");
}
try{
TrayTypeDataVO trayTypeDataVO = warehouseTrayTypeService.scanTrayInfo(trayCode);
}catch (Exception e){
}
return null;
}
@ResponseBody
@PostMapping("/scanGoodsByTray")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "打托扫码", notes = "传入trayTypeDTO")
public R<IPage<WarehouseTrayTypeVO>> scanGoodsByTray(@RequestBody TrayTypeDTO trayTypeDTO) {
log.info("#######scanGoodsByTray: trayTypeDTO={}",trayTypeDTO);
String trayType = trayTypeDTO.getTrayType();//打托方式1服务号、2订单号、3商城、4门店,5客户 6仓库 7其它
Integer goodsType = trayTypeDTO.getGoodsType();//货物类型 1包条 2零担 3库存品
Integer scanType = trayTypeDTO.getScanType();//录入类型 1扫码 2手输
//首先PDA要扫码托盘,得到一个托盘码
//如果后台查询到数据就直接带出该托盘的打托方式和在托的货物
//如果没有就选择打托方式
return null;
}
private final IDistributionStockArticleClient distributionStockArticleClient;
//----------------------订单分拣--------------------------------
@ResponseBody
@ -133,6 +67,11 @@ public class WarehouseTrayTypeApiController {
}
}
/**
* 公用的扫托盘方法
* @param trayTypeDTO
* @return
*/
@ResponseBody
@PostMapping("/orderScanTrayCode")
@ApiOperationSupport(order = 1)
@ -208,7 +147,136 @@ public class WarehouseTrayTypeApiController {
}
}
@ResponseBody
@PostMapping("/deleteScanOrderPackageCode")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "删除包件与托盘的绑定", notes = "传入trayTypeDTO")
public R deleteScanOrderPackageCode(@RequestBody TrayTypeDTO trayTypeDTO) {
String method = "###########deleteScanOrderPackageCode: ";
log.info(method + "删除包件与托盘的绑定 trayTypeDTO={}", trayTypeDTO);
String orderPackageCode = trayTypeDTO.getOrderPackageCode();//包件码
String trayCode = trayTypeDTO.getTrayCode();//托盘码
if(!StringUtil.hasLength(trayCode)){
log.warn(method+"托盘码不能为空 trayCode={}",trayCode);
return R.fail(403,"托盘码不能为空");
}
if(!StringUtil.hasLength(orderPackageCode)){
log.warn(method+"包条码不能为空 orderPackageCode={}",orderPackageCode);
return R.fail(403,"包条码不能为空");
}
try{
return warehouseTrayTypeService.deleteScanOrderPackageCode(trayCode,orderPackageCode);
}catch (CustomerException e){
log.warn(e.message);
return R.fail(e.code,e.message);
}catch (Exception e){
log.error(method+"系统异常,联系管理员",e);
return R.fail(500,"系统异常,联系管理员");
}
}
//----------------------人工分拣----------------------------------
@ResponseBody
@PostMapping("/zeroPageList")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "零担分拣列表", notes = "传入trayTypeDTO")
public R<IPage<WarehouseTrayTypeVO>> zeroPageList(@RequestBody TrayTypeDTO trayTypeDTO) {
String method = "###########zeroPageList: ";
log.info(method+"零担分拣列表 trayTypeDTO={}",trayTypeDTO);
Integer pageNum = trayTypeDTO.getPageNum();
Integer pageSize = trayTypeDTO.getPageSize();
if(Objects.isNull(pageNum)){
trayTypeDTO.setPageNum(1);
}
if(Objects.isNull(pageSize)){
trayTypeDTO.setPageSize(10);
}
try{
//查询订制品打托列表
IPage<WarehouseTrayTypeVO> pages = warehouseTrayTypeService.zeroPageList(trayTypeDTO);
return R.data(pages);
}catch (CustomerException e){
log.warn(e.message);
return R.fail(e.code,e.message);
}catch (Exception e){
log.error(method+"系统异常,联系管理员",e);
return R.fail(500,"系统异常,联系管理员");
}
}
@ResponseBody
@PostMapping("/zeroScanTrayCode")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "零担扫码托盘", notes = "传入trayTypeDTO")
public R zeroScanTrayCode(@RequestBody TrayTypeDTO trayTypeDTO) {
String method = "###########zeroScanTrayCode: ";
log.info(method+"零担扫码托盘 trayTypeDTO={}",trayTypeDTO);
String trayCode = trayTypeDTO.getTrayCode();//托盘码
//通过托盘码查询,当前托盘是否有货物,如果有就按照原来的托盘打包方式展示,如果没有就展示订单的打托方式
try{
if(!StringUtil.hasLength(trayCode)){
log.warn(method+"托盘码不能为空 trayCode={}",trayCode);
return R.fail(403,"托盘码不能为空");
}
Map<String,Object> map = new HashMap<>();
//查询托盘是否被打托
TrayTypeDataVO trayTypeDataVO = warehouseTrayTypeService.getEntityByTrayCode(trayCode);
if(Objects.isNull(trayTypeDataVO)){
//如果没有对应数据就返回打托方式
List<DictBiz> list = DictBizCache.getList(DictBizConstant.PALLET_TYPE);
map.put("is_has_data",0);
map.put("data",list);
}else{
map.put("is_has_data",1);
map.put("data",trayTypeDataVO);
}
return R.data(map);
}catch (CustomerException e){
log.warn(e.message);
return R.fail(e.code,e.message);
}catch (Exception e){
log.error(method+"系统异常,联系管理员",e);
return R.fail(500,"系统异常,联系管理员");
}
}
@ResponseBody
@PostMapping("/getZeroOrderByWaybillCode")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "获取零担订单列表", notes = "传入trayTypeDTO")
public R getZeroOrderByWaybillCode(@RequestBody TrayTypeDTO trayTypeDTO) {
String method = "###########getZeroOrderByWaybillCode: ";
log.info(method + "获取零担订单列表 trayTypeDTO={}", trayTypeDTO);
String waybillCode = trayTypeDTO.getWaybillCode();//运单号
try{
if(!StringUtil.hasLength(waybillCode)){
log.warn(method+"运单号不能为空 waybillCode={}",waybillCode);
return R.fail(403,"waybillCode不能为空");
}
List<TrayTypeDataListVO> lsit = warehouseTrayTypeService.getZeroOrderByWaybillCode(waybillCode);
return R.data(lsit);
}catch (CustomerException e){
log.warn(e.message);
return R.fail(e.code,e.message);
}catch (Exception e){
log.error(method+"系统异常,联系管理员",e);
return R.fail(500,"系统异常,联系管理员");
}
}
//----------------------库存品分拣--------------------------------

2
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/TrayTypeDTO.java

@ -29,7 +29,7 @@ public class TrayTypeDTO implements Serializable {
private Integer scanType;//录入类型
private String waybillCode;//运单号
private String type;

2
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.java

@ -15,4 +15,6 @@ public interface WarehouseTrayGoodsMapper extends BaseMapper<WarehouseTrayGoodsE
List<TrayTypeDataListVO> getListByTrayTypeId(@Param("trayTypeId") Long trayTypeId);
List<DistributionParcelListEntity> getListByTrayTypeIdAndOrderCode(@Param("trayTypeId") Long trayTypeId, @Param("orderCode") String orderCode);
List<TrayTypeDataListVO> getZeroListByTrayTypeId(@Param("trayTypeId") Long trayTypeId);
}

11
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.xml

@ -27,4 +27,15 @@
and ldpl.order_code = #{orderCode}
</select>
<select id="getZeroListByTrayTypeId" resultType="com.logpm.warehouse.vo.TrayTypeDataListVO">
select ldsa.id dataId,
ldsa.order_code dataCode,
lwtg.num scanNum,
ldsa.total_number orderTotalNum
from logpm_warehouse_tray_goods lwtg
left join logpm_distribution_stock_article ldsa on ldsa.id = lwtg.association_id and ldsa.is_zero = 1 and ldsa.is_deleted = 0
where lwtg.is_deleted = 0
and lwtg.tray_type_id = #{trayTypeId}
</select>
</mapper>

5
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayTypeMapper.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.warehouse.dto.TrayTypeDTO;
import com.logpm.warehouse.entity.WarehouseTrayTypeEntity;
import com.logpm.warehouse.vo.TrayTypeDataListVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -21,4 +22,8 @@ public interface WarehouseTrayTypeMapper extends BaseMapper<WarehouseTrayTypeEnt
void changeTotalNumAndOrderTotalNumByTrayTypeId(@Param("totalNum") Integer totalNum, @Param("orderTotalNumber") Integer orderTotalNumber, @Param("trayTypeId") Long trayTypeId);
void changeTotalNumByTrayTypeId(@Param("totalNum") Integer totalNum, @Param("trayTypeId") Long trayTypeId);
Integer getAllZeroTotalNumByTrayCode(@Param("trayTypeId") Long trayTypeId);
List<TrayTypeDataListVO> getZeroOrderByWaybillCode(@Param("waybillCode") String waybillCode);
}

14
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayTypeMapper.xml

@ -7,6 +7,7 @@
from logpm_warehouse_tray_type lwtt
where 1=1
and lwtt.type = #{param.type}
and lwtt.is_deleted = 0
<if test="param.trayCode != null and param.trayCode != '' ">
and lwtt.tray_code = #{param.trayCode}
</if>
@ -48,4 +49,17 @@
and total_num + #{totalNum} &gt;= 0
</update>
<select id="getAllZeroTotalNumByTrayCode" resultType="Integer">
select sum(ldsa.total_number)
from logpm_warehouse_tray_goods lwtg
left join logpm_distribution_stock_article ldsa on lwtg.association_id = ldsa.id and ldsa.is_deleted = 0
where lwtg.is_deleted = 0
and lwtg.tray_type_id = #{trayTypeId}
</select>
<select id="getZeroOrderByWaybillCode" resultType="com.logpm.warehouse.vo.TrayTypeDataListVO">
select *
</select>
</mapper>

6
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseTrayGoodsService.java

@ -15,4 +15,10 @@ public interface IWarehouseTrayGoodsService extends BaseService<WarehouseTrayGoo
void saveEntityPackage(DistributionParcelListEntity parcelListEntity, WarehouseTrayTypeEntity trayTypeEntity, String isException);
List<DistributionParcelListEntity> getListByTrayTypeIdAndOrderCode(Long trayTypeId, String orderCode);
WarehouseTrayGoodsEntity findByTrayTypeIdAndAssociationValue(Long trayTypeId, String orderPackageCode);
Integer deleteByTrayGoodsId(Long trayGoodsId);
List<TrayTypeDataListVO> getZeroListByTrayTypeId(Long trayTypeId);
}

13
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseTrayTypeService.java

@ -3,20 +3,25 @@ package com.logpm.warehouse.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.warehouse.dto.TrayTypeDTO;
import com.logpm.warehouse.entity.WarehouseTrayTypeEntity;
import com.logpm.warehouse.vo.TrayTypeDataListVO;
import com.logpm.warehouse.vo.TrayTypeDataVO;
import com.logpm.warehouse.vo.WarehouseTrayTypeVO;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.tool.api.R;
public interface IWarehouseTrayTypeService extends BaseService<WarehouseTrayTypeEntity> {
IPage<WarehouseTrayTypeVO> pageList(TrayTypeDTO trayTypeDTO);
import java.util.List;
TrayTypeDataVO scanTrayInfo(String trayCode);
public interface IWarehouseTrayTypeService extends BaseService<WarehouseTrayTypeEntity> {
IPage<WarehouseTrayTypeVO> orderPageList(TrayTypeDTO trayTypeDTO);
TrayTypeDataVO getEntityByTrayCode(String trayCode);
R orderScanOrderPackageCode(String trayType, String trayCode, String orderPackageCode);
R deleteScanOrderPackageCode(String trayCode, String orderPackageCode);
IPage<WarehouseTrayTypeVO> zeroPageList(TrayTypeDTO trayTypeDTO);
List<TrayTypeDataListVO> getZeroOrderByWaybillCode(String waybillCode);
}

25
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayGoodsServiceImpl.java

@ -1,5 +1,6 @@
package com.logpm.warehouse.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.warehouse.entity.WarehouseTrayGoodsEntity;
import com.logpm.warehouse.entity.WarehouseTrayTypeEntity;
@ -19,8 +20,6 @@ import java.util.List;
public class WarehouseTrayGoodsServiceImpl extends BaseServiceImpl<WarehouseTrayGoodsMapper,WarehouseTrayGoodsEntity> implements IWarehouseTrayGoodsService {
@Override
public List<TrayTypeDataListVO> getListByTrayTypeId(Long trayTypeId) {
return baseMapper.getListByTrayTypeId(trayTypeId);
@ -45,4 +44,26 @@ public class WarehouseTrayGoodsServiceImpl extends BaseServiceImpl<WarehouseTray
public List<DistributionParcelListEntity> getListByTrayTypeIdAndOrderCode(Long trayTypeId, String orderCode) {
return baseMapper.getListByTrayTypeIdAndOrderCode(trayTypeId,orderCode);
}
@Override
public WarehouseTrayGoodsEntity findByTrayTypeIdAndAssociationValue(Long trayTypeId, String orderPackageCode) {
QueryWrapper<WarehouseTrayGoodsEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("tray_type_id",trayTypeId)
.eq("association_value",orderPackageCode)
.eq("is_deleted",0);
return baseMapper.selectOne(queryWrapper);
}
@Override
public Integer deleteByTrayGoodsId(Long trayGoodsId) {
WarehouseTrayGoodsEntity trayGoodsEntity = baseMapper.selectById(trayGoodsId);
Long trayTypeId = trayGoodsEntity.getTrayTypeId();
List<TrayTypeDataListVO> listByTrayTypeId = baseMapper.getListByTrayTypeId(trayTypeId);
return listByTrayTypeId.size();
}
@Override
public List<TrayTypeDataListVO> getZeroListByTrayTypeId(Long trayTypeId) {
return baseMapper.getZeroListByTrayTypeId(trayTypeId);
}
}

161
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java

@ -3,13 +3,11 @@ package com.logpm.warehouse.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.logpm.basic.entity.BasicMaterialEntity;
import com.logpm.basic.feign.IBasicMaterialClient;
import com.logpm.basicdata.entity.BasicdataTrayEntity;
import com.logpm.basicdata.feign.IBasicdataTrayClient;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
import com.logpm.distribution.entity.DistributionStockListEntity;
import com.logpm.distribution.feign.IDistributionParcelListClient;
import com.logpm.distribution.feign.IDistributionStockArticleClient;
import com.logpm.distribution.feign.IDistributionStockListClient;
@ -39,8 +37,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.TreeSet;
@Log4j2
@Service
@ -61,74 +57,6 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
private final IWarehouseTrayGoodsLogService warehouseTrayGoodsLogService;
@Override
public IPage<WarehouseTrayTypeVO> pageList(TrayTypeDTO trayTypeDTO) {
IPage<Object> page = new Page<>();
page.setCurrent(trayTypeDTO.getPageNum());
page.setSize(trayTypeDTO.getPageSize());
IPage<WarehouseTrayTypeEntity> pageList = baseMapper.pageList(page,trayTypeDTO);
IPage<WarehouseTrayTypeVO> warehouseTrayTypeVOIPage = WarehouseTrayTypeWrapper.build().pageVO(pageList);
List<WarehouseTrayTypeVO> records = warehouseTrayTypeVOIPage.getRecords();
for (WarehouseTrayTypeVO trayTypeVO:records){
Long trayId = trayTypeVO.getTrayId();//托盘id
//TODO 需要货物与托盘的关联表,与记录表
QueryWrapper<WarehouseTrayGoodsEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("tray_id",trayId)
.eq("is_deleted",0);
List<WarehouseTrayGoodsEntity> list = warehouseTrayGoodsService.list(queryWrapper);
Set<String> orderCodes = new TreeSet();
Set<Long> stockListIds = new TreeSet();
for (WarehouseTrayGoodsEntity warehouseTrayGoodsEntity:list){
// Integer goodsType = warehouseTrayGoodsEntity.getGoodsType();//货物类型
Integer associationType = warehouseTrayGoodsEntity.getAssociationType();
String associationValue = warehouseTrayGoodsEntity.getAssociationValue();
Long associationId = warehouseTrayGoodsEntity.getAssociationId();
//分拣只会存在包件分拣或者无包条的零担订单和库存品
if(associationType == 3){
DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCode(associationValue);
orderCodes.add(parcelListEntity.getOrderCode());
}
if(associationType == 2){
orderCodes.add(associationValue);
}
if(associationType == 4){
BasicMaterialEntity materialEntity = basicMaterialClient.getMaterialByProductCode(associationValue);
DistributionStockListEntity stockListEntity = distributionStockListClient.getStockListByMaterialId(materialEntity.getId());
stockListIds.add(stockListEntity.getId());
}
}
Integer orderTotalNum = 0;
for(String orderCode:orderCodes){
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient.findStockArticleByOrderCode(orderCode);
if(!Objects.isNull(stockArticleEntity)){
orderTotalNum = orderTotalNum +stockArticleEntity.getTotalNumber();
}
}
for (Long stockListId:stockListIds){
DistributionStockListEntity stockListEntity = distributionStockListClient.getStockListById(stockListId);
if(!Objects.isNull(stockListEntity)){
orderTotalNum = orderTotalNum +stockListEntity.getQuantityStock();
}
}
trayTypeVO.setOrderTotalNum(orderTotalNum);
}
warehouseTrayTypeVOIPage.setRecords(records);
return warehouseTrayTypeVOIPage;
}
@Override
public TrayTypeDataVO scanTrayInfo(String trayCode) {
//根据托盘嘛查询是否有数据
return null;
}
@Override
public IPage<WarehouseTrayTypeVO> orderPageList(TrayTypeDTO trayTypeDTO) {
IPage<Object> page = new Page<>();
@ -184,7 +112,8 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
List<TrayTypeDataListVO> list = warehouseTrayGoodsService.getListByTrayTypeId(trayTypeId);
trayTypeDataVO.setList(list);
}else if(PalletProductTypeConstant.ARTIFICIAL.equals(type)){
List<TrayTypeDataListVO> list = warehouseTrayGoodsService.getZeroListByTrayTypeId(trayTypeId);
trayTypeDataVO.setList(list);
}else if(PalletProductTypeConstant.INVENTORY.equals(type)){
}else {
@ -193,7 +122,7 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
return trayTypeDataVO;
}
@Transactional
@Transactional(rollbackFor = Exception.class)
@Override
public R orderScanOrderPackageCode(String trayType, String trayCode, String orderPackageCode) {
//查询托盘信息
@ -320,6 +249,60 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
return R.success("扫描成功");
}
@Transactional(rollbackFor = Exception.class)
@Override
public R deleteScanOrderPackageCode(String trayCode, String orderPackageCode) {
//删除托盘与包件关联关系
QueryWrapper<WarehouseTrayTypeEntity> trayTypeEntityQueryWrapper = new QueryWrapper<>();
trayTypeEntityQueryWrapper.eq("tray_code",trayCode)
.eq("is_deleted",0);
WarehouseTrayTypeEntity trayTypeEntity = baseMapper.selectOne(trayTypeEntityQueryWrapper);
if(Objects.isNull(trayTypeEntity)){
log.warn("#############deleteScanOrderPackageCode: 该托盘尚未有打托数据 trayCode={}",trayCode);
return R.fail(403,"该托盘尚未有打托数据");
}
Long trayTypeId = trayTypeEntity.getId();
Long trayId = trayTypeEntity.getId();
WarehouseTrayGoodsEntity trayGoodsEntity = warehouseTrayGoodsService.findByTrayTypeIdAndAssociationValue(trayTypeId,orderPackageCode);
if(Objects.isNull(trayGoodsEntity)){
log.warn("#############deleteScanOrderPackageCode: 该托盘上没有该包件数据 trayCode={} orderPackageCode={}",trayCode,orderPackageCode);
return R.fail(403,"该托盘上没有该包件数据");
}
Long trayGoodsId = trayGoodsEntity.getId();
DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCode(orderPackageCode);
if(Objects.isNull(parcelListEntity)){
log.warn("##############deleteScanOrderPackageCode: 包件不存在 orderPackageCode={}",orderPackageCode);
return R.fail(403,"包件不存在");
}
//添加下托日志
warehouseTrayGoodsLogService.saveLogPackage(parcelListEntity,trayTypeEntity,"0","分拣打托:扫码分拣","2");
//修改打托方式上的值
changeTotalNumByTrayTypeId(parcelListEntity,trayTypeEntity.getId(),2);//addSub 1加 2减
//删除绑定关系并返回剩余数量
Integer num = warehouseTrayGoodsService.deleteByTrayGoodsId(trayGoodsId);
if(num == 0){
//空置托盘
baseMapper.deleteById(trayTypeId);
//更新托盘状态
basicdataTrayClient.updateTrayStatus(trayId,1);
}
return R.success("删除成功");
}
private boolean isNeedVacantTrayCode(Long trayTypeId) {
List<TrayTypeDataListVO> listByTrayTypeId = warehouseTrayGoodsService.getListByTrayTypeId(trayTypeId);
if(listByTrayTypeId.size() == 0){
return true;
}else{
return false;
}
}
private void changeTotalNumByTrayTypeId(DistributionParcelListEntity parcelListEntity, Long trayTypeId,Integer addSub) {
String orderCode = parcelListEntity.getOrderCode();
@ -365,6 +348,7 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
log.warn("#########saveTrayType: 未找到托盘信息 trayCode={}",trayCode);
throw new CustomerException(403,"未找到托盘信息");
}
Long trayId = trayEntity.getId();
//查询包件数据
DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCode(orderPackageCode);
if(Objects.isNull(parcelListEntity)){
@ -379,7 +363,7 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
}
WarehouseTrayTypeEntity trayTypeEntity = new WarehouseTrayTypeEntity();
trayTypeEntity.setTrayId(trayEntity.getId());
trayTypeEntity.setTrayId(trayId);
trayTypeEntity.setTrayCode(trayCode);
trayTypeEntity.setType(PalletProductTypeConstant.CUSTOMIZED);
trayTypeEntity.setTrayType(trayType);
@ -408,7 +392,34 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
trayTypeEntity.setFilterValue(stockArticleEntity.getWarehouse());
}
baseMapper.insert(trayTypeEntity);
//修改托盘的状态
basicdataTrayClient.updateTrayStatus(trayId,2);
return trayTypeEntity;
}
//-----------------------------人工分拣-----------------------
@Override
public IPage<WarehouseTrayTypeVO> zeroPageList(TrayTypeDTO trayTypeDTO) {
IPage<Object> page = new Page<>();
page.setCurrent(trayTypeDTO.getPageNum());
page.setSize(trayTypeDTO.getPageSize());
//存入列表类型
trayTypeDTO.setType(PalletProductTypeConstant.ARTIFICIAL);
//因为传入了打托分类,所以可以公用一个
IPage<WarehouseTrayTypeEntity> pageList = baseMapper.orderPageList(page,trayTypeDTO);
IPage<WarehouseTrayTypeVO> warehouseTrayTypeVOIPage = WarehouseTrayTypeWrapper.build().pageVO(pageList);
return warehouseTrayTypeVOIPage;
}
@Override
public List<TrayTypeDataListVO> getZeroOrderByWaybillCode(String waybillCode) {
return baseMapper.getZeroOrderByWaybillCode(waybillCode);
}
}

2
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/wrapper/WarehouseTrayTypeWrapper.java

@ -40,7 +40,7 @@ public class WarehouseTrayTypeWrapper extends BaseEntityWrapper<WarehouseTrayTyp
@Override
public WarehouseTrayTypeVO entityVO(WarehouseTrayTypeEntity warehouseTrayTypeEntity) {
WarehouseTrayTypeVO warehouseTrayTypeVO = Objects.requireNonNull(BeanUtil.copy(warehouseTrayTypeEntity, WarehouseTrayTypeVO.class));
String palletTypeName = DictBizCache.getValue(DictBizConstant.PALLET_ORDER_TYPE, warehouseTrayTypeVO.getTrayType());
String palletTypeName = DictBizCache.getValue(DictBizConstant.PALLET_TYPE, warehouseTrayTypeVO.getTrayType());
warehouseTrayTypeVO.setTrayTypeName(palletTypeName);
return warehouseTrayTypeVO;

Loading…
Cancel
Save