Commit fed07cb0 by 李小惠

修改库存模块

parent f741df7f
......@@ -76,3 +76,7 @@ Thumbs.db
/.idea/dataSources.xml
/.idea/mybatisx/templates.xml
/.idea/dataSources.xml
/pom.xml
/.idea/compiler.xml
/.idea/modules.xml
/pom.xml
......@@ -9,15 +9,15 @@
<outputRelativeToContentRoot value="true" />
<module name="jyzb-common" />
<module name="jyzb-process" />
<module name="jyzb-mq-consumer" />
<module name="jyzb-biz" />
<module name="jyzb-boot" />
<module name="jyzb-mq-producer" />
<module name="jyzb-api" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel target="9">
<module name="jyzb-mq" target="1.8" />
<module name="jyzb-mq-consumer" target="1.8" />
<module name="jyzb-mq-producer" target="1.8" />
</bytecodeTargetLevel>
</component>
<component name="JavacSettings">
......
......@@ -5,8 +5,6 @@
<module fileurl="file://$PROJECT_DIR$/jyzb-api/jyzb-api.iml" filepath="$PROJECT_DIR$/jyzb-api/jyzb-api.iml" />
<module fileurl="file://$PROJECT_DIR$/jyzb-biz/jyzb-biz.iml" filepath="$PROJECT_DIR$/jyzb-biz/jyzb-biz.iml" />
<module fileurl="file://$PROJECT_DIR$/jyzb-boot/jyzb-boot.iml" filepath="$PROJECT_DIR$/jyzb-boot/jyzb-boot.iml" />
<module fileurl="file://$PROJECT_DIR$/jyzb-mq/jyzb-mq-consumer/jyzb-mq-consumer.iml" filepath="$PROJECT_DIR$/jyzb-mq/jyzb-mq-consumer/jyzb-mq-consumer.iml" />
<module fileurl="file://$PROJECT_DIR$/jyzb-mq/jyzb-mq-producer/jyzb-mq-producer.iml" filepath="$PROJECT_DIR$/jyzb-mq/jyzb-mq-producer/jyzb-mq-producer.iml" />
</modules>
</component>
</project>
\ No newline at end of file
......@@ -7,36 +7,20 @@ import java.math.BigDecimal;
import java.util.Date;
/**
* 装备信息简要输出实体类,只包含部分字段
* 装备简要信息输出实体类,只包含部分字段
*/
@Data
public class EqsBriefDto implements Serializable {
/**
* epc
*/
private String epc;
private String id;
/**
* 装备类型ID
*/
private String typeId;
/**
* 装备类型
*/
private String typeName;
/**
* 装备号型ID
*/
private String sizeId;
/**
* 装备号型
*/
private String sizeName;
/**
* 供应商
*/
private String supplierName;
/**
* 供应商ID
*/
private String supplierId;
......@@ -44,29 +28,10 @@ public class EqsBriefDto implements Serializable {
* 物资状态
*/
private String state;
/**
* 业务状态
*/
private String bussinessState;
/**
* 位置状态
*/
private String locationState;
/**
* 质保期
*/
private long warrantyPeriod;
/**
* 维保期
*/
private Integer maintenancePeriod;
/**
* 价格
* 组织机构
*/
private BigDecimal price ;
private Long orgId;
/**
* 位置类型
*/
......@@ -77,7 +42,15 @@ public class EqsBriefDto implements Serializable {
*/
private String locationId ;
/**
* 生产日期
* 装备类型名称
*/
private Date productionDate;
private String typeName;
/**
* 装备号型名称
*/
private String sizeName;
/**
* 供应商名称
*/
private String supplierName;
}
package com.junmp.jyzb.api.bean.dto;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* 根据区域和货架id获取装备详情输出实体类
*/
@Data
public class InsDetailDto {
/**
*
*/
private String id;
/**
* 装备包ID
*/
private String packageId;
/**
* 供应商
*/
private String supplierName;
/**
* 部门
*/
private String departmentName;
/**
* epc
*/
private String epc;
/**
* 物资状态
*/
private String state;
/**
* 业务状态
*/
private String bussinessState;
/**
* 位置状态
*/
private String locationState;
/**
* 生产日期
*/
private Date productionDate;
/**
* 质保期
*/
private int warrantyPeriod;
/**
* 维保期
*/
private int maintenancePeriod;
/**
* 维修次数
*/
private int fixCount;
/**
* 是否遗失
*/
private int lostFlag ;
/**
* Tid
*/
private String tid ;
/**
* 价格
*/
private BigDecimal price ;
}
......@@ -3,6 +3,7 @@ package com.junmp.jyzb.api.bean.dto;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Data
......@@ -36,6 +37,22 @@ public class InventorySumDto {
*/
private String sizeName;
/**
* 位置信息id
*/
private String locationId;
/**
* 位置名称
*/
private String locationName;
/**
* 区域id
*/
private String locationAreaId;
/**
* 区域名称
*/
private String locationArea;
/**
*number 库存数量
*/
private Integer number;
......@@ -55,6 +72,22 @@ public class InventorySumDto {
*expireNumber 过质保数量
*/
private Integer expireNumber;
/**
* 销毁数量
*/
private Integer destructionNumber;
/**
* 创建时间
*/
private Date createTime;
/**
*更新时间
*/
private Date updateTime;
/**
* 唯一值
*/
private String oneId;
private List<InsDetailDto> detailList;
private List<InventoryDto> detailList;
}
......@@ -17,7 +17,7 @@ public class ShelfInventoryDto implements Serializable {
private String warehouseName;
/**
*货架名称
*区域名称
*/
private String shelfAreaName;
......
......@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
......@@ -16,6 +17,7 @@ public class CabinetBoxReq extends BaseRequest {
* 主键ID
*/
@ApiModelProperty(value = "主键ID")
@NotBlank(message = "箱门id不能为空",groups = {detail.class})
private String id;
/**
......
......@@ -20,12 +20,10 @@ public class EquipmentBindReq extends BaseRequest {
/**
* 单警柜箱号id
*/
@NotBlank(message = "单警柜id不能为空",groups = {edit.class})
private String cabinetId;
/**
* 单警柜箱号id
*/
@NotNull(message = "组织机构id不能为空",groups = {edit.class})
private Long orgId;
/**
* 装备集合
......
package com.junmp.jyzb.controller;
import com.junmp.jyzb.api.bean.dto.EqsBriefDto;
import com.junmp.jyzb.api.bean.dto.InventoryDto;
import com.junmp.jyzb.api.bean.query.CabinetReq;
import com.junmp.jyzb.api.bean.query.InventoryReq;
import com.junmp.jyzb.api.bean.query.InventorySumReq;
import com.junmp.jyzb.api.bean.query.WarehouseReq;
import com.junmp.jyzb.api.bean.dto.*;
import com.junmp.jyzb.api.bean.query.*;
import com.junmp.jyzb.api.bean.req.EquipmentBindReq;
import com.junmp.jyzb.entity.InventorySummary;
import com.junmp.jyzb.service.InventoryService;
import com.junmp.jyzb.service.InventorySummaryService;
import com.junmp.jyzb.service.MQProductService;
import com.junmp.jyzb.service.*;
import com.junmp.jyzb.utils.ResponseResult;
import com.junmp.v2.common.bean.request.ValidationApi;
import com.junmp.v2.common.bean.response.ApiRes;
......@@ -36,6 +30,8 @@ public class InventoryController {
public InventorySummaryService inventorySummaryService;
@Resource
public MQProductService mqProductService;
@GetMapping("/testMQ")
@ApiOperation("根据组织机构查询库存信息")
public ApiRes<Boolean> testMQ( ) {
......@@ -44,26 +40,23 @@ public class InventoryController {
}
//根据组织机构id/单警柜id/仓库id查询出库存的汇总信息
@PostMapping("/GetEquipmentInfo")
@ApiOperation("根据组织机构查询库存汇总信息")
@ApiOperation("根据条件查询库存汇总信息")
public ApiRes<PageResult<InventorySummary>> getEquipmentInfo(@RequestBody @Validated(ValidationApi.edit.class) InventorySumReq req) {
return ApiRes.success(inventorySummaryService.getEquipmentInfo(req));
}
//填充汇总信息
@PostMapping("/SetInventoryMsg")
@ApiOperation("填充汇总表信息")
public ResponseResult setInventoryMsg() {
ResponseResult returnMsg = inventoryService.setInventoryMsg();
return returnMsg;
public ApiRes<Boolean> setInventoryMsg() {
boolean result = inventoryService.setInventoryMsg();
if (!result){
return ApiRes.failure("汇总失败");
}
return ApiRes.success(result);
}
//根据装备id查询出装备的详细信息
@PostMapping("/GetDetail")
@ApiOperation("根据装备id查询装备明细信息")
public ApiRes<InventoryDto> getDetail(@RequestBody InventoryReq req) {
return ApiRes.success(inventoryService.getInventoryDetail(req));
}
@PostMapping("/getEquipmentInfo")
@ApiOperation("查询库存明细信息")
public ResponseResult getEquipmentInfo(@RequestBody Map<String, Object> msg) {
......@@ -71,17 +64,11 @@ public class InventoryController {
return returnMsg;
}
@PostMapping("/GetInventoryDevelop")
@ApiOperation("获取装备明细表所有信息")
public ResponseResult getInventoryDevelop() {
ResponseResult returnMsg = inventoryService.getInventoryDevelop();
return returnMsg;
}
@PostMapping("/InvertoryBind")
@PostMapping("/EquipmentBind")
@ApiOperation("装备绑定箱门")
public ApiRes<Boolean> InvertoryBind(@RequestBody @Validated(ValidationApi.edit.class) EquipmentBindReq req){
return ApiRes.success(inventoryService.InvertoryBind(req));
public ApiRes<Boolean> InventoryBind(@RequestBody @Validated(ValidationApi.edit.class) EquipmentBindReq req){
return ApiRes.success(inventoryService.InventoryBind(req));
}
@PostMapping("/UpdateWarehouseInsNum")
......@@ -97,18 +84,19 @@ public class InventoryController {
}
@PostMapping("/GetInvInfoByEpc")
@ApiOperation("根据EPC列表获取装备信息")
@ApiOperation("根据EPC列表获取装备信息(简要)")
public ApiRes<List<EqsBriefDto>> GetInvInfoByEpc(@RequestBody InventoryReq req){
return ApiRes.success(inventoryService.GetInvInfoByEpc(req));
}
//通过组织机构id获取装备详情信息(不是装备汇总信息)
@PostMapping("/GetInventoryByOrgId")
@ApiOperation("查询组织机构拥有装备")
public ApiRes<List<EqsBriefDto>> getInventoryByOrgId(@RequestBody @Validated(ValidationApi.detail.class) InventoryReq req){
@ApiOperation("查询组织机构拥有装备详情列表")
public ApiRes<List<InventoryDto>> getInventoryByOrgId(@RequestBody @Validated(ValidationApi.detail.class) InventoryReq req){
return ApiRes.success(inventoryService.getInventoryByOrgId(req));
}
//根据组织机构/单警柜id/仓库id查询每件装备的详细信
//根据组织机构/单警柜id/仓库id查询每件装备细信的详
@PostMapping("/EqsBySearchType")
@ApiOperation("根据传入信息查询装备信息")
public ApiRes<List<InventoryDto>> EqsBySearchType(@RequestBody @Validated(ValidationApi.edit.class) InventoryReq req ){
......@@ -116,4 +104,48 @@ public class InventoryController {
}
//查询箱门 的装备汇总信息(传递cabinetBoxId)
//查询单警柜下的装备信息汇总(传递cabinetId)
//通过装备id获取该装备的详细信息
//根据装备id查询出装备的详细信息
@PostMapping("/GetDetail")
@ApiOperation("根据装备id查询装备明细信息")
public ApiRes<InventoryDto> getInventoryDetail(@RequestBody InventoryReq req) {
return ApiRes.success(inventoryService.getInventoryDetail(req));
}
//查询箱门(cabinetBox下)所有装备简要信息列表(传递cabinetBoxId)
@PostMapping("/searchEqsByBoxId")
@ApiOperation("查询某一箱门下的所有装备简要信息")
public ApiRes<List<EqsBriefDto>> searchEqsByBoxId(@RequestBody @Validated(ValidationApi.detail.class) CabinetBoxReq req){
return ApiRes.success(inventoryService.searchEqsByBoxId(req));
}
//查询单警柜下的汇总信息(通过单警柜id进行获取)
// @PostMapping("/EqsByCabinetId")
// @ApiOperation("查询单警柜下的汇总信息")
// public ApiRes<List<EqsBriefDto>> EqsByCabinetId(){
// return ApiRes.success(inventoryService.EqsByCabinetId());
// }
@PostMapping("/ShelfInventoryList")
@ApiOperation("根据货架id查询装备信息汇总")
public ApiRes<ShelfInventoryDto> ShelfInventoryList(@RequestBody @Validated(ValidationApi.edit.class) ShelfReq req){
return ApiRes.success(inventoryService.ShelfInventoryList(req));
}
@PostMapping("/ShelfInventoryDetail")
@ApiOperation(("/通过货架id查询每件装备信息简要"))
public ApiRes<List<EqsBriefDto>> AreaInventoryDetail(@RequestBody @Validated(ValidationApi.edit.class) ShelfReq req){
return ApiRes.success(inventoryService.ShelfInventoryDetail(req));
}
@PostMapping("/AreaInventoryList")
@ApiOperation("根据区域id查询装备信息汇总")
public ApiRes<AreaInventoryDto> AreaInventoryList(@RequestBody @Validated(ValidationApi.edit.class) WarehouseAreaReq req){
return ApiRes.success(inventoryService.AreaInventoryList(req));
}
}
......@@ -105,18 +105,6 @@ public class WarehouseController {
return ApiRes.success(warehouseAreaService.getAreaList(req));
}
@PostMapping("/AreaInventoryList")
@ApiOperation("根据区域id查询装备信息汇总")
public ApiRes<AreaInventoryDto> AreaInventoryList(@RequestBody @Validated(ValidationApi.edit.class) WarehouseAreaReq req){
return ApiRes.success(warehouseAreaService.AreaInventoryList(req));
}
@PostMapping("/AreaInventoryDetail")
@ApiOperation(("/通过区域id查询每件装备信息详情"))
public ApiRes<AreaInsDto> AreaInventoryDetail(@RequestBody @Validated(ValidationApi.edit.class) WarehouseAreaReq req){
return ApiRes.success(warehouseAreaService.AreaInventoryDetail(req));
}
@PostMapping("/AddShelf")
@ApiOperation("添加货架")
......@@ -143,17 +131,4 @@ public class WarehouseController {
}
@PostMapping("/ShelfInventoryList")
@ApiOperation("根据货架id查询装备信息汇总")
public ApiRes<ShelfInventoryDto> ShelfInventoryList(@RequestBody @Validated(ValidationApi.edit.class) ShelfReq req){
return ApiRes.success(shelfService.ShelfInventoryList(req));
}
@PostMapping("/ShelfInventoryDetail")
@ApiOperation(("/通过货架id查询每件装备信息详情"))
public ApiRes<ShelfInsDto> AreaInventoryDetail(@RequestBody @Validated(ValidationApi.edit.class) ShelfReq req){
return ApiRes.success(shelfService.ShelfInventoryDetail(req));
}
}
......@@ -161,11 +161,6 @@ public class InventorySummary implements Serializable {
@TableField("one_id")
private String oneId;
/**
* 货架id
*/
@ApiModelProperty("货架id")
private String locationShelfId;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -18,13 +18,13 @@ public interface InventoryMapper extends BaseMapper<Inventory> {
List<Map<String, Object>> getLocationInventory(@Param("queryType")String queryType, @Param("idMsg")String idMsg);
void deleteAllMsg();
boolean deleteAllMsg();
void setOrgInventory();
boolean SetCabinetInventory();
void setCabinetInventory();
void setWarehouseInventory();
boolean SetWarehouseInventory();
List<InventoryDto> EqsBySearchType(InventoryReq req);
}
\ No newline at end of file
package com.junmp.jyzb.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.junmp.jyzb.api.bean.dto.EqsBriefDto;
import com.junmp.jyzb.api.bean.dto.InventoryDto;
import com.junmp.jyzb.api.bean.query.CabinetReq;
import com.junmp.jyzb.api.bean.query.InventoryReq;
import com.junmp.jyzb.api.bean.dto.*;
import com.junmp.jyzb.api.bean.query.*;
import com.junmp.jyzb.api.bean.query.WarehouseReq;
import com.junmp.jyzb.api.bean.req.EquipmentBindReq;
import com.junmp.jyzb.entity.Inventory;
import com.junmp.jyzb.utils.ResponseResult;
......@@ -19,20 +16,37 @@ public interface InventoryService extends IService<Inventory> {
ResponseResult getEquipmentInfo(Map<String, Object> msg);
ResponseResult setInventoryMsg();
//计算更新库存汇总表信息
boolean setInventoryMsg();
List<EqsBriefDto> getInventoryByOrgId(InventoryReq req);
List<InventoryDto> getInventoryByOrgId(InventoryReq req);
ResponseResult getInventoryDevelop();
boolean UpdateWarehouseInsNum(WarehouseReq req);
boolean UpdateCabinetInsNum(CabinetReq req);
boolean InvertoryBind(EquipmentBindReq req);
boolean InventoryBind(EquipmentBindReq req);
List<EqsBriefDto> GetInvInfoByEpc(InventoryReq req);
List<InventoryDto> EqsBySearchType(InventoryReq req);
//查询箱门(cabinetBox下)所有装备简要信息列表(传递cabinetBoxId)
List<EqsBriefDto> searchEqsByBoxId(CabinetBoxReq req);
//通过货架id查询装备信息汇总
ShelfInventoryDto ShelfInventoryList(ShelfReq req);
//通过货架id查询装备简要信息
List<EqsBriefDto> ShelfInventoryDetail(ShelfReq req);
//通过区域id查询装备信息汇总
AreaInventoryDto AreaInventoryList(WarehouseAreaReq req);
}
......@@ -7,6 +7,7 @@ import com.junmp.v2.db.api.page.PageResult;
public interface InventorySummaryService extends IService<InventorySummary> {
//根据条件查询库存汇总信息
PageResult<InventorySummary> getEquipmentInfo(InventorySumReq req);
}
......@@ -19,9 +19,5 @@ public interface ShelfService extends IService<Shelf> {
List<ShelfDto> GetShelfList(ShelfReq req);
//通过货架id查询装备信息汇总
ShelfInventoryDto ShelfInventoryList(ShelfReq req);
//通过货架id查询装备详细信息
ShelfInsDto ShelfInventoryDetail(ShelfReq req);
Shelf ShelfExist(String id);
}
......@@ -26,11 +26,7 @@ public interface WarehouseAreaService extends IService<WarehouseArea> {
//判断区域是都存在(通用方法)
WarehouseArea WarehouseAreaExist(String id);
//通过区域id查询装备信息汇总
AreaInventoryDto AreaInventoryList(WarehouseAreaReq req);
//通过区域id查询每件装备的详细信息
AreaInsDto AreaInventoryDetail(WarehouseAreaReq req);
}
......@@ -60,6 +60,7 @@ public class CabinetBoxServiceImpl extends ServiceImpl<CabinetBoxMapper, Cabinet
if (ObjectUtil.isNotNull(one)){
throw new ServiceException(CabinetBoxExceptionEnum.CABINETBOX_IS_EXISTS);
}
CabinetBoxExist(req.getId());
CabinetBox cabinetBox = new CabinetBox();
BeanPlusUtil.copyProperties(req,cabinetBox);
//添加单警柜箱门信息默认状态为1
......
......@@ -91,8 +91,10 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
//添加单警柜
save(cabinet);
List<CabinetBox> objects = new ArrayList<>();
System.out.println("ObjectUtil.isNotNull(req.getNum()) = " + ObjectUtil.isNotNull(req.getNum()));
System.out.println("ObjectUtil.isNotEmpty(req.getNum()) = " + ObjectUtil.isNotEmpty(req.getNum()));
//判断num值是否传递,如果没有不做操作
if (ObjectUtil.isNotNull(req.getCabinetNum()) && !req.getCabinetNum().equals("")){
if (ObjectUtil.isNotNull(req.getNum()) && req.getNum().intValue()>=1){
for (int i = 1; i <= req.getNum(); i++) {
CabinetBox cabinetBox = new CabinetBox();
cabinetBox.setCabinetId(cabinet.getId());
......@@ -102,6 +104,8 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
objects.add(cabinetBox);
}
cabinetBoxService.saveBatch(objects);
}else if (ObjectUtil.isNotNull(req.getNum()) && req.getNum().intValue()<1){
throw new ServiceException(CabinetExceptionEnum.PARAMETER_ERROR);
}
return cabinet.getId();
......
......@@ -25,6 +25,7 @@ public class InventorySummaryServiceImpl extends ServiceImpl<InventorySummaryMa
@Resource
private PubOrgService pubOrgService;
//根据条件查询库存汇总信息
@Override
public PageResult<InventorySummary> getEquipmentInfo(InventorySumReq req) {
//判断传递参数是否不为空
......
......@@ -29,11 +29,6 @@ public class ShelfServiceImpl extends ServiceImpl<ShelfMapper, Shelf> implements
private WarehouseService warehouseService;
@Resource
private WarehouseAreaService warehouseAreaService;
@Resource
private InventorySummaryService inventorySummaryService;
@Resource
private InventoryService inventoryService;
@Override
public String AddShelf(UpdateShelfReq req) {
......@@ -85,81 +80,14 @@ public class ShelfServiceImpl extends ServiceImpl<ShelfMapper, Shelf> implements
}
return shelfDtoList;
}
@Override
public ShelfInventoryDto ShelfInventoryList(ShelfReq req) {
//判断货架是否存在
Shelf shelf = ShelfExist(req.getShelfId());
Warehouse warehouse = warehouseService.WarehoustExist(shelf.getWarehouseId());
ShelfInventoryDto shelfInventoryDto = new ShelfInventoryDto();
shelfInventoryDto.setWarehouseId(warehouse.getId());
shelfInventoryDto.setWarehouseName(warehouse.getName());
shelfInventoryDto.setWarehouseLocation(warehouse.getLocation());
shelfInventoryDto.setShelfAreaName(shelf.getShelfName());
List<InventorySumDto> inventorySumDtoList=new ArrayList<>();
//通过货架id获取装备列表汇总
List<InventorySummary> list = inventorySummaryService.list(new LambdaQueryWrapper<InventorySummary>()
.eq(InventorySummary::getLocationShelfId,req.getShelfId()));
if (list.size()==0){
return null;
}
for (InventorySummary inventorySummary:list) {
InventorySumDto inventorySumDto = new InventorySumDto();
BeanPlusUtil.copyProperties(inventorySummary,inventorySumDto);
inventorySumDtoList.add(inventorySumDto);
}
shelfInventoryDto.setList(inventorySumDtoList);
return shelfInventoryDto;
}
//通过货架id查询装备详细信息
@Override
public ShelfInsDto ShelfInventoryDetail(ShelfReq req) {
//判断货架是否存在
Shelf shelf = ShelfExist(req.getShelfId());
Warehouse warehouse = warehouseService.WarehoustExist(shelf.getWarehouseId());
ShelfInsDto shelfInsDto = new ShelfInsDto();
shelfInsDto.setWarehouseId(warehouse.getId());
shelfInsDto.setWarehouseName(warehouse.getName());
shelfInsDto.setWarehouseLocation(warehouse.getLocation());
List<InventorySumDto> inventorySumDtoList=new ArrayList<>();
//通过区域id获取装备列表汇总
List<InventorySummary> list = inventorySummaryService.list(new LambdaQueryWrapper<InventorySummary>()
.eq(InventorySummary::getLocationShelfId,req.getShelfId()));
if (list.size()==0){
return null;
}
List<InsDetailDto> insDetailDtoList=new ArrayList<>();
Iterator<InventorySummary> iterator = list.iterator();
while (iterator.hasNext()) {
InventorySummary inventorySummary = iterator.next();
InventorySumDto inventorySumDto = new InventorySumDto();
BeanPlusUtil.copyProperties(inventorySummary, inventorySumDto);
//查询出详情列表信息
List<Inventory> inventoryList = inventoryService.list(new LambdaQueryWrapper<Inventory>()
.eq(Inventory::getSizeId, inventorySummary.getSizeId())
.eq(Inventory::getTypeId, inventorySummary.getTypeId())
.eq(Inventory::getOrgId, inventorySummary.getOrgId())
.eq(Inventory::getLocationId, inventorySummary.getLocationId()));
Iterator<Inventory> iterator1 = inventoryList.iterator();
while (iterator1.hasNext()){
Inventory inventory = iterator1.next();
InsDetailDto insDetailDto = new InsDetailDto();
BeanPlusUtil.copyProperties(inventory,insDetailDto);
insDetailDtoList.add(insDetailDto);
}
inventorySumDto.setDetailList(insDetailDtoList);
inventorySumDtoList.add(inventorySumDto);
}
shelfInsDto.setList(inventorySumDtoList);
return shelfInsDto;
}
/**
* 判断货架id是否存在
* @param
* @return
*/
private Shelf ShelfExist(String id) {
public Shelf ShelfExist(String id) {
Shelf shelf = this.getById(id);
if (ObjectUtil.isNull(shelf)) {
throw new ServiceException(ShelfExceptionEnum.SHELF_NOT_EXIST);
......
......@@ -124,78 +124,7 @@ public class WarehouseAreaServiceImpl extends ServiceImpl<WarehouseAreaMapper, W
return warehouseArea;
}
/**
* 通过区域id查询装备汇总信息
* @param req
* @return
*/
@Override
public AreaInventoryDto AreaInventoryList(WarehouseAreaReq req) {
//判断区域是否存在
WarehouseArea warehouseArea = WarehouseAreaExist(req.getId());
Warehouse warehouse = warehouseService.WarehoustExist(warehouseArea.getWarehouseId());
AreaInventoryDto areaInventoryDto = new AreaInventoryDto();
areaInventoryDto.setWarehouseId(warehouse.getId());
areaInventoryDto.setWarehouseName(warehouse.getName());
areaInventoryDto.setWarehouseLocation(warehouse.getLocation());
areaInventoryDto.setWarehouseAreaName(warehouseArea.getAreaName());
List<InventorySumDto> inventorySumDtoList=new ArrayList<>();
//通过区域id获取装备列表汇总
List<InventorySummary> list = inventorySummaryService.list(new LambdaQueryWrapper<InventorySummary>()
.eq(InventorySummary::getLocationAreaId,req.getId()));
if (list.size()==0){
return null;
}
for (InventorySummary inventorySummary:list) {
InventorySumDto inventorySumDto = new InventorySumDto();
BeanPlusUtil.copyProperties(inventorySummary,inventorySumDto);
inventorySumDtoList.add(inventorySumDto);
}
areaInventoryDto.setList(inventorySumDtoList);
return areaInventoryDto;
}
@Override
public AreaInsDto AreaInventoryDetail(WarehouseAreaReq req) {
//判断区域是否存在
WarehouseArea warehouseArea = WarehouseAreaExist(req.getId());
Warehouse warehouse = warehouseService.WarehoustExist(warehouseArea.getWarehouseId());
AreaInsDto areaInsDto = new AreaInsDto();
areaInsDto.setWarehouseId(warehouse.getId());
areaInsDto.setWarehouseName(warehouse.getName());
areaInsDto.setWarehouseLocation(warehouse.getLocation());
List<InventorySumDto> inventorySumDtoList=new ArrayList<>();
//通过区域id获取装备列表汇总
List<InventorySummary> list = inventorySummaryService.list(new LambdaQueryWrapper<InventorySummary>()
.eq(InventorySummary::getLocationAreaId,req.getId()));
if (list.size()==0){
return null;
}
List<InsDetailDto> insDetailDtoList=new ArrayList<>();
Iterator<InventorySummary> iterator = list.iterator();
while (iterator.hasNext()) {
InventorySummary inventorySummary = iterator.next();
InventorySumDto inventorySumDto = new InventorySumDto();
BeanPlusUtil.copyProperties(inventorySummary, inventorySumDto);
//查询出详情列表信息
List<Inventory> inventoryList = inventoryService.list(new LambdaQueryWrapper<Inventory>()
.eq(Inventory::getSizeId, inventorySummary.getSizeId())
.eq(Inventory::getTypeId, inventorySummary.getTypeId())
.eq(Inventory::getOrgId, inventorySummary.getOrgId())
.eq(Inventory::getLocationId, inventorySummary.getLocationId()));
Iterator<Inventory> iterator1 = inventoryList.iterator();
while (iterator1.hasNext()){
Inventory inventory = iterator1.next();
InsDetailDto areaInsDetailDto = new InsDetailDto();
BeanPlusUtil.copyProperties(inventory,areaInsDetailDto);
insDetailDtoList.add(areaInsDetailDto);
}
inventorySumDto.setDetailList(insDetailDtoList);
inventorySumDtoList.add(inventorySumDto);
}
areaInsDto.setList(inventorySumDtoList);
return areaInsDto;
}
}
......@@ -82,77 +82,49 @@
delete from base_inventory_summary
</delete>
<insert id="setOrgInventory">
INSERT INTO base_inventory_summary (id, org_id_int, org_name, type_id,type_name,size_id,size_name, number, price, stock_number, outbound_number)
SELECT
UUID() AS id,
bi.org_id_int,
po.org_name,
bi.type_id,
t.name,
bi.size_id,
s.name,
COUNT(*) AS number,
SUM(bi.price) AS price,
SUM(CASE WHEN bi.location_state = 'in' THEN 1 ELSE 0 END) AS stock_number,
COUNT(*) - SUM(CASE WHEN bi.location_state = 'in' THEN 1 ELSE 0 END) AS outbound_number
FROM base_inventory bi
JOIN pub_org po ON bi.org_id_int = po.org_id
join base_equipment_type t on t.id = bi.type_id
join base_equipment_size s on s.id = bi.size_id
WHERE bi.org_id_int IN (
SELECT org_id_int
FROM base_inventory
GROUP BY org_id_int, type_id
HAVING type_id IN (
SELECT type_id
FROM base_inventory
GROUP BY type_id
)
)
GROUP BY bi.org_id_int, bi.type_id, bi.size_id;
</insert>
<insert id="setCabinetInventory">
INSERT INTO base_inventory_summary (id,org_id_int,org_name,location_id,location_name,type_id,type_name,size_id,size_name,number, price, stock_number, outbound_number,location_type)
SELECT
UUID() as id,
bi.org_id_int as orgIdInt,
po.org_name as orgName,
bi.location_id as locationId,
bc.name as locationName,
bi.type_id,
t.name as typeName,
bi.size_id,
s.name as sizeName,
count(*) as 'number',
sum(bi.price) as 'price',
SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS 'stockNumber',
count(*) - SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS 'outboundNumber',
bi.location_type
FROM base_inventory bi
join base_cabinet_box bcb on bi.location_id = bcb.id
join base_cabinet bc on bcb.cabinet_id = bc.id
join base_equipment_type t on t.id = bi.type_id
join base_equipment_size s on s.id = bi.size_id
join pub_org po on bi.org_id_int = po.org_id
WHERE location_id IN (
SELECT location_id
FROM base_inventory
GROUP BY location_id,type_id
having type_id in(
SELECT
type_id as 'typeId'
FROM base_inventory b
GROUP BY type_id
)
)
and location_type = 1
GROUP BY location_id, type_id,size_id,bi.org_id_int;
<insert id="SetCabinetInventory">
INSERT INTO base_inventory_summary_type2 (id,org_id_int,org_name,type_id, type_name,size_id,size_name,location_id,location_name,number,price, stock_number, outbound_number,location_type,location_shelf_id,create_time,update_time)
select t.id,t.orgId,t.orgName,t.type_id,t.typeName,t.size_id,t.sizeName,t.locationId,t.locationName,t.number,t.price,t.stockNumber,t.outboundNumber,t.locationType,t.shelfId,NOW(),NOW()
FROM
(SELECT
UUID() as id,
bi.org_id_int as orgId,
po.org_name as orgName,
bi.type_id,
t.name as typeName,
bi.size_id,
s.name as sizeName,
bi.location_id as locationId,
bc.name as locationName,
count(*) as number,
sum(bi.price) as price,
SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS stockNumber,
count(*) - SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS outboundNumber,
bi.location_type as locationType,
bi.shelf_id as shelfId
FROM base_inventory bi
join base_cabinet_box bcb on bi.location_id = bcb.id
join base_cabinet bc on bcb.cabinet_id = bc.id
join base_equipment_type t on t.id = bi.type_id
join base_equipment_size s on s.id = bi.size_id
join pub_org po on bi.org_id_int = po.org_id
WHERE location_id IN (
SELECT location_id
FROM base_inventory
GROUP BY location_id,type_id
having type_id in(
SELECT
type_id
FROM base_inventory b
GROUP BY type_id
)
)
and location_type = 1
GROUP BY location_id, type_id,size_id,bi.org_id_int,shelf_id) as t
</insert>
<insert id="setWarehouseInventory">
<insert id="SetWarehouseInventory">
INSERT INTO base_inventory_summary (id,org_id_int,org_name,location_id, location_name,type_id, type_name,size_id,size_name, number, price, stock_number, outbound_number,location_type)
SELECT
UUID() as id,
......@@ -164,10 +136,10 @@ SELECT
t.name as typeName,
bi.size_id,
s.name as sizeName,
count(*) as 'number',
sum(bi.price) as 'price',
SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS 'stockNumber',
count(*) - SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS 'outboundNumber',
count(*) as number,
sum(bi.price) as price,
SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS stockNumber,
count(*) - SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS outboundNumber,
bi.location_type
FROM base_inventory bi
join base_warehouse bw on bi.location_id = bw.id
......@@ -189,7 +161,7 @@ and location_type = 0
GROUP BY location_id, type_id,size_id,bi.org_id_int;
</insert>
<select id="EqsBySearchType" resultType="com.junmp.jyzb.api.bean.dto.InventoryDto">
<select id="EqsBySearchType" resultType="com.junmp.jyzb.api.bean.dto.InventoryDto">
select
i.id as id,
i.package_id as package_id,
......@@ -204,6 +176,12 @@ GROUP BY location_id, type_id,size_id,bi.org_id_int;
i.location_state as locationState,
i.production_date as productionDate,
i.location_type as locationType,
<if test="queryType=='warehouse'">
i.location_id as locationId,
</if>
<if test="queryType=='cabinet'">
bcb.cabinet_id as locationId,
</if>
i.location_id as locationId,
i.price as price,
i.shelf_id as shelfId,
......@@ -226,6 +204,7 @@ GROUP BY location_id, type_id,size_id,bi.org_id_int;
join base_equipment_size es on es.id = i.size_id
join base_supplier s on s.id = i.supplier_id
join pub_org po on i.org_id_int=po.org_id
join base_cabinet_box bcb on bcb.id=i.location_id
<if test="queryType == 'org'">
where org_id_int = #{orgId}
</if>
......@@ -233,7 +212,7 @@ GROUP BY location_id, type_id,size_id,bi.org_id_int;
where location_id = #{warehouseId}
</if>
<if test="queryType == 'cabinet'">
where org_id_int = #{cabinetId}
where location_id = #{cabinetId}
</if>
</select>
......
......@@ -24,12 +24,11 @@
<result column="expire_number" jdbcType="INTEGER" property="expireNumber" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="location_shelf_id" jdbcType="VARCHAR" property="locationShelfId" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, org_id, org_name, type_id, type_name, size_id, size_name, location_type, location_id,
location_name, location_area_id, location_area, `number`, price, stock_number, outbound_number,
destruction_number, expire_number, create_time, update_time,location_shelf_id
destruction_number, expire_number, create_time, update_time
</sql>
</mapper>
\ No newline at end of file
......@@ -15,7 +15,6 @@
<module>jyzb-biz</module>
<module>jyzb-process</module>
<module>jyzb-common</module>
<module>jyzb-mq</module>
</modules>
<parent>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论