diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/vo/WarehouseAllocationInfoVO.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/vo/WarehouseAllocationInfoVO.java index 69ebeecc8..dfc95006a 100644 --- a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/vo/WarehouseAllocationInfoVO.java +++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/vo/WarehouseAllocationInfoVO.java @@ -24,6 +24,9 @@ public class WarehouseAllocationInfoVO { @ApiModelProperty(value = "区域名称") private String areaName; + @ApiModelProperty(value = "区域名称") + private String allocationId; + } diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java index 00aa40e3a..09188cea5 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java @@ -40,6 +40,10 @@ public interface IDistributionParcelListClient { String API_PREFIX = "/client"; String TOP = API_PREFIX + "/top1"; + String TOPPARCELLIST = API_PREFIX + "/getParcelList"; + + @GetMapping(TOPPARCELLIST) + List getParcelList(DistributionParcelListEntity parcelListEntity); /** * 获取在库订单包件清单列表 diff --git a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/QuestDetailEntity.java b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/QuestDetailEntity.java index d88d82f12..6d40df814 100644 --- a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/QuestDetailEntity.java +++ b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/QuestDetailEntity.java @@ -136,7 +136,7 @@ public class QuestDetailEntity extends TenantEntity { * 上架后的库位ID */ @ApiModelProperty(value = "上架后的库位ID") - private String groundingAllocationId; + private Long groundingAllocationId; /** * 托盘id */ @@ -153,6 +153,6 @@ public class QuestDetailEntity extends TenantEntity { * 是否是新增数据 */ @ApiModelProperty(value = "是否是新增数据") - private String isNew; + private Integer isNew; } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataDriverArteryController.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataDriverArteryController.java index 45035cc5d..c77079d52 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataDriverArteryController.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataDriverArteryController.java @@ -36,11 +36,15 @@ import org.springblade.core.excel.util.ExcelUtil; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.secure.BladeUser; +import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; import org.springblade.core.tool.constant.BladeConstant; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; +import org.springblade.system.entity.User; +import org.springblade.system.feign.IUserClient; import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.handler.UserRoleAuthorizationInterceptor; import springfox.documentation.annotations.ApiIgnore; import javax.servlet.http.HttpServletResponse; @@ -65,6 +69,8 @@ public class BasicdataDriverArteryController extends BladeController { private final IBasicdataVehicleService basicdataVehicleService; + private final IUserClient userClient; + /** * 司机信息表 详情 */ @@ -122,6 +128,13 @@ public class BasicdataDriverArteryController extends BladeController { if(list.size() > 0){ return R.fail("绑定的用户已存在!不要重复绑定!!!"); } + + String phone = basicdataDriverArtery.getPhone(); + R userR = userClient.userInfoByPhone(AuthUtil.getUser().getTenantId(), phone); + if (Func.isNotEmpty(userR.getData())){ + User user = userR.getData(); + basicdataDriverArtery.setUserId(user.getId()); + } boolean save = basicdataDriverArteryService.save(basicdataDriverArtery); //加入关联表 if (null !=basicdataDriverArtery.getBindVehicles()&& save){ diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataGoodsAllocationMapper.xml b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataGoodsAllocationMapper.xml index c6e236721..d5b48dff3 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataGoodsAllocationMapper.xml +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataGoodsAllocationMapper.xml @@ -139,7 +139,8 @@ lwga.qr_code as allocationCode, CONCAT(lwgs.goods_shelf_name,'-',lwga.goods_allocation_name) as allocationName, lww.`name` as warehouseName, - lwga1.headline as areaName + lwga1.headline as areaName, + lwga.id as allocationId from logpm_warehouse_goods_allocation lwga LEFT JOIN logpm_warehouse_goods_area lwga1 ON lwga1.id=lwga.goods_area_id LEFT JOIN logpm_warehouse_goods_shelf lwgs ON lwgs.id = lwga.goods_shelf_id diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java index 09fe5dc43..bba6ff3a3 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java @@ -18,6 +18,8 @@ package com.logpm.distribution.feign; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.logpm.distribution.entity.DistributionParcelListEntity; import com.logpm.distribution.service.IDistributionParcelListService; import lombok.AllArgsConstructor; @@ -44,7 +46,23 @@ public class DistributionParcelListClient implements IDistributionParcelListClie private final IDistributionParcelListService distributionParcelListService; - @Override + /** + * 查询包件信息 + * + * @param parcelListEntity + * @return + */ + @Override + @GetMapping(TOPPARCELLIST) + public List getParcelList(DistributionParcelListEntity parcelListEntity) { + return distributionParcelListService.list(Wrappers.query().lambda() + .eq(ObjectUtils.isNotNull(parcelListEntity.getOrderPackageCode()),DistributionParcelListEntity::getOrderPackageCode,parcelListEntity.getOrderPackageCode()) + .eq(ObjectUtils.isNotNull(parcelListEntity.getId()),DistributionParcelListEntity::getId,parcelListEntity.getId()) + .eq(ObjectUtils.isNotNull(parcelListEntity.getWarehouseId()),DistributionParcelListEntity::getWarehouseId,parcelListEntity.getWarehouseId()) + ); + } + + @Override @GetMapping(TOP) public BladePage top(Integer current, Integer size) { Query query = new Query(); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockListServiceImpl.java index a84065a54..cb3e12caa 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockListServiceImpl.java @@ -265,6 +265,7 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl 0){ diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseTaskApiController.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseTaskApiController.java index 7d7a44de5..40fb187db 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseTaskApiController.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseTaskApiController.java @@ -1,6 +1,7 @@ package com.logpm.warehouse.api; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.logpm.warehouse.dto.TaskSearchDTO; import com.logpm.warehouse.service.ITaskQuestService; @@ -16,6 +17,7 @@ import org.springblade.core.tool.api.R; import org.springframework.web.bind.annotation.*; import java.util.List; +import java.util.Optional; @Log4j2 @@ -66,9 +68,20 @@ public class WarehouseTaskApiController { @GetMapping("/trayList") @ApiOperationSupport(order = 1) @ApiOperation(value = "托盘列表", notes = "code,type") - public R> trayList(TaskSearchDTO taskSearchDTO, Query query) { - IPage pages = taskQuestService.selecttrayList(Condition.getPage(query), taskSearchDTO); - return R.data(pages); + public R trayList(TaskSearchDTO taskSearchDTO, Query query) { + Optional taskSearchDTO1 = Optional.ofNullable(taskSearchDTO); + if(taskSearchDTO1.isPresent()){ + if(ObjectUtils.isNull(taskSearchDTO.getTaskId())){ + return R.fail("盘点任务id不能为空"); + } + if(ObjectUtils.isNull(taskSearchDTO.getTrayCode())){ + return R.fail("托盘编码不能为空"); + } + R r= taskQuestService.selecttrayList(Condition.getPage(query), taskSearchDTO); + return r; + }else{ + return R.fail("参数未传递!"); + } } /** diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/TaskSearchDTO.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/TaskSearchDTO.java index 116f59ee6..efde5890f 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/TaskSearchDTO.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/TaskSearchDTO.java @@ -34,11 +34,17 @@ public class TaskSearchDTO { * 搜索code */ @ApiModelProperty(value = "搜索code") - private String code; + private String trayCode; /** * type */ @ApiModelProperty(value = "type(1-手动输入,2-扫描)") private String type; + + /** + * 盘点任务Id + */ + @ApiModelProperty(value = "盘点任务Id") + private Long taskId; } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/TaskQuestMapper.xml b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/TaskQuestMapper.xml index 2f730eb2b..88951cd86 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/TaskQuestMapper.xml +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/TaskQuestMapper.xml @@ -115,8 +115,8 @@ FROM logpm_quest_detail lqd - lqd.quest_type = 4 - AND lqd.is_deleted =0 and (lqd.quest_status = 0 or lqd.quest_status = 1) + lqd.quest_type = 4 AND lqd.is_deleted =0 and (lqd.quest_status = 0 or lqd.quest_status = 1) + and lqd.taskId = #{param.taskId} and lqd.warehouse_id in diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.xml b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.xml index cf2af6704..e7c535add 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.xml +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.xml @@ -293,7 +293,7 @@ and lwta.id is null diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/ITaskQuestService.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/ITaskQuestService.java index 91d0a9b56..5eff87e1e 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/ITaskQuestService.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/ITaskQuestService.java @@ -67,7 +67,13 @@ public interface ITaskQuestService extends BaseService { IPage selectcontractList(IPage page, TaskSearchDTO taskSearchDTO); - IPage selecttrayList(IPage page, TaskSearchDTO taskSearchDTO); + /** + * 托盘数据 + * @param page + * @param taskSearchDTO + * @return + */ + R selecttrayList(IPage page, TaskSearchDTO taskSearchDTO); IPage selectallocationDetailByStrip(IPage page, TaskSearchDTO taskSearchDTO); } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java index d1c836062..865f8189d 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java @@ -17,20 +17,29 @@ package com.logpm.warehouse.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.logpm.basicdata.entity.BasicdataTrayEntity; import com.logpm.basicdata.entity.BasicdataWarehouseEntity; +import com.logpm.basicdata.feign.IBasicdataTrayClient; import com.logpm.basicdata.feign.IBasicdataWarehouseClient; import com.logpm.basicdata.vo.BasicdataClientVO; +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.IDistributionStockClient; +import com.logpm.distribution.feign.IDistributionStockListClient; +import com.logpm.distribution.vo.DistributionStockListVO; import com.logpm.oldproject.feign.IWarehouseClient; +import com.logpm.warehouse.bean.Resp; import com.logpm.warehouse.dto.TaskQuestDTO; import com.logpm.warehouse.dto.TaskSearchDTO; -import com.logpm.warehouse.entity.TaskQuestChildEntity; -import com.logpm.warehouse.entity.TaskQuestEntity; -import com.logpm.warehouse.entity.WarehouseUpdownGoodsEntity; +import com.logpm.warehouse.entity.*; +import com.logpm.warehouse.mapper.QuestDetailMapper; import com.logpm.warehouse.mapper.WarehouseTrayGoodsMapper; import com.logpm.warehouse.mapper.WarehouseUpdownGoodsMapper; +import com.logpm.warehouse.service.IQuestDetailService; import com.logpm.warehouse.service.ITaskQuestChildService; import com.logpm.warehouse.vo.*; import com.logpm.warehouse.excel.TaskQuestExcel; @@ -38,18 +47,17 @@ import com.logpm.warehouse.mapper.TaskQuestMapper; import com.logpm.warehouse.service.ITaskQuestService; import lombok.AllArgsConstructor; import lombok.extern.log4j.Log4j2; +import org.springblade.core.log.exception.ServiceException; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import org.springblade.core.mp.base.BaseServiceImpl; +import org.w3c.dom.css.Rect; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Random; +import java.util.*; import java.util.stream.Collectors; /** @@ -67,9 +75,13 @@ public class TaskQuestServiceImpl extends BaseServiceImpl selecttrayList(IPage page, TaskSearchDTO taskSearchDTO) { - List collect = this.getmyWarehouseList(); + public R selecttrayList(IPage page, TaskSearchDTO taskSearchDTO) { + //查询托盘编码 + BasicdataTrayEntity trayByTrayCode = basicdataTrayClient.getTrayByTrayCode(taskSearchDTO.getTrayCode()); + Optional trayByTrayCode1 = Optional.ofNullable(trayByTrayCode); + if(!trayByTrayCode1.isPresent()){ + Resp.scanFail("托盘码不存在!","托盘码不存在!"); + } + List collect =this.getmyWarehouseList(); baseMapper.setSqlMode(); - List list = baseMapper.selecttrayList(page, taskSearchDTO, collect); - if (!list.isEmpty()) { + List list = baseMapper.selecttrayList(page,taskSearchDTO,collect);// 查询有没有当次盘点任务的托盘数据 + if (!list.isEmpty()){ //有盘点数据 for (TaskTrayVO taskTrayVO : list) { - //查询托盘 + //查询托盘上面的数量 Integer i = warehouseTrayGoodsMapper.SumByTrayId(taskTrayVO.getTrayId()); taskTrayVO.setTotal(i); } + }else{ + //添加扫描的托盘信息 + + //添加托盘上面的数据 + + + } - return page.setRecords(list); + page.setRecords(list); + return R.data(page); + } + + /** + * 根据托盘ID查询托盘货位并添加 + * @param taskId 盘点ID + * @param warehouseId 仓库ID + * @param trayId 托盘ID + * @return + */ + private int getTaskInventory(Long taskId,Long warehouseId,Long trayId){ + + List warehouseTrayGoodsEntities = warehouseTrayGoodsMapper.selectList(Wrappers.query().lambda() + .eq(WarehouseTrayGoodsEntity::getTrayId, trayId) + .eq(WarehouseTrayGoodsEntity::getWarehouseId, warehouseId) + ); + if(!warehouseTrayGoodsEntities.isEmpty()){ + List questDetailList = new ArrayList<>(); + warehouseTrayGoodsEntities.forEach( i -> { + QuestDetailEntity questDetail = new QuestDetailEntity(); + questDetail.setQuestId(taskId); + switch (i.getAssociationType()){ + case "1": //1.订单号 + questDetail.setOrderId(i.getAssociationId()); + questDetail.setQuestTarget(2);//零担 + questDetail.setCategoryName(i.getGoodsName()); + + break; + case "2": //2运单号 + break; + case "3": //3包件码 + //查询订单ID + questDetail.setQuestTarget(1);// + questDetail.setOrdePackageCode(i.getAssociationValue());//包条码 + questDetail.setOrderPackageId(i.getAssociationId());//包件ID + DistributionParcelListEntity parcelList = new DistributionParcelListEntity(); + parcelList.setId(i.getAssociationId()); + parcelList.setOrderPackageCode(i.getAssociationValue()); + List parcelList1 = distributionParcelListClient.getParcelList(parcelList); + if(!parcelList1.isEmpty()){ + questDetail.setOrderId(parcelList1.get(0).getStockArticleId()); + + } + break; + case "4": //4库存品 + questDetail.setQuestTarget(3);// + DistributionStockListEntity stockListEntity = new DistributionStockListEntity(); + stockListEntity.setIncomingBatch(i.getIncomingBatch()); + stockListEntity.setWarehouseId(warehouseId); + stockListEntity.setMarketId(i.getMarketId()); + stockListEntity.setMaterialId(i.getAssociationId()); + DistributionStockListVO queryData = distributionStockListClient.getQueryData(stockListEntity); + Optional queryData1 = Optional.ofNullable(queryData); + if(queryData1.isPresent()){ + questDetail.setStockId(queryData.getId()); + } + + + break; + } + questDetail.setQuestType(4);//托盘 + + +// questDetail.setOrdePackageCode(4);//托盘 +// questDetail.setQuestType(4);//托盘 +// questDetail.setQuestType(4);//托盘 + + + + questDetailList.add(questDetail); + }); + //添加 + if(!questDetailList.isEmpty()){ + questDetailService.saveBatch(questDetailList); + } + }else{ + log.debug("托盘没有货位"); + return 0; + } + + + return 1; } + + + @Override public IPage selectallocationDetailByStrip(IPage page, TaskSearchDTO taskSearchDTO) { //查询货位上的所有包条