Commit fed07cb0 by 李小惠

修改库存模块

parent f741df7f
...@@ -76,3 +76,7 @@ Thumbs.db ...@@ -76,3 +76,7 @@ Thumbs.db
/.idea/dataSources.xml /.idea/dataSources.xml
/.idea/mybatisx/templates.xml /.idea/mybatisx/templates.xml
/.idea/dataSources.xml /.idea/dataSources.xml
/pom.xml
/.idea/compiler.xml
/.idea/modules.xml
/pom.xml
...@@ -9,15 +9,15 @@ ...@@ -9,15 +9,15 @@
<outputRelativeToContentRoot value="true" /> <outputRelativeToContentRoot value="true" />
<module name="jyzb-common" /> <module name="jyzb-common" />
<module name="jyzb-process" /> <module name="jyzb-process" />
<module name="jyzb-mq-consumer" />
<module name="jyzb-biz" /> <module name="jyzb-biz" />
<module name="jyzb-boot" /> <module name="jyzb-boot" />
<module name="jyzb-mq-producer" />
<module name="jyzb-api" /> <module name="jyzb-api" />
</profile> </profile>
</annotationProcessing> </annotationProcessing>
<bytecodeTargetLevel target="9"> <bytecodeTargetLevel target="9">
<module name="jyzb-mq" target="1.8" /> <module name="jyzb-mq" target="1.8" />
<module name="jyzb-mq-consumer" target="1.8" />
<module name="jyzb-mq-producer" target="1.8" />
</bytecodeTargetLevel> </bytecodeTargetLevel>
</component> </component>
<component name="JavacSettings"> <component name="JavacSettings">
......
...@@ -5,8 +5,6 @@ ...@@ -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-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-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-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> </modules>
</component> </component>
</project> </project>
\ No newline at end of file
...@@ -7,36 +7,20 @@ import java.math.BigDecimal; ...@@ -7,36 +7,20 @@ import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
/** /**
* 装备信息简要输出实体类,只包含部分字段 * 装备简要信息输出实体类,只包含部分字段
*/ */
@Data @Data
public class EqsBriefDto implements Serializable { public class EqsBriefDto implements Serializable {
/** private String id;
* epc
*/
private String epc;
/** /**
* 装备类型ID * 装备类型ID
*/ */
private String typeId; private String typeId;
/** /**
* 装备类型
*/
private String typeName;
/**
* 装备号型ID * 装备号型ID
*/ */
private String sizeId; private String sizeId;
/** /**
* 装备号型
*/
private String sizeName;
/**
* 供应商
*/
private String supplierName;
/**
* 供应商ID * 供应商ID
*/ */
private String supplierId; private String supplierId;
...@@ -44,29 +28,10 @@ public class EqsBriefDto implements Serializable { ...@@ -44,29 +28,10 @@ public class EqsBriefDto implements Serializable {
* 物资状态 * 物资状态
*/ */
private String state; 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 { ...@@ -77,7 +42,15 @@ public class EqsBriefDto implements Serializable {
*/ */
private String locationId ; 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; ...@@ -3,6 +3,7 @@ package com.junmp.jyzb.api.bean.dto;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
import java.util.List; import java.util.List;
@Data @Data
...@@ -36,6 +37,22 @@ public class InventorySumDto { ...@@ -36,6 +37,22 @@ public class InventorySumDto {
*/ */
private String sizeName; private String sizeName;
/** /**
* 位置信息id
*/
private String locationId;
/**
* 位置名称
*/
private String locationName;
/**
* 区域id
*/
private String locationAreaId;
/**
* 区域名称
*/
private String locationArea;
/**
*number 库存数量 *number 库存数量
*/ */
private Integer number; private Integer number;
...@@ -55,6 +72,22 @@ public class InventorySumDto { ...@@ -55,6 +72,22 @@ public class InventorySumDto {
*expireNumber 过质保数量 *expireNumber 过质保数量
*/ */
private Integer 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 { ...@@ -17,7 +17,7 @@ public class ShelfInventoryDto implements Serializable {
private String warehouseName; private String warehouseName;
/** /**
*货架名称 *区域名称
*/ */
private String shelfAreaName; private String shelfAreaName;
......
...@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
...@@ -16,6 +17,7 @@ public class CabinetBoxReq extends BaseRequest { ...@@ -16,6 +17,7 @@ public class CabinetBoxReq extends BaseRequest {
* 主键ID * 主键ID
*/ */
@ApiModelProperty(value = "主键ID") @ApiModelProperty(value = "主键ID")
@NotBlank(message = "箱门id不能为空",groups = {detail.class})
private String id; private String id;
/** /**
......
...@@ -20,12 +20,10 @@ public class EquipmentBindReq extends BaseRequest { ...@@ -20,12 +20,10 @@ public class EquipmentBindReq extends BaseRequest {
/** /**
* 单警柜箱号id * 单警柜箱号id
*/ */
@NotBlank(message = "单警柜id不能为空",groups = {edit.class})
private String cabinetId; private String cabinetId;
/** /**
* 单警柜箱号id * 单警柜箱号id
*/ */
@NotNull(message = "组织机构id不能为空",groups = {edit.class})
private Long orgId; private Long orgId;
/** /**
* 装备集合 * 装备集合
......
package com.junmp.jyzb.controller; package com.junmp.jyzb.controller;
import com.junmp.jyzb.api.bean.dto.EqsBriefDto; import com.junmp.jyzb.api.bean.dto.*;
import com.junmp.jyzb.api.bean.dto.InventoryDto; import com.junmp.jyzb.api.bean.query.*;
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.req.EquipmentBindReq; import com.junmp.jyzb.api.bean.req.EquipmentBindReq;
import com.junmp.jyzb.entity.InventorySummary; import com.junmp.jyzb.entity.InventorySummary;
import com.junmp.jyzb.service.InventoryService; import com.junmp.jyzb.service.*;
import com.junmp.jyzb.service.InventorySummaryService;
import com.junmp.jyzb.service.MQProductService;
import com.junmp.jyzb.utils.ResponseResult; import com.junmp.jyzb.utils.ResponseResult;
import com.junmp.v2.common.bean.request.ValidationApi; import com.junmp.v2.common.bean.request.ValidationApi;
import com.junmp.v2.common.bean.response.ApiRes; import com.junmp.v2.common.bean.response.ApiRes;
...@@ -36,6 +30,8 @@ public class InventoryController { ...@@ -36,6 +30,8 @@ public class InventoryController {
public InventorySummaryService inventorySummaryService; public InventorySummaryService inventorySummaryService;
@Resource @Resource
public MQProductService mqProductService; public MQProductService mqProductService;
@GetMapping("/testMQ") @GetMapping("/testMQ")
@ApiOperation("根据组织机构查询库存信息") @ApiOperation("根据组织机构查询库存信息")
public ApiRes<Boolean> testMQ( ) { public ApiRes<Boolean> testMQ( ) {
...@@ -44,26 +40,23 @@ public class InventoryController { ...@@ -44,26 +40,23 @@ public class InventoryController {
} }
//根据组织机构id/单警柜id/仓库id查询出库存的汇总信息 //根据组织机构id/单警柜id/仓库id查询出库存的汇总信息
@PostMapping("/GetEquipmentInfo") @PostMapping("/GetEquipmentInfo")
@ApiOperation("根据组织机构查询库存汇总信息") @ApiOperation("根据条件查询库存汇总信息")
public ApiRes<PageResult<InventorySummary>> getEquipmentInfo(@RequestBody @Validated(ValidationApi.edit.class) InventorySumReq req) { public ApiRes<PageResult<InventorySummary>> getEquipmentInfo(@RequestBody @Validated(ValidationApi.edit.class) InventorySumReq req) {
return ApiRes.success(inventorySummaryService.getEquipmentInfo(req)); return ApiRes.success(inventorySummaryService.getEquipmentInfo(req));
} }
//填充汇总信息
@PostMapping("/SetInventoryMsg") @PostMapping("/SetInventoryMsg")
@ApiOperation("填充汇总表信息") @ApiOperation("填充汇总表信息")
public ResponseResult setInventoryMsg() { public ApiRes<Boolean> setInventoryMsg() {
ResponseResult returnMsg = inventoryService.setInventoryMsg(); boolean result = inventoryService.setInventoryMsg();
return returnMsg; 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") @PostMapping("/getEquipmentInfo")
@ApiOperation("查询库存明细信息") @ApiOperation("查询库存明细信息")
public ResponseResult getEquipmentInfo(@RequestBody Map<String, Object> msg) { public ResponseResult getEquipmentInfo(@RequestBody Map<String, Object> msg) {
...@@ -71,17 +64,11 @@ public class InventoryController { ...@@ -71,17 +64,11 @@ public class InventoryController {
return returnMsg; return returnMsg;
} }
@PostMapping("/GetInventoryDevelop")
@ApiOperation("获取装备明细表所有信息")
public ResponseResult getInventoryDevelop() {
ResponseResult returnMsg = inventoryService.getInventoryDevelop();
return returnMsg;
}
@PostMapping("/InvertoryBind") @PostMapping("/EquipmentBind")
@ApiOperation("装备绑定箱门") @ApiOperation("装备绑定箱门")
public ApiRes<Boolean> InvertoryBind(@RequestBody @Validated(ValidationApi.edit.class) EquipmentBindReq req){ public ApiRes<Boolean> InventoryBind(@RequestBody @Validated(ValidationApi.edit.class) EquipmentBindReq req){
return ApiRes.success(inventoryService.InvertoryBind(req)); return ApiRes.success(inventoryService.InventoryBind(req));
} }
@PostMapping("/UpdateWarehouseInsNum") @PostMapping("/UpdateWarehouseInsNum")
...@@ -97,18 +84,19 @@ public class InventoryController { ...@@ -97,18 +84,19 @@ public class InventoryController {
} }
@PostMapping("/GetInvInfoByEpc") @PostMapping("/GetInvInfoByEpc")
@ApiOperation("根据EPC列表获取装备信息") @ApiOperation("根据EPC列表获取装备信息(简要)")
public ApiRes<List<EqsBriefDto>> GetInvInfoByEpc(@RequestBody InventoryReq req){ public ApiRes<List<EqsBriefDto>> GetInvInfoByEpc(@RequestBody InventoryReq req){
return ApiRes.success(inventoryService.GetInvInfoByEpc(req)); return ApiRes.success(inventoryService.GetInvInfoByEpc(req));
} }
//通过组织机构id获取装备详情信息(不是装备汇总信息)
@PostMapping("/GetInventoryByOrgId") @PostMapping("/GetInventoryByOrgId")
@ApiOperation("查询组织机构拥有装备") @ApiOperation("查询组织机构拥有装备详情列表")
public ApiRes<List<EqsBriefDto>> getInventoryByOrgId(@RequestBody @Validated(ValidationApi.detail.class) InventoryReq req){ public ApiRes<List<InventoryDto>> getInventoryByOrgId(@RequestBody @Validated(ValidationApi.detail.class) InventoryReq req){
return ApiRes.success(inventoryService.getInventoryByOrgId(req)); return ApiRes.success(inventoryService.getInventoryByOrgId(req));
} }
//根据组织机构/单警柜id/仓库id查询每件装备的详细信 //根据组织机构/单警柜id/仓库id查询每件装备细信的详
@PostMapping("/EqsBySearchType") @PostMapping("/EqsBySearchType")
@ApiOperation("根据传入信息查询装备信息") @ApiOperation("根据传入信息查询装备信息")
public ApiRes<List<InventoryDto>> EqsBySearchType(@RequestBody @Validated(ValidationApi.edit.class) InventoryReq req ){ public ApiRes<List<InventoryDto>> EqsBySearchType(@RequestBody @Validated(ValidationApi.edit.class) InventoryReq req ){
...@@ -116,4 +104,48 @@ public class InventoryController { ...@@ -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 { ...@@ -105,18 +105,6 @@ public class WarehouseController {
return ApiRes.success(warehouseAreaService.getAreaList(req)); 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") @PostMapping("/AddShelf")
@ApiOperation("添加货架") @ApiOperation("添加货架")
...@@ -143,17 +131,4 @@ public class WarehouseController { ...@@ -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 { ...@@ -161,11 +161,6 @@ public class InventorySummary implements Serializable {
@TableField("one_id") @TableField("one_id")
private String oneId; private String oneId;
/**
* 货架id
*/
@ApiModelProperty("货架id")
private String locationShelfId;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }
\ No newline at end of file
...@@ -18,13 +18,13 @@ public interface InventoryMapper extends BaseMapper<Inventory> { ...@@ -18,13 +18,13 @@ public interface InventoryMapper extends BaseMapper<Inventory> {
List<Map<String, Object>> getLocationInventory(@Param("queryType")String queryType, @Param("idMsg")String idMsg); List<Map<String, Object>> getLocationInventory(@Param("queryType")String queryType, @Param("idMsg")String idMsg);
void deleteAllMsg(); boolean deleteAllMsg();
void setOrgInventory(); boolean SetCabinetInventory();
void setCabinetInventory(); boolean SetWarehouseInventory();
void setWarehouseInventory();
List<InventoryDto> EqsBySearchType(InventoryReq req); List<InventoryDto> EqsBySearchType(InventoryReq req);
} }
\ No newline at end of file
package com.junmp.jyzb.service; package com.junmp.jyzb.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.junmp.jyzb.api.bean.dto.EqsBriefDto; import com.junmp.jyzb.api.bean.dto.*;
import com.junmp.jyzb.api.bean.dto.InventoryDto; import com.junmp.jyzb.api.bean.query.*;
import com.junmp.jyzb.api.bean.query.CabinetReq;
import com.junmp.jyzb.api.bean.query.InventoryReq;
import com.junmp.jyzb.api.bean.query.WarehouseReq;
import com.junmp.jyzb.api.bean.req.EquipmentBindReq; import com.junmp.jyzb.api.bean.req.EquipmentBindReq;
import com.junmp.jyzb.entity.Inventory; import com.junmp.jyzb.entity.Inventory;
import com.junmp.jyzb.utils.ResponseResult; import com.junmp.jyzb.utils.ResponseResult;
...@@ -19,20 +16,37 @@ public interface InventoryService extends IService<Inventory> { ...@@ -19,20 +16,37 @@ public interface InventoryService extends IService<Inventory> {
ResponseResult getEquipmentInfo(Map<String, Object> msg); 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 UpdateWarehouseInsNum(WarehouseReq req);
boolean UpdateCabinetInsNum(CabinetReq req); boolean UpdateCabinetInsNum(CabinetReq req);
boolean InvertoryBind(EquipmentBindReq req); boolean InventoryBind(EquipmentBindReq req);
List<EqsBriefDto> GetInvInfoByEpc(InventoryReq req); List<EqsBriefDto> GetInvInfoByEpc(InventoryReq req);
List<InventoryDto> EqsBySearchType(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; ...@@ -7,6 +7,7 @@ import com.junmp.v2.db.api.page.PageResult;
public interface InventorySummaryService extends IService<InventorySummary> { public interface InventorySummaryService extends IService<InventorySummary> {
//根据条件查询库存汇总信息
PageResult<InventorySummary> getEquipmentInfo(InventorySumReq req); PageResult<InventorySummary> getEquipmentInfo(InventorySumReq req);
} }
...@@ -19,9 +19,5 @@ public interface ShelfService extends IService<Shelf> { ...@@ -19,9 +19,5 @@ public interface ShelfService extends IService<Shelf> {
List<ShelfDto> GetShelfList(ShelfReq req); List<ShelfDto> GetShelfList(ShelfReq req);
//通过货架id查询装备信息汇总 Shelf ShelfExist(String id);
ShelfInventoryDto ShelfInventoryList(ShelfReq req);
//通过货架id查询装备详细信息
ShelfInsDto ShelfInventoryDetail(ShelfReq req);
} }
...@@ -26,11 +26,7 @@ public interface WarehouseAreaService extends IService<WarehouseArea> { ...@@ -26,11 +26,7 @@ public interface WarehouseAreaService extends IService<WarehouseArea> {
//判断区域是都存在(通用方法) //判断区域是都存在(通用方法)
WarehouseArea WarehouseAreaExist(String id); 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 ...@@ -60,6 +60,7 @@ public class CabinetBoxServiceImpl extends ServiceImpl<CabinetBoxMapper, Cabinet
if (ObjectUtil.isNotNull(one)){ if (ObjectUtil.isNotNull(one)){
throw new ServiceException(CabinetBoxExceptionEnum.CABINETBOX_IS_EXISTS); throw new ServiceException(CabinetBoxExceptionEnum.CABINETBOX_IS_EXISTS);
} }
CabinetBoxExist(req.getId());
CabinetBox cabinetBox = new CabinetBox(); CabinetBox cabinetBox = new CabinetBox();
BeanPlusUtil.copyProperties(req,cabinetBox); BeanPlusUtil.copyProperties(req,cabinetBox);
//添加单警柜箱门信息默认状态为1 //添加单警柜箱门信息默认状态为1
......
...@@ -91,8 +91,10 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl ...@@ -91,8 +91,10 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
//添加单警柜 //添加单警柜
save(cabinet); save(cabinet);
List<CabinetBox> objects = new ArrayList<>(); 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值是否传递,如果没有不做操作 //判断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++) { for (int i = 1; i <= req.getNum(); i++) {
CabinetBox cabinetBox = new CabinetBox(); CabinetBox cabinetBox = new CabinetBox();
cabinetBox.setCabinetId(cabinet.getId()); cabinetBox.setCabinetId(cabinet.getId());
...@@ -102,6 +104,8 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl ...@@ -102,6 +104,8 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
objects.add(cabinetBox); objects.add(cabinetBox);
} }
cabinetBoxService.saveBatch(objects); cabinetBoxService.saveBatch(objects);
}else if (ObjectUtil.isNotNull(req.getNum()) && req.getNum().intValue()<1){
throw new ServiceException(CabinetExceptionEnum.PARAMETER_ERROR);
} }
return cabinet.getId(); return cabinet.getId();
......
...@@ -2,23 +2,18 @@ package com.junmp.jyzb.service.impl; ...@@ -2,23 +2,18 @@ package com.junmp.jyzb.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.junmp.jyzb.api.bean.dto.EqsBriefDto; import com.junmp.jyzb.api.bean.dto.*;
import com.junmp.jyzb.api.bean.dto.InventoryDto; import com.junmp.jyzb.api.bean.query.*;
import com.junmp.jyzb.api.bean.query.CabinetReq;
import com.junmp.jyzb.api.bean.query.InventoryReq;
import com.junmp.jyzb.api.bean.query.WarehouseReq;
import com.junmp.jyzb.api.bean.req.EquipmentBindReq; import com.junmp.jyzb.api.bean.req.EquipmentBindReq;
import com.junmp.jyzb.api.exception.enums.CabinetBoxExceptionEnum; import com.junmp.jyzb.api.exception.enums.CabinetBoxExceptionEnum;
import com.junmp.jyzb.api.exception.enums.CabinetExceptionEnum; import com.junmp.jyzb.api.exception.enums.CabinetExceptionEnum;
import com.junmp.jyzb.api.exception.enums.InventoryExceptionEnum; import com.junmp.jyzb.api.exception.enums.InventoryExceptionEnum;
import com.junmp.jyzb.entity.Cabinet; import com.junmp.jyzb.entity.*;
import com.junmp.jyzb.entity.CabinetBox;
import com.junmp.jyzb.entity.Inventory;
import com.junmp.jyzb.entity.Warehouse;
import com.junmp.jyzb.service.*; import com.junmp.jyzb.service.*;
import com.junmp.jyzb.utils.HttpStatus; import com.junmp.jyzb.utils.HttpStatus;
import com.junmp.jyzb.utils.ResponseResult; import com.junmp.jyzb.utils.ResponseResult;
...@@ -62,6 +57,14 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory ...@@ -62,6 +57,14 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
@Resource @Resource
private SupplierService supplierService; private SupplierService supplierService;
@Resource
private ShelfService shelfService;
@Resource
private WarehouseAreaService warehouseAreaService;
@Resource
private InventorySummaryService inventorySummaryService;
@Override @Override
public InventoryDto getInventoryDetail(InventoryReq req) { public InventoryDto getInventoryDetail(InventoryReq req) {
...@@ -198,47 +201,45 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory ...@@ -198,47 +201,45 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
} }
@Override @Override
public ResponseResult setInventoryMsg(){ @Transactional(rollbackFor = Exception.class)
inventoryMapper.deleteAllMsg(); //清空数据库中已存在的信息 public boolean setInventoryMsg(){
//清空数据库中已存在的信息
inventoryMapper.setOrgInventory(); //放入组织机构信息汇总 inventoryMapper.deleteAllMsg();
//放入单警柜信息汇总
inventoryMapper.setCabinetInventory(); //放入单警柜信息汇总 boolean b = inventoryMapper.SetCabinetInventory();
//放入仓库信息汇总
inventoryMapper.setWarehouseInventory(); //放入仓库信息汇总 boolean b1 = inventoryMapper.SetWarehouseInventory();
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS); if (b && b1){
return true;
}else{
return false;
}
} }
@Override @Override
public List<EqsBriefDto> getInventoryByOrgId(InventoryReq req) { public List<InventoryDto> getInventoryByOrgId(InventoryReq req) {
//判断组织机构是否存在 //判断组织机构是否存在
pubOrgService.PubOrgExist(req.getOrgId()); pubOrgService.PubOrgExist(req.getOrgId());
List<EqsBriefDto> eqsBriefDtoList =new ArrayList<>(); List<InventoryDto> eqsBriefDtoList =new ArrayList<>();
List<Inventory> list = list(new LambdaQueryWrapper<Inventory>() List<Inventory> list = list(new LambdaQueryWrapper<Inventory>()
.eq(Inventory::getOrgId, req.getOrgId())); .eq(Inventory::getOrgId, req.getOrgId()));
for (Inventory inventory:list) { for (Inventory inventory:list) {
EqsBriefDto eqsBriefDto = new EqsBriefDto(); InventoryDto inventoryDto = new InventoryDto();
BeanPlusUtil.copyProperties(inventory, eqsBriefDto); BeanPlusUtil.copyProperties(inventory, inventoryDto);
//设置型号名称,类别名称,供应商名称 //设置型号名称,类别名称,供应商名称
String sizeName = equipmentSizeService.getById(inventory.getSizeId()).getName(); String sizeName = equipmentSizeService.getById(inventory.getSizeId()).getName();
String typeName = equipmentTypeService.getById(inventory.getTypeId()).getName(); String typeName = equipmentTypeService.getById(inventory.getTypeId()).getName();
String supplierName = supplierService.getById(inventory.getSupplierId()).getName(); String supplierName = supplierService.getById(inventory.getSupplierId()).getName();
eqsBriefDto.setSizeName(sizeName); inventoryDto.setSizeName(sizeName);
eqsBriefDto.setTypeName(typeName); inventoryDto.setTypeName(typeName);
eqsBriefDto.setSupplierName(supplierName); inventoryDto.setSupplierName(supplierName);
eqsBriefDtoList.add(eqsBriefDto); eqsBriefDtoList.add(inventoryDto);
} }
return eqsBriefDtoList; return eqsBriefDtoList;
} }
@Override
public ResponseResult getInventoryDevelop() {
return null;
}
//设置仓库库存数量(总数,在库数,出库数,价格) //设置仓库库存数量(总数,在库数,出库数,价格)
@Override @Override
public boolean UpdateWarehouseInsNum(WarehouseReq req) { public boolean UpdateWarehouseInsNum(WarehouseReq req) {
...@@ -258,7 +259,7 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory ...@@ -258,7 +259,7 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
//装备绑定箱门 //装备绑定箱门
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean InvertoryBind(EquipmentBindReq req) { public boolean InventoryBind(EquipmentBindReq req) {
//判断箱门是否存在 //判断箱门是否存在
CabinetBox one = cabinetBoxService.getOne(new LambdaQueryWrapper<CabinetBox>() CabinetBox one = cabinetBoxService.getOne(new LambdaQueryWrapper<CabinetBox>()
.eq(CabinetBox::getCabinetId, req.getCabinetId()) .eq(CabinetBox::getCabinetId, req.getCabinetId())
...@@ -276,13 +277,14 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory ...@@ -276,13 +277,14 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
for (InventoryReq inventoryReq: equipmentList) { for (InventoryReq inventoryReq: equipmentList) {
Inventory inventory = new Inventory(); Inventory inventory = new Inventory();
BeanPlusUtil.copyProperties(inventoryReq,inventory); BeanPlusUtil.copyProperties(inventoryReq,inventory);
//将装备的货架id当成成箱门id(可以通过location_type来区别是单警柜的箱门id还是仓库的货架id)
inventory.setShelfId(req.getCabinetBoxId()); inventory.setShelfId(req.getCabinetBoxId());
inventoryList.add(inventory); inventoryList.add(inventory);
} }
return updateBatchById(inventoryList); return updateBatchById(inventoryList);
} }
//根据Epc查询装备信息 //根据Epc查询装备信息(简要信息)
@Override @Override
public List<EqsBriefDto> GetInvInfoByEpc(InventoryReq req) { public List<EqsBriefDto> GetInvInfoByEpc(InventoryReq req) {
List<EqsBriefDto> eqsBriefDtoList =new ArrayList<>(); List<EqsBriefDto> eqsBriefDtoList =new ArrayList<>();
...@@ -333,6 +335,25 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory ...@@ -333,6 +335,25 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
return inventoryDtos; return inventoryDtos;
} }
//查询箱门(cabinetBox下)所有装备简要信息列表(传递cabinetBoxId)
@Override
public List<EqsBriefDto> searchEqsByBoxId(CabinetBoxReq req) {
List<Inventory> list = list(new LambdaQueryWrapper<Inventory>()
.eq(Inventory::getLocationId, req.getId()));
if (list.size()==0){
throw new ServiceException(CabinetBoxExceptionEnum.CABINETBOX_ISNOT_EXISTS);
}
List<EqsBriefDto> eqsBriefDtoList=new ArrayList<>();
Iterator<Inventory> iterator = list.iterator();
while (iterator.hasNext()){
Inventory next = iterator.next();
EqsBriefDto eqsBriefDto = new EqsBriefDto();
BeanPlusUtil.copyProperties(next,eqsBriefDto);
eqsBriefDtoList.add(eqsBriefDto);
}
return eqsBriefDtoList;
}
/** /**
* @Author: Zhaojw * @Author: Zhaojw
...@@ -355,4 +376,73 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory ...@@ -355,4 +376,73 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
wrapper.orderByDesc(Inventory::getUpdateTime); wrapper.orderByDesc(Inventory::getUpdateTime);
return wrapper; return wrapper;
} }
@Override
public ShelfInventoryDto ShelfInventoryList(ShelfReq req) {
//判断货架是否存在
Shelf shelf = shelfService.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 List<EqsBriefDto> ShelfInventoryDetail(ShelfReq req) {
//判断货架是否存在
Shelf shelf = shelfService.ShelfExist(req.getShelfId());
warehouseService.WarehoustExist(shelf.getWarehouseId());
List<Inventory> list = list(new LambdaQueryWrapper<Inventory>()
.eq(Inventory::getShelfId, req.getShelfId()));
List<EqsBriefDto> eqsBriefDtoList = JSON.parseArray(JSON.toJSONString(list), EqsBriefDto.class);
return eqsBriefDtoList;
}
/**
* 通过区域id查询装备汇总信息
* @param req
* @return
*/
@Override
public AreaInventoryDto AreaInventoryList(WarehouseAreaReq req) {
//判断区域是否存在
WarehouseArea warehouseArea = warehouseAreaService.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;
}
} }
\ No newline at end of file
...@@ -25,6 +25,7 @@ public class InventorySummaryServiceImpl extends ServiceImpl<InventorySummaryMa ...@@ -25,6 +25,7 @@ public class InventorySummaryServiceImpl extends ServiceImpl<InventorySummaryMa
@Resource @Resource
private PubOrgService pubOrgService; private PubOrgService pubOrgService;
//根据条件查询库存汇总信息
@Override @Override
public PageResult<InventorySummary> getEquipmentInfo(InventorySumReq req) { public PageResult<InventorySummary> getEquipmentInfo(InventorySumReq req) {
//判断传递参数是否不为空 //判断传递参数是否不为空
......
...@@ -29,11 +29,6 @@ public class ShelfServiceImpl extends ServiceImpl<ShelfMapper, Shelf> implements ...@@ -29,11 +29,6 @@ public class ShelfServiceImpl extends ServiceImpl<ShelfMapper, Shelf> implements
private WarehouseService warehouseService; private WarehouseService warehouseService;
@Resource @Resource
private WarehouseAreaService warehouseAreaService; private WarehouseAreaService warehouseAreaService;
@Resource
private InventorySummaryService inventorySummaryService;
@Resource
private InventoryService inventoryService;
@Override @Override
public String AddShelf(UpdateShelfReq req) { public String AddShelf(UpdateShelfReq req) {
...@@ -85,81 +80,14 @@ public class ShelfServiceImpl extends ServiceImpl<ShelfMapper, Shelf> implements ...@@ -85,81 +80,14 @@ public class ShelfServiceImpl extends ServiceImpl<ShelfMapper, Shelf> implements
} }
return shelfDtoList; 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是否存在 * 判断货架id是否存在
* @param * @param
* @return * @return
*/ */
private Shelf ShelfExist(String id) { public Shelf ShelfExist(String id) {
Shelf shelf = this.getById(id); Shelf shelf = this.getById(id);
if (ObjectUtil.isNull(shelf)) { if (ObjectUtil.isNull(shelf)) {
throw new ServiceException(ShelfExceptionEnum.SHELF_NOT_EXIST); throw new ServiceException(ShelfExceptionEnum.SHELF_NOT_EXIST);
......
...@@ -124,78 +124,7 @@ public class WarehouseAreaServiceImpl extends ServiceImpl<WarehouseAreaMapper, W ...@@ -124,78 +124,7 @@ public class WarehouseAreaServiceImpl extends ServiceImpl<WarehouseAreaMapper, W
return warehouseArea; 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 @@ ...@@ -82,77 +82,49 @@
delete from base_inventory_summary delete from base_inventory_summary
</delete> </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 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) 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 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, UUID() as id,
bi.org_id_int as orgIdInt, bi.org_id_int as orgId,
po.org_name as orgName, po.org_name as orgName,
bi.location_id as locationId,
bc.name as locationName,
bi.type_id, bi.type_id,
t.name as typeName, t.name as typeName,
bi.size_id, bi.size_id,
s.name as sizeName, s.name as sizeName,
count(*) as 'number', bi.location_id as locationId,
sum(bi.price) as 'price', bc.name as locationName,
SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS 'stockNumber', count(*) as number,
count(*) - SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS 'outboundNumber', sum(bi.price) as price,
bi.location_type SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS stockNumber,
FROM base_inventory bi 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_box bcb on bi.location_id = bcb.id
join base_cabinet bc on bcb.cabinet_id = bc.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_type t on t.id = bi.type_id
join base_equipment_size s on s.id = bi.size_id join base_equipment_size s on s.id = bi.size_id
join pub_org po on bi.org_id_int = po.org_id join pub_org po on bi.org_id_int = po.org_id
WHERE location_id IN ( WHERE location_id IN (
SELECT location_id SELECT location_id
FROM base_inventory FROM base_inventory
GROUP BY location_id,type_id GROUP BY location_id,type_id
having type_id in( having type_id in(
SELECT SELECT
type_id as 'typeId' type_id
FROM base_inventory b FROM base_inventory b
GROUP BY type_id GROUP BY type_id
) )
) )
and location_type = 1 and location_type = 1
GROUP BY location_id, type_id,size_id,bi.org_id_int; GROUP BY location_id, type_id,size_id,bi.org_id_int,shelf_id) as t
</insert> </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) 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 SELECT
UUID() as id, UUID() as id,
...@@ -164,10 +136,10 @@ SELECT ...@@ -164,10 +136,10 @@ SELECT
t.name as typeName, t.name as typeName,
bi.size_id, bi.size_id,
s.name as sizeName, s.name as sizeName,
count(*) as 'number', count(*) as number,
sum(bi.price) as 'price', sum(bi.price) as price,
SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS 'stockNumber', 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(*) - SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS outboundNumber,
bi.location_type bi.location_type
FROM base_inventory bi FROM base_inventory bi
join base_warehouse bw on bi.location_id = bw.id join base_warehouse bw on bi.location_id = bw.id
...@@ -189,7 +161,7 @@ and location_type = 0 ...@@ -189,7 +161,7 @@ and location_type = 0
GROUP BY location_id, type_id,size_id,bi.org_id_int; GROUP BY location_id, type_id,size_id,bi.org_id_int;
</insert> </insert>
<select id="EqsBySearchType" resultType="com.junmp.jyzb.api.bean.dto.InventoryDto"> <select id="EqsBySearchType" resultType="com.junmp.jyzb.api.bean.dto.InventoryDto">
select select
i.id as id, i.id as id,
i.package_id as package_id, i.package_id as package_id,
...@@ -204,6 +176,12 @@ GROUP BY location_id, type_id,size_id,bi.org_id_int; ...@@ -204,6 +176,12 @@ GROUP BY location_id, type_id,size_id,bi.org_id_int;
i.location_state as locationState, i.location_state as locationState,
i.production_date as productionDate, i.production_date as productionDate,
i.location_type as locationType, 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.location_id as locationId,
i.price as price, i.price as price,
i.shelf_id as shelfId, i.shelf_id as shelfId,
...@@ -226,6 +204,7 @@ GROUP BY location_id, type_id,size_id,bi.org_id_int; ...@@ -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_equipment_size es on es.id = i.size_id
join base_supplier s on s.id = i.supplier_id join base_supplier s on s.id = i.supplier_id
join pub_org po on i.org_id_int=po.org_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'"> <if test="queryType == 'org'">
where org_id_int = #{orgId} where org_id_int = #{orgId}
</if> </if>
...@@ -233,7 +212,7 @@ GROUP BY location_id, type_id,size_id,bi.org_id_int; ...@@ -233,7 +212,7 @@ GROUP BY location_id, type_id,size_id,bi.org_id_int;
where location_id = #{warehouseId} where location_id = #{warehouseId}
</if> </if>
<if test="queryType == 'cabinet'"> <if test="queryType == 'cabinet'">
where org_id_int = #{cabinetId} where location_id = #{cabinetId}
</if> </if>
</select> </select>
......
...@@ -24,12 +24,11 @@ ...@@ -24,12 +24,11 @@
<result column="expire_number" jdbcType="INTEGER" property="expireNumber" /> <result column="expire_number" jdbcType="INTEGER" property="expireNumber" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="location_shelf_id" jdbcType="VARCHAR" property="locationShelfId" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
<!--@mbg.generated--> <!--@mbg.generated-->
id, org_id, org_name, type_id, type_name, size_id, size_name, location_type, location_id, 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, 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> </sql>
</mapper> </mapper>
\ No newline at end of file
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
<module>jyzb-biz</module> <module>jyzb-biz</module>
<module>jyzb-process</module> <module>jyzb-process</module>
<module>jyzb-common</module> <module>jyzb-common</module>
<module>jyzb-mq</module>
</modules> </modules>
<parent> <parent>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论