Commit a5a6fd7d by 李小惠

修改仓库模块代码和库存模块代码,新增了个别接口

parent 41153705
...@@ -71,3 +71,5 @@ Thumbs.db ...@@ -71,3 +71,5 @@ Thumbs.db
/jyzb-mq/jyzb-mq-producer/jyzb-mq-producer.iml /jyzb-mq/jyzb-mq-producer/jyzb-mq-producer.iml
/jyzb-mq/jyzb-mq-consumer/jyzb-mq-consumer.iml /jyzb-mq/jyzb-mq-consumer/jyzb-mq-consumer.iml
/.idea/modules.xml /.idea/modules.xml
/.idea/compiler.xml
/.idea/modules.xml
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<project version="4"> <project version="4">
<component name="ProjectModuleManager"> <component name="ProjectModuleManager">
<modules> <modules>
<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-consumer/jyzb-mq-consumer.iml" filepath="$PROJECT_DIR$/jyzb-mq/jyzb-mq-consumer/jyzb-mq-consumer.iml" />
......
package com.junmp.jyzb.api.bean.dto;
import lombok.Data;
import java.util.List;
/**
* 根据区域id查询装备详细信息输出实体类
*/
@Data
public class AreaInsDto {
/**
* 仓库id
*/
private String warehouseId;
/**
* warehouseName
*/
private String warehouseName;
/**
*location 仓库地点
*/
private String warehouseLocation;
/**
*list 装备汇总列表
*/
private List<InventorySumDto> list;
}
package com.junmp.jyzb.api.bean.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 根据区域id查询装备汇总输出实体类
*/
@Data
public class AreaInventoryDto implements Serializable {
/**
* 仓库id
*/
private String warehouseId;
/**
* warehouseName
*/
private String warehouseName;
/**
*location 仓库地点
*/
private String warehouseLocation;
/**
* 区域名称
*/
private String warehouseAreaName;
/**
*list 装备汇总列表
*/
private List<InventorySumDto> list;
}
package com.junmp.jyzb.api.bean.dto;
import cn.hutool.core.date.DateTime;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 装备信息粗略输出实体类,只包含部分字段
*/
@Data
public class EqsSummaryDto implements Serializable {
/**
* epc
*/
private String epc;
/**
* 装备类型ID
*/
private String typeId;
/**
* 装备类型
*/
private String typeName;
/**
* 装备号型ID
*/
private String sizeId;
/**
* 装备号型
*/
private String sizeName;
/**
* 供应商
*/
private String supplierName;
/**
* 供应商ID
*/
private String supplierId;
/**
* 物资状态
*/
private String state;
/**
* 业务状态
*/
private String bussiness_state;
/**
* 位置状态
*/
private String locationState;
/**
* 质保期
*/
private long warrantyPeriod;
/**
* 维保期
*/
private Integer maintenancePeriod;
/**
* 价格
*/
private BigDecimal price ;
/**
* 位置类型
*/
private String locationType;
/**
* 位置ID
*/
private String locationId ;
/**
* 生产日期
*/
private Date productionDate;
}
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 ;
}
...@@ -2,28 +2,59 @@ package com.junmp.jyzb.api.bean.dto; ...@@ -2,28 +2,59 @@ package com.junmp.jyzb.api.bean.dto;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
@Data @Data
public class InventorySumDto { public class InventorySumDto {
/** /**
* 组织机构 * id 装备汇总id
*/ */
private String OrgName; private String id;
/** /**
* 位置 *orgId 组织机构id
*/ */
private String locationType; private Long orgId;
/** /**
*总数 *orgName 组织机构名称
*/ */
private int Num; private String orgName;
/** /**
*总价 *typeId 装备类型id
*/ */
private int totalPrice; private String typeId;
/**
*typeName 装备类型名称
*/
private String typeName;
/**
*sizeId 装备型号id
*/
private String sizeId;
/**
*sizeName 装备型号名称
*/
private String sizeName;
/**
*number 库存数量
*/
private Integer number;
/**
*price 总价
*/
private BigDecimal price;
/**
*stockNumber 在库数
*/
private Integer stockNumber;
/**
*outboundNumber 出库数量
*/
private Integer outboundNumber;
/**
*expireNumber 过质保数量
*/
private Integer expireNumber;
private List<InsDetailDto> detailList;
} }
package com.junmp.jyzb.api.bean.dto;
import lombok.Data;
import java.util.List;
@Data
public class ShelfInsDto {
/**
* 仓库id
*/
private String warehouseId;
/**
* warehouseName
*/
private String warehouseName;
/**
*location 仓库地点
*/
private String warehouseLocation;
/**
*list 装备汇总列表
*/
private List<InventorySumDto> list;
}
package com.junmp.jyzb.api.bean.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class ShelfInventoryDto implements Serializable {
/**
* 仓库id
*/
private String warehouseId;
/**
*仓库名称
*/
private String warehouseName;
/**
*货架名称
*/
private String shelfAreaName;
/**
*仓库地点
*/
private String warehouseLocation;
/**
* 装备汇总list
*/
private List<InventorySumDto> list;
}
...@@ -6,7 +6,7 @@ import java.io.Serializable; ...@@ -6,7 +6,7 @@ import java.io.Serializable;
@Data @Data
public class WarehouseAreaDto implements Serializable { public class WarehouseAreaDto implements Serializable {
private String id; private String areaId;
private String areaName; private String areaName;
......
package com.junmp.jyzb.api.bean.query; package com.junmp.jyzb.api.bean.query;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.junmp.v2.common.bean.request.BaseRequest; import com.junmp.v2.common.bean.request.BaseRequest;
import com.junmp.v2.common.bean.request.ValidationApi; import com.junmp.v2.common.bean.request.ValidationApi;
import com.junmp.v2.validator.api.validators.unique.TableUniqueValue; import com.junmp.v2.validator.api.validators.unique.TableUniqueValue;
...@@ -11,6 +13,8 @@ import javax.validation.constraints.NotBlank; ...@@ -11,6 +13,8 @@ import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class InventoryReq extends BaseRequest { public class InventoryReq extends BaseRequest {
...@@ -47,6 +51,10 @@ public class InventoryReq extends BaseRequest { ...@@ -47,6 +51,10 @@ public class InventoryReq extends BaseRequest {
* 部门ID * 部门ID
*/ */
private long departmentId; private long departmentId;
/**
* 货架位置
*/
private String shelfLocation;
/** /**
* 货架位置 * 货架位置
...@@ -61,7 +69,8 @@ public class InventoryReq extends BaseRequest { ...@@ -61,7 +69,8 @@ public class InventoryReq extends BaseRequest {
/** /**
* 组织机构ID * 组织机构ID
*/ */
private String orgId; @NotNull(message = "组织机构id不能为空", groups = {detail.class})
private Long orgId;
/** /**
* 物资状态 * 物资状态
...@@ -84,9 +93,25 @@ public class InventoryReq extends BaseRequest { ...@@ -84,9 +93,25 @@ public class InventoryReq extends BaseRequest {
*/ */
private DateTime productionDate; private DateTime productionDate;
/**
* 质保期
*/
private long warrantyPeriod;
/**
* 维保期
*/
private Integer maintenancePeriod;
/** /**
* 维修次数
*/
private Integer fixCount;
/**
* 维修次数
*/
private int TermState;
/**
* 位置类型 * 位置类型
*/ */
private String locationType; private String locationType;
...@@ -99,4 +124,43 @@ public class InventoryReq extends BaseRequest { ...@@ -99,4 +124,43 @@ public class InventoryReq extends BaseRequest {
* 是否遗失 * 是否遗失
*/ */
private int lostFlag ; private int lostFlag ;
/**
* 价格
*/
private BigDecimal price ;
/**
* 标签id
*/
private String tid ;
/**
* 备注
*/
private String note ;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 更新人员
*/
private String updateUser;
/**
* 创建人员
*/
private String createUser;
/**
* EPC集合
*/
private List<String> epcList;
} }
...@@ -10,9 +10,10 @@ import javax.validation.constraints.NotBlank; ...@@ -10,9 +10,10 @@ import javax.validation.constraints.NotBlank;
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class ShelfReq extends BaseRequest { public class ShelfReq extends BaseRequest {
@NotBlank(message = "货架id不能为空",groups = {edit.class})
private String shelfId; private String shelfId;
private Long areaId; private String areaId;
private String shelfName; private String shelfName;
......
...@@ -10,13 +10,14 @@ import java.util.Date; ...@@ -10,13 +10,14 @@ import java.util.Date;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class WarehouseAreaReq extends BaseRequest { public class WarehouseAreaReq extends BaseRequest {
@NotBlank(message = "地区主键不能为空", groups = {edit.class, delete.class, detail.class}) @NotBlank(message = "区域主键不能为空", groups = {edit.class})
private String id; private String id;
private String areaName; private String areaName;
private Long orgIdInt; private Long orgId;
@NotBlank(message = "仓库id不能为空", groups = {detail.class})
private String warehouseId; private String warehouseId;
private String photo; private String photo;
......
...@@ -16,8 +16,6 @@ public class WarehouseReq extends BaseRequest { ...@@ -16,8 +16,6 @@ public class WarehouseReq extends BaseRequest {
@NotBlank(message = "仓库主键不能为空", groups = {updateStatus.class, delete.class, detail.class}) @NotBlank(message = "仓库主键不能为空", groups = {updateStatus.class, delete.class, detail.class})
private String id; private String id;
private Long departmentId;
private String name; private String name;
private String location; private String location;
...@@ -50,6 +48,5 @@ public class WarehouseReq extends BaseRequest { ...@@ -50,6 +48,5 @@ public class WarehouseReq extends BaseRequest {
private Long orderId; private Long orderId;
@NotBlank(message = "IncludeLowerLevel不能为空", groups = {edit.class})
private String IncludeLowerLevel; private String IncludeLowerLevel;
} }
\ No newline at end of file
package com.junmp.jyzb.api.bean.req;
import com.junmp.jyzb.api.bean.query.InventoryReq;
import com.junmp.v2.common.bean.request.BaseRequest;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
@EqualsAndHashCode(callSuper = true)
public class EquipmentBindReq extends BaseRequest {
/**
* 单警柜箱号id
*/
@NotBlank(message = "箱号id不能为空",groups = {edit.class})
private String cabinetBoxId;
/**
* 单警柜箱号id
*/
@NotBlank(message = "单警柜id不能为空",groups = {edit.class})
private String cabinetId;
/**
* 单警柜箱号id
*/
@NotNull(message = "组织机构id不能为空",groups = {edit.class})
private Long orgId;
/**
* 装备集合
*/
List<InventoryReq> equipmentList;
}
...@@ -22,6 +22,5 @@ public class UpdateCabinetBoxReq extends BaseRequest { ...@@ -22,6 +22,5 @@ public class UpdateCabinetBoxReq extends BaseRequest {
@NotBlank(message = "单警柜编号不能为空",groups = {add.class}) @NotBlank(message = "单警柜编号不能为空",groups = {add.class})
private String cabinetNum; private String cabinetNum;
@NotNull(message = "箱号不能为空",groups = {add.class})
private Integer num; private Integer num;
} }
...@@ -2,16 +2,19 @@ package com.junmp.jyzb.api.bean.req; ...@@ -2,16 +2,19 @@ package com.junmp.jyzb.api.bean.req;
import com.junmp.v2.common.bean.request.BaseRequest; import com.junmp.v2.common.bean.request.BaseRequest;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
@Data @Data
@EqualsAndHashCode(callSuper = true)
public class UpdateShelfReq extends BaseRequest { public class UpdateShelfReq extends BaseRequest {
@NotBlank(message = "货架id不能为空",groups = {edit.class, delete.class}) @NotBlank(message = "货架id不能为空",groups = {edit.class, delete.class})
private String shelfId; private String shelfId;
private Long areaId; @NotNull(message = "区域id不能为空",groups = {add.class})
private String areaId;
@NotBlank(message = "货架名称不能为空",groups = {add.class,edit.class}) @NotBlank(message = "货架名称不能为空",groups = {add.class,edit.class})
private String shelfName; private String shelfName;
...@@ -41,4 +44,6 @@ public class UpdateShelfReq extends BaseRequest { ...@@ -41,4 +44,6 @@ public class UpdateShelfReq extends BaseRequest {
@NotBlank(message = "型号信息不能为空",groups = {add.class,edit.class}) @NotBlank(message = "型号信息不能为空",groups = {add.class,edit.class})
private String sizeInfo; private String sizeInfo;
private static final long serialVersionUID = 1L;
} }
...@@ -10,15 +10,15 @@ import java.util.Date; ...@@ -10,15 +10,15 @@ import java.util.Date;
public class UpdateWarehouseAreaReq extends BaseRequest { public class UpdateWarehouseAreaReq extends BaseRequest {
@NotBlank(message = "地区主键不能为空", groups = {edit.class, delete.class, detail.class}) @NotBlank(message = "地区主键不能为空", groups = {edit.class, delete.class, detail.class})
private String areaId; private String areaId;
@NotBlank(message = "区域名称不能为空", groups = {add.class,edit.class, detail.class}) @NotBlank(message = "区域名称不能为空", groups = {add.class,edit.class})
private String areaName; private String areaName;
private Long orgIdInt; private Long orgId;
@NotBlank(message = "仓库id不能为空", groups = {add.class,edit.class, detail.class}) @NotBlank(message = "仓库id不能为空", groups = {add.class,edit.class})
private String warehouseId; private String warehouseId;
@NotBlank(message = "照片不能为空", groups = {add.class,edit.class, detail.class}) @NotBlank(message = "照片不能为空", groups = {add.class,edit.class})
private String photo; private String photo;
private Date createTime; private Date createTime;
......
package com.junmp.jyzb.api.bean.req; package com.junmp.jyzb.api.bean.req;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.junmp.v2.common.bean.request.BaseRequest; import com.junmp.v2.common.bean.request.BaseRequest;
import lombok.Data; import lombok.Data;
...@@ -14,18 +12,16 @@ import java.util.List; ...@@ -14,18 +12,16 @@ import java.util.List;
@Data @Data
public class UpdateWarehouseReq extends BaseRequest { public class UpdateWarehouseReq extends BaseRequest {
@NotBlank(message = "仓库主键不能为空", groups = {edit.class, detail.class}) @NotBlank(message = "仓库主键不能为空", groups = {edit.class})
private String id; private String id;
private Long departmentId; @NotBlank(message = "仓库名称不能为空", groups = {add.class,edit.class})
@NotBlank(message = "仓库名称不能为空", groups = {add.class,edit.class, detail.class})
private String name; private String name;
@NotBlank(message = "仓库地点不能为空", groups = {add.class,edit.class, detail.class}) @NotBlank(message = "仓库地点不能为空", groups = {add.class,edit.class})
private String location; private String location;
@NotBlank(message = "联系方式不能为空", groups = {add.class,edit.class, detail.class}) @NotBlank(message = "联系方式不能为空", groups = {add.class,edit.class})
private String phone; private String phone;
private String video; private String video;
...@@ -36,7 +32,7 @@ public class UpdateWarehouseReq extends BaseRequest { ...@@ -36,7 +32,7 @@ public class UpdateWarehouseReq extends BaseRequest {
private String updateUser; private String updateUser;
@NotNull(message = "组织机构id不能为空", groups = {add.class,edit.class, detail.class}) @NotNull(message = "组织机构id不能为空", groups = {add.class,edit.class})
private Long orgId; private Long orgId;
private Boolean isLocked; private Boolean isLocked;
......
...@@ -32,7 +32,7 @@ public enum CabinetExceptionEnum implements IExceptionEnum { ...@@ -32,7 +32,7 @@ public enum CabinetExceptionEnum implements IExceptionEnum {
/** /**
* 传入参数错误 * 传入参数错误
*/ */
PARAMETER_ERROR(CommonConstant.DEFAULT_USER_ERROR_CODE,"传入参数错误"), PARAMETER_ERROR(CommonConstant.DEFAULT_USER_ERROR_CODE,"传入参数错误,或为空"),
/** /**
* 箱门id不存在 * 箱门id不存在
......
package com.junmp.jyzb.api.exception.enums;
import com.junmp.v2.common.constant.CommonConstant;
import com.junmp.v2.common.exception.IExceptionEnum;
import lombok.Getter;
@Getter
public enum InventoryExceptionEnum implements IExceptionEnum {
INVENTORY_NOT_EXIST(CommonConstant.DEFAULT_USER_ERROR_CODE,"装备信息不存在")
;
/**
* 错误编码
*/
private final Integer code;
/**
* 提示用户信息
*/
private final String message;
InventoryExceptionEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
}
...@@ -12,58 +12,7 @@ public enum ShelfExceptionEnum implements IExceptionEnum { ...@@ -12,58 +12,7 @@ public enum ShelfExceptionEnum implements IExceptionEnum {
*/ */
SHELF_NOT_EXIST(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 12, "货架信息不存在"), SHELF_NOT_EXIST(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 12, "货架信息不存在"),
/** ;
* 产品信息不存在
*/
PRODUCT_SKU_NOT_EXIST(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 13, "号型不存在"),
/**
* 批次信息不存在
*/
BATCH_NOT_EXIST(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 14, "批次不存在"),
/**
* 批次信息不存在
*/
BATCH_PROCESSED(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 15, "批次已生产"),
/**
* 批次生产已完成
*/
BATCH_PROCESSED_DONE(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 16, "批次生产已完成"),
/**
* 批次生产已完成
*/
MODIFY_NUM_ERROR(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 17, "批次生产已完成,数量不能小于原数量"),
/**
* 标签信息不存在
*/
TAG_INFO_NOT_EXISTS(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 19, "标签信息不存在"),
/**
* 标签信息初始化完成
*/
TAG_INFO_INIT_DONE(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 20, "检查标签信息是否绑定完成"),
/**
* 标签已绑定
*/
TAG_INFO_HAD_BINDING(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 21, "标签已绑定"),
/**
* 确认绑定是否已完成
*/
TAG_UID_BINDING_ERROR(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 22, "确认绑定是否已完成"),
/**
* 标签重复
*/
TAG_INFO_REPEAT_ERROR(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 23, "标签重复"),
;
/** /**
......
...@@ -14,11 +14,16 @@ public enum WarehouseAreaExceptionEnum implements IExceptionEnum { ...@@ -14,11 +14,16 @@ public enum WarehouseAreaExceptionEnum implements IExceptionEnum {
/** /**
* 区域已存在 * 区域已存在
*/ */
AREA_IS_EXISTS(CommonConstant.DEFAULT_USER_ERROR_CODE,"区域已经存在") AREA_IS_EXISTS(CommonConstant.DEFAULT_USER_ERROR_CODE,"区域已经存在"),
;
/**
* 该区域不属于该仓库中
*/
AREA_ERROR(CommonConstant.DEFAULT_USER_ERROR_CODE,"该区域不属于该仓库中")
; ;
/** /**
* 错误编码 * 错误编码
*/ */
......
package com.junmp.jyzb.config; package com.junmp.jyzb.config;
import com.baomidou.mybatisplus.annotation.DbType; import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@Configuration @Configuration
@MapperScan("com.junmp.jyzb.mapper*") @MapperScan("com.junmp.jyzb.mapper*")
public class MybatisPlusConfig { public class MybatisPlusConfig {
@Bean @Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() { public MybatisPlusInterceptor mybatisPlusInterceptor() {
...@@ -21,4 +21,5 @@ public class MybatisPlusConfig { ...@@ -21,4 +21,5 @@ public class MybatisPlusConfig {
return interceptor; return interceptor;
} }
} }
\ No newline at end of file
...@@ -25,11 +25,7 @@ public class CabinetBoxController { ...@@ -25,11 +25,7 @@ public class CabinetBoxController {
//添加箱门信息 //添加箱门信息
@PostMapping("/AddBoxInfo") @PostMapping("/AddBoxInfo")
@ApiOperation("添加箱门信息") @ApiOperation("添加箱门信息")
public ApiRes<Boolean> AddBoxInfo(@RequestBody @Validated(ValidationApi.add.class) UpdateCabinetBoxReq req){ public ApiRes<String> AddBoxInfo(@RequestBody @Validated(ValidationApi.add.class) UpdateCabinetBoxReq req){
boolean b = cabinetBoxService.AddBoxInfo(req); return ApiRes.success(cabinetBoxService.AddBoxInfo(req));
if (!b){
return ApiRes.failure("添加失败");
}
return ApiRes.success(b);
} }
} }
package com.junmp.jyzb.controller; package com.junmp.jyzb.controller;
import com.junmp.jyzb.api.bean.dto.EqsSummaryDto;
import com.junmp.jyzb.api.bean.dto.InventoryDto; 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.InventoryReq;
import com.junmp.jyzb.api.bean.query.InventorySumReq; 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.entity.InventorySummary; import com.junmp.jyzb.entity.InventorySummary;
import com.junmp.jyzb.service.InventoryService; import com.junmp.jyzb.service.InventoryService;
import com.junmp.jyzb.service.InventorySummaryService; import com.junmp.jyzb.service.InventorySummaryService;
...@@ -18,6 +22,7 @@ import org.springframework.validation.annotation.Validated; ...@@ -18,6 +22,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
import java.util.Map; import java.util.Map;
@RestController @RestController
...@@ -42,6 +47,12 @@ public class InventoryController { ...@@ -42,6 +47,12 @@ public class InventoryController {
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("/GetInventoryByOrgId")
@ApiOperation("查询组织机构拥有装备")
public ApiRes<List<EqsSummaryDto>> getInventoryByOrgId(@RequestBody @Validated(ValidationApi.detail.class) InventoryReq req){
return ApiRes.success(inventoryService.getInventoryByOrgId(req));
}
@PostMapping("/SetInventoryMsg") @PostMapping("/SetInventoryMsg")
@ApiOperation("填充汇总表信息") @ApiOperation("填充汇总表信息")
...@@ -69,19 +80,7 @@ public class InventoryController { ...@@ -69,19 +80,7 @@ public class InventoryController {
return returnMsg; return returnMsg;
} }
@PostMapping("/UpdateInventoryNum")
@ApiOperation("手动重置库存数量信息")
public ResponseResult updateInventoryNum(@RequestBody Map<String,Object> msg){
ResponseResult returnMsg = inventoryService.updateInventoryNum(msg);
return returnMsg;
}
@PostMapping("/GetInventoryByOrgId")
@ApiOperation("查询组织机构拥有装备")
public ResponseResult getInventoryByOrgId(@RequestBody Map<String,Object> msg){
ResponseResult returnMsg = inventoryService.getInventoryByOrgId(msg);
return returnMsg;
}
@PostMapping("/GetInventoryDevelop") @PostMapping("/GetInventoryDevelop")
@ApiOperation("获取装备明细表所有信息") @ApiOperation("获取装备明细表所有信息")
...@@ -90,10 +89,27 @@ public class InventoryController { ...@@ -90,10 +89,27 @@ public class InventoryController {
return returnMsg; return returnMsg;
} }
@PostMapping("/InvertoryBindBox") @PostMapping("/InvertoryBind")
@ApiOperation("装备绑定箱门") @ApiOperation("装备绑定箱门")
public ResponseResult InvertoryBindBox(@RequestBody Map<String,Object> msg){ public ApiRes<Boolean> InvertoryBind(@RequestBody @Validated(ValidationApi.edit.class) EquipmentBindReq req){
ResponseResult returnMsg = inventoryService.InvertoryBindBox(msg); return ApiRes.success(inventoryService.InvertoryBind(req));
return returnMsg; }
@PostMapping("/UpdateWarehouseInsNum")
@ApiOperation("手动重置仓库库存数量信息")
public ApiRes<Boolean> UpdateWarehouseInsNum(@RequestBody @Validated(ValidationApi.detail.class) WarehouseReq req){
return ApiRes.success(inventoryService.UpdateWarehouseInsNum(req));
}
@PostMapping("/UpdateCabinetInsNum")
@ApiOperation("手动重置单警柜库存数量信息")
public ApiRes<Boolean> UpdateCabinetInsNum(@RequestBody @Validated(ValidationApi.detail.class)CabinetReq req){
return ApiRes.success(inventoryService.UpdateCabinetInsNum(req));
}
@PostMapping("/GetInvInfoByEpc")
@ApiOperation("根据EPC列表获取装备信息")
public ApiRes<List<EqsSummaryDto>> GetInvInfoByEpc(@RequestBody InventoryReq req){
return ApiRes.success(inventoryService.GetInvInfoByEpc(req));
} }
} }
package com.junmp.jyzb.controller; package com.junmp.jyzb.controller;
import com.junmp.jyzb.api.bean.dto.ShelfDto; import com.junmp.jyzb.api.bean.dto.*;
import com.junmp.jyzb.api.bean.dto.WarehouseAreaDto;
import com.junmp.jyzb.api.bean.dto.WarehouseDto;
import com.junmp.jyzb.api.bean.query.ShelfReq; import com.junmp.jyzb.api.bean.query.ShelfReq;
import com.junmp.jyzb.api.bean.query.WarehouseAreaReq; import com.junmp.jyzb.api.bean.query.WarehouseAreaReq;
import com.junmp.jyzb.api.bean.query.WarehouseReq; import com.junmp.jyzb.api.bean.query.WarehouseReq;
...@@ -85,7 +83,7 @@ public class WarehouseController { ...@@ -85,7 +83,7 @@ public class WarehouseController {
@PostMapping("/AddArea") @PostMapping("/AddArea")
@ApiOperation("添加区域") @ApiOperation("添加区域")
public ApiRes<Boolean> addArea(@RequestBody @Validated(ValidationApi.add.class) UpdateWarehouseAreaReq req) { public ApiRes<String> addArea(@RequestBody @Validated(ValidationApi.add.class) UpdateWarehouseAreaReq req) {
return ApiRes.success(warehouseAreaService.addArea(req)); return ApiRes.success(warehouseAreaService.addArea(req));
} }
...@@ -103,10 +101,22 @@ public class WarehouseController { ...@@ -103,10 +101,22 @@ public class WarehouseController {
@PostMapping("/GetAreaList") @PostMapping("/GetAreaList")
@ApiOperation("查询区域信息") @ApiOperation("查询区域信息")
public ApiRes<List<WarehouseAreaDto>> getAreaList(@RequestBody WarehouseAreaReq req){ public ApiRes<List<WarehouseAreaDto>> getAreaList(@RequestBody @Validated(ValidationApi.detail.class) WarehouseAreaReq req){
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("添加货架")
...@@ -131,4 +141,19 @@ public class WarehouseController { ...@@ -131,4 +141,19 @@ public class WarehouseController {
public ApiRes<List<ShelfDto>> GetShelfList(@RequestBody @Validated(ValidationApi.detail.class) ShelfReq req){ public ApiRes<List<ShelfDto>> GetShelfList(@RequestBody @Validated(ValidationApi.detail.class) ShelfReq req){
return ApiRes.success(shelfService.GetShelfList(req)); return ApiRes.success(shelfService.GetShelfList(req));
} }
@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));
}
} }
...@@ -138,7 +138,7 @@ public class Inventory implements Serializable { ...@@ -138,7 +138,7 @@ public class Inventory implements Serializable {
/** /**
* 是否遗失 * 标签id
*/ */
private String tid ; private String tid ;
......
...@@ -161,5 +161,12 @@ public class InventorySummary implements Serializable { ...@@ -161,5 +161,12 @@ public class InventorySummary implements Serializable {
@TableField("one_id") @TableField("one_id")
private String oneId; private String oneId;
/**
* 货架id
*/
@ApiModelProperty("货架id")
@TableField("location_shelf_id")
private String locationShelfId;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }
\ No newline at end of file
...@@ -19,7 +19,7 @@ public class Shelf implements Serializable { ...@@ -19,7 +19,7 @@ public class Shelf implements Serializable {
private String shelfId; private String shelfId;
@TableField("area_id") @TableField("area_id")
private Long areaId; private String areaId;
@TableField("shelf_name") @TableField("shelf_name")
private String shelfName; private String shelfName;
......
...@@ -19,9 +19,6 @@ public class Warehouse implements Serializable { ...@@ -19,9 +19,6 @@ public class Warehouse implements Serializable {
@TableId(value = "id" , type = IdType.ASSIGN_UUID) @TableId(value = "id" , type = IdType.ASSIGN_UUID)
private String id; private String id;
@TableField("department_id")
private Long departmentId;
@TableField("name") @TableField("name")
private String name; private String name;
...@@ -34,7 +31,7 @@ public class Warehouse implements Serializable { ...@@ -34,7 +31,7 @@ public class Warehouse implements Serializable {
@TableField("video") @TableField("video")
private String video; private String video;
@TableField(value = "create_time", fill = FieldFill.INSERT_UPDATE) @TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime; private Date createTime;
@TableField(value = "update_time", fill = FieldFill.UPDATE) @TableField(value = "update_time", fill = FieldFill.UPDATE)
......
...@@ -2,7 +2,6 @@ package com.junmp.jyzb.entity; ...@@ -2,7 +2,6 @@ package com.junmp.jyzb.entity;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
...@@ -22,7 +21,7 @@ public class WarehouseArea implements Serializable { ...@@ -22,7 +21,7 @@ public class WarehouseArea implements Serializable {
private String areaName; private String areaName;
@TableField("org_id_int") @TableField("org_id_int")
private Long orgIdInt; private Long orgId;
@TableField("warehouse_id") @TableField("warehouse_id")
private String warehouseId; private String warehouseId;
......
...@@ -12,8 +12,8 @@ import java.util.Map; ...@@ -12,8 +12,8 @@ import java.util.Map;
@Mapper @Mapper
public interface CabinetMapper extends BaseMapper<Cabinet> { public interface CabinetMapper extends BaseMapper<Cabinet> {
List<Cabinet> getAllCabinetByOrgList(@Param("allOrgId") List<Long> allOrgId); List<Cabinet> getAllCabinetByOrgList(List<Long> allOrgId);
boolean SetInventoryInfo(String id);
} }
\ No newline at end of file
...@@ -26,5 +26,4 @@ public interface InventoryMapper extends BaseMapper<Inventory> { ...@@ -26,5 +26,4 @@ public interface InventoryMapper extends BaseMapper<Inventory> {
List<Map<String, Object>> getInventoryList(@Param("queryType")String queryType,@Param("typeCode") String typeCode,@Param("typeId") String typeId,@Param("sizeId") String sizeId); List<Map<String, Object>> getInventoryList(@Param("queryType")String queryType,@Param("typeCode") String typeCode,@Param("typeId") String typeId,@Param("sizeId") String sizeId);
List<Map<String, Object>> getInventoryByOrgId(String orgId);
} }
\ No newline at end of file
package com.junmp.jyzb.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
<<<<<<< HEAD
import com.junmp.jyzb.entity.Inventory;
=======
import com.junmp.jyzb.entity.EquipmentSize;
import com.junmp.jyzb.entity.Inventory;
>>>>>>> develop
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
<<<<<<< HEAD
public interface InventoryMapper extends BaseMapper<Inventory> {
=======
public interface InventoryMapper extends BaseMapper<Inventory> {
>>>>>>> develop
Map<String, Object> getSum(String queryType, String typeId);
Map<String, Object> getOrgNum(String typeId);
List<Map<String, Object>> getLocationInventory(@Param("queryType")String queryType, @Param("idMsg")String idMsg);
void deleteAllMsg();
void setOrgInventory();
void setCabinetInventory();
void setWarehouseInventory();
List<Map<String, Object>> getInventoryList(@Param("queryType")String queryType,@Param("typeCode") String typeCode,@Param("typeId") String typeId,@Param("sizeId") String sizeId);
List<Map<String, Object>> getInventoryByOrgId(String orgId);
}
\ No newline at end of file
...@@ -30,11 +30,6 @@ public interface WarehouseMapper extends BaseMapper<Warehouse> { ...@@ -30,11 +30,6 @@ public interface WarehouseMapper extends BaseMapper<Warehouse> {
List<Warehouse> getAllWarehouseByOrgList(List<String> allOrgId); List<Warehouse> getAllWarehouseByOrgList(List<String> allOrgId);
void setWarehouseSumInventory(@Param("updateId") String id);
void setWarehouseInSumInventory(@Param("updateId") String id); boolean SetInventoryInfo(String id);
void setWarehouseOutSumInventory(@Param("updateId") String id);
void setWarehousePriceInventory(@Param("updateId") String id);
} }
\ No newline at end of file
...@@ -15,7 +15,7 @@ public interface CabinetBoxService extends IService<CabinetBox> { ...@@ -15,7 +15,7 @@ public interface CabinetBoxService extends IService<CabinetBox> {
//添加箱门信息 //添加箱门信息
boolean AddBoxInfo(UpdateCabinetBoxReq req); String AddBoxInfo(UpdateCabinetBoxReq req);
//判断箱门信息是否存在 //判断箱门信息是否存在
CabinetBox CabinetBoxExist(String id); CabinetBox CabinetBoxExist(String id);
......
...@@ -14,8 +14,6 @@ import java.util.Map; ...@@ -14,8 +14,6 @@ import java.util.Map;
public interface CabinetService extends IService<Cabinet> { public interface CabinetService extends IService<Cabinet> {
ResponseResult setCabinetInventory(Map<String, Object> msg);
/** /**
* 添加单警柜 * 添加单警柜
* @param req * @param req
...@@ -74,4 +72,5 @@ public interface CabinetService extends IService<Cabinet> { ...@@ -74,4 +72,5 @@ public interface CabinetService extends IService<Cabinet> {
//判断单警柜是否存在 //判断单警柜是否存在
Cabinet CabinetExist(String id); Cabinet CabinetExist(String id);
boolean SetInventoryInfo(String id);
} }
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.EqsSummaryDto;
import com.junmp.jyzb.api.bean.dto.InventoryDto; 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.InventoryReq;
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.entity.Inventory;
import com.junmp.jyzb.utils.ResponseResult; import com.junmp.jyzb.utils.ResponseResult;
import com.junmp.v2.db.api.page.PageResult;
import java.util.List;
import java.util.Map; import java.util.Map;
public interface InventoryService extends IService<Inventory> { public interface InventoryService extends IService<Inventory> {
...@@ -16,15 +22,20 @@ public interface InventoryService extends IService<Inventory> { ...@@ -16,15 +22,20 @@ public interface InventoryService extends IService<Inventory> {
ResponseResult setInventoryMsg(); ResponseResult setInventoryMsg();
ResponseResult updateInventoryNum(Map<String, Object> msg);
ResponseResult getInventoryList(Map<String, Object> msg); ResponseResult getInventoryList(Map<String, Object> msg);
ResponseResult getInventoryByOrgId(Map<String, Object> msg); List<EqsSummaryDto> getInventoryByOrgId(InventoryReq req);
ResponseResult getInventoryDevelop(); ResponseResult getInventoryDevelop();
ResponseResult InvertoryBindBox(Map<String, Object> msg); boolean UpdateWarehouseInsNum(WarehouseReq req);
boolean UpdateCabinetInsNum(CabinetReq req);
boolean InvertoryBind(EquipmentBindReq req);
List<EqsSummaryDto> GetInvInfoByEpc(InventoryReq req);
} }
...@@ -2,6 +2,8 @@ package com.junmp.jyzb.service; ...@@ -2,6 +2,8 @@ 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.ShelfDto; import com.junmp.jyzb.api.bean.dto.ShelfDto;
import com.junmp.jyzb.api.bean.dto.ShelfInsDto;
import com.junmp.jyzb.api.bean.dto.ShelfInventoryDto;
import com.junmp.jyzb.api.bean.query.ShelfReq; import com.junmp.jyzb.api.bean.query.ShelfReq;
import com.junmp.jyzb.api.bean.req.UpdateShelfReq; import com.junmp.jyzb.api.bean.req.UpdateShelfReq;
import com.junmp.jyzb.entity.Shelf; import com.junmp.jyzb.entity.Shelf;
...@@ -16,4 +18,10 @@ public interface ShelfService extends IService<Shelf> { ...@@ -16,4 +18,10 @@ public interface ShelfService extends IService<Shelf> {
boolean DeleteShelf(UpdateShelfReq req); boolean DeleteShelf(UpdateShelfReq req);
List<ShelfDto> GetShelfList(ShelfReq req); List<ShelfDto> GetShelfList(ShelfReq req);
//通过货架id查询装备信息汇总
ShelfInventoryDto ShelfInventoryList(ShelfReq req);
//通过货架id查询装备详细信息
ShelfInsDto ShelfInventoryDetail(ShelfReq req);
} }
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.WarehouseAreaDto; import com.junmp.jyzb.api.bean.dto.*;
import com.junmp.jyzb.api.bean.query.ShelfReq;
import com.junmp.jyzb.api.bean.query.WarehouseAreaReq; import com.junmp.jyzb.api.bean.query.WarehouseAreaReq;
import com.junmp.jyzb.api.bean.req.UpdateWarehouseAreaReq; import com.junmp.jyzb.api.bean.req.UpdateWarehouseAreaReq;
import com.junmp.jyzb.entity.WarehouseArea; import com.junmp.jyzb.entity.WarehouseArea;
...@@ -10,11 +11,26 @@ import java.util.List; ...@@ -10,11 +11,26 @@ import java.util.List;
public interface WarehouseAreaService extends IService<WarehouseArea> { public interface WarehouseAreaService extends IService<WarehouseArea> {
boolean addArea(UpdateWarehouseAreaReq msg); //增加区域
String addArea(UpdateWarehouseAreaReq msg);
//更改区域信息
boolean updateArea(UpdateWarehouseAreaReq msg); boolean updateArea(UpdateWarehouseAreaReq msg);
//删除区域
boolean deleteArea(UpdateWarehouseAreaReq msg); boolean deleteArea(UpdateWarehouseAreaReq msg);
//查询区域信息
List<WarehouseAreaDto> getAreaList(WarehouseAreaReq msg); List<WarehouseAreaDto> getAreaList(WarehouseAreaReq msg);
//判断区域是都存在(通用方法)
WarehouseArea WarehouseAreaExist(String id);
//通过区域id查询装备信息汇总
AreaInventoryDto AreaInventoryList(WarehouseAreaReq req);
//通过区域id查询每件装备的详细信息
AreaInsDto AreaInventoryDetail(WarehouseAreaReq req);
} }
...@@ -43,8 +43,8 @@ public interface WarehouseService extends IService<Warehouse> { ...@@ -43,8 +43,8 @@ public interface WarehouseService extends IService<Warehouse> {
List<WarehouseDto> getAllWarehouse(WarehouseReq orgId); List<WarehouseDto> getAllWarehouse(WarehouseReq orgId);
ResponseResult setWarehouseInventory(Map<String, Object> msg);
//通过仓库id 判断仓库是否存在 //通过仓库id 判断仓库是否存在
Warehouse WarehoustExist(String id); Warehouse WarehoustExist(String id);
boolean SetInventoryInfo(String id);
} }
...@@ -48,17 +48,16 @@ public class CabinetBoxServiceImpl extends ServiceImpl<CabinetBoxMapper, Cabinet ...@@ -48,17 +48,16 @@ public class CabinetBoxServiceImpl extends ServiceImpl<CabinetBoxMapper, Cabinet
//添加箱门信息 //添加箱门信息
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean AddBoxInfo(UpdateCabinetBoxReq req) { public String AddBoxInfo(UpdateCabinetBoxReq req) {
Cabinet cabinet = cabinetService.getOne(new LambdaQueryWrapper<Cabinet>() Cabinet cabinet = cabinetService.getOne(new LambdaQueryWrapper<Cabinet>()
.eq(Cabinet::getCabinetNum, req.getCabinetNum())); .eq(Cabinet::getCabinetNum, req.getCabinetNum()));
if (ObjectUtil.isNull(cabinet)){ if (ObjectUtil.isNull(cabinet)){
throw new ServiceException(CabinetExceptionEnum.CABINET_ISNOT_EXISTS); throw new ServiceException(CabinetExceptionEnum.CABINET_ISNOT_EXISTS);
} }
//判断传递的箱号是否存在
CabinetBox one = getOne(new LambdaQueryWrapper<CabinetBox>() CabinetBox one = getOne(new LambdaQueryWrapper<CabinetBox>()
.eq(CabinetBox::getCabinetId, cabinet.getId()) .eq(CabinetBox::getCabinetId, cabinet.getId())
.eq(CabinetBox::getNum, req.getNum())); .eq(CabinetBox::getId,req.getId()));
if (ObjectUtil.isNull(one)){ if (ObjectUtil.isNotNull(one)){
throw new ServiceException(CabinetBoxExceptionEnum.CABINETBOX_IS_EXISTS); throw new ServiceException(CabinetBoxExceptionEnum.CABINETBOX_IS_EXISTS);
} }
CabinetBox cabinetBox = new CabinetBox(); CabinetBox cabinetBox = new CabinetBox();
...@@ -70,11 +69,14 @@ public class CabinetBoxServiceImpl extends ServiceImpl<CabinetBoxMapper, Cabinet ...@@ -70,11 +69,14 @@ public class CabinetBoxServiceImpl extends ServiceImpl<CabinetBoxMapper, Cabinet
if (num==null){ if (num==null){
num=1; num=1;
cabinet.setNum(num); cabinet.setNum(num);
cabinetBox.setNum(num);
}else { }else {
cabinet.setNum(cabinet.getNum()+1); cabinet.setNum(num+1);
cabinetBox.setNum(num+1);
} }
cabinetService.updateById(cabinet); cabinetService.updateById(cabinet);
return save(cabinetBox); save(cabinetBox);
return cabinetBox.getId();
} }
//判断箱子信息是否存在 //判断箱子信息是否存在
......
...@@ -66,25 +66,6 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl ...@@ -66,25 +66,6 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
} }
public ResponseResult setCabinetInventory(Map<String, Object> msg) {
String id;
if (msg.containsKey("locationId") && msg.get("locationId") != "") {
id = msg.get("locationId").toString();
} else {
id = null;
}
//统计仓库 装备总数
// cabinetMapper.setCabinetSumInventory(id);
// //统计仓库 装备在库总数
// cabinetMapper.setCabinetInSumInventory(id);
// //统计仓库 装备出库总数
// cabinetMapper.setCabinetOutSumInventory(id);
// //统计仓库 装备出库总数
// cabinetMapper.setCabinetPriceInventory(id);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS);
}
/** /**
* 添加单警柜 * 添加单警柜
* *
...@@ -181,63 +162,30 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl ...@@ -181,63 +162,30 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
* 获取单警柜列表 * 获取单警柜列表
*通过机构id进行查询 *通过机构id进行查询
* @param req 单警柜信息 * @param req 单警柜信息
* @param req getIncludeLowerLevel true:查询本级及下级 false:查询本级 * @param req
* @return * @return
*/ */
@Override @Override
public List<CabinetDto> getAllCabinetList(CabinetReq req) { public List<CabinetDto> getAllCabinetList(CabinetReq req) {
//判断组织机构是否存在 //判断组织机构是否存在
pubOrgService.PubOrgExist(req.getOrgId()); pubOrgService.PubOrgExist(req.getOrgId());
List<Cabinet> cabinets = new ArrayList<>();
List<CabinetDto> cabinetList=new ArrayList<>(); List<CabinetDto> cabinetList=new ArrayList<>();
List<CabinetBoxDto> cabinetBoxList=new ArrayList<>(); List<CabinetBoxDto> cabinetBoxList=new ArrayList<>();
//如果组织机构时浙江省公安厅 List<Cabinet> list = list(new LambdaQueryWrapper<Cabinet>().eq(Cabinet::getOrgId, req.getOrgId()));
if (req.getOrgId().equals("1369509498032808905") && req.getIncludeLowerLevel().equals("true")) { for (Cabinet cabinet:list) {
cabinets = this.list(new LambdaQueryWrapper<Cabinet>() CabinetDto cabinetDto = new CabinetDto();
.eq(Cabinet::getOrgId, req.getOrgId())); BeanPlusUtil.copyProperties(cabinet,cabinetDto);
for (Cabinet cabinet:cabinets) { List<CabinetBox> list1 = cabinetBoxService.list(new LambdaQueryWrapper<CabinetBox>()
CabinetDto cabinetDto = new CabinetDto();
BeanPlusUtil.copyProperties(cabinet,cabinetDto);
//添加箱门信息列表
List<CabinetBox> list = cabinetBoxService.list(new LambdaQueryWrapper<CabinetBox>()
.eq(CabinetBox::getCabinetId, cabinet.getId()));
for (CabinetBox cabinetBox:list) {
CabinetBoxDto cabinetBoxDto = new CabinetBoxDto();
BeanPlusUtil.copyProperties(cabinetBox,cabinetBoxDto);
cabinetBoxList.add(cabinetBoxDto);
}
cabinetDto.setCabinetBoxList(cabinetBoxList);
cabinetList.add(cabinetDto);
}
return cabinetList;
}
//分两种情况,如果说是本级及下级(全部)所有的单警柜信息,则incluLowerLevel为true,如果是查询本级的单警柜信息则为false
if (req.getIncludeLowerLevel().equals("true") || req.getIncludeLowerLevel().equals("false")) {
List<Long> allOrgId = getAllOrgId(req, req.getIncludeLowerLevel());
if (allOrgId.size()==0) {
//抛出组织机构不存在异常
throw new ServiceException(PubOrgExceptionEnum.PUBORG_NOT_EXIST);
}
cabinets = getAllCabinetByOrg(allOrgId);
for (Cabinet cabinet:cabinets) {
CabinetDto cabinetDto = new CabinetDto();
BeanPlusUtil.copyProperties(cabinet,cabinetDto);
//添加箱门信息列表
List<CabinetBox> list = cabinetBoxService.list(new LambdaQueryWrapper<CabinetBox>()
.eq(CabinetBox::getCabinetId, cabinet.getId())); .eq(CabinetBox::getCabinetId, cabinet.getId()));
for (CabinetBox cabinetBox:list) { for (CabinetBox cabinetBox:list1) {
CabinetBoxDto cabinetBoxDto = new CabinetBoxDto(); CabinetBoxDto cabinetBoxDto = new CabinetBoxDto();
BeanPlusUtil.copyProperties(cabinetBox,cabinetBoxDto); BeanPlusUtil.copyProperties(cabinetBox,cabinetBoxDto);
cabinetBoxList.add(cabinetBoxDto); cabinetBoxList.add(cabinetBoxDto);
} }
cabinetDto.setCabinetBoxList(cabinetBoxList); cabinetDto.setCabinetBoxList(cabinetBoxList);
cabinetList.add(cabinetDto); cabinetList.add(cabinetDto);
}
return cabinetList;
} else {
//传递的数据是否正确,不正确抛异常(只接受true、false)
throw new ServiceException(CabinetExceptionEnum.PARAMETER_ERROR);
} }
return cabinetList;
} }
...@@ -373,4 +321,13 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl ...@@ -373,4 +321,13 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
return one; return one;
} }
//设置单警柜库存数量信息
@Override
@Transactional(rollbackFor = Exception.class)
public boolean SetInventoryInfo(String id) {
//统计单警柜总数,在库总数,出库总数,装备总价格
cabinetMapper.SetInventoryInfo(id);
return true;
}
} }
\ No newline at end of file
...@@ -3,21 +3,37 @@ package com.junmp.jyzb.service.impl; ...@@ -3,21 +3,37 @@ 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.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.junmp.jyzb.api.bean.dto.EqsSummaryDto;
import com.junmp.jyzb.api.bean.dto.InventoryDto; 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.InventoryReq;
import com.junmp.jyzb.api.bean.query.WarehouseReq;
import com.junmp.jyzb.api.bean.req.EquipmentBindReq;
import com.junmp.jyzb.api.exception.enums.CabinetBoxExceptionEnum;
import com.junmp.jyzb.api.exception.enums.CabinetExceptionEnum;
import com.junmp.jyzb.api.exception.enums.InventoryExceptionEnum;
import com.junmp.jyzb.entity.Cabinet;
import com.junmp.jyzb.entity.CabinetBox;
import com.junmp.jyzb.entity.Inventory; 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;
import com.junmp.jyzb.utils.ReturnData; import com.junmp.jyzb.utils.ReturnData;
import com.junmp.jyzb.utils.ReturnMsg; import com.junmp.jyzb.utils.ReturnMsg;
import com.junmp.v2.common.exception.base.ServiceException;
import com.junmp.v2.common.util.BeanPlusUtil;
import com.junmp.v2.db.api.factory.PageFactory;
import com.junmp.v2.db.api.page.PageResult;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import com.junmp.jyzb.mapper.InventoryMapper; import com.junmp.jyzb.mapper.InventoryMapper;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
...@@ -40,7 +56,16 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory ...@@ -40,7 +56,16 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
private PubOrgService PubOrgService; private PubOrgService PubOrgService;
@Resource @Resource
private CabinetBoxService cabinetBoxService;
@Resource
private PubOrgService pubOrgService;
@Resource
private CabinetService cabinetService; private CabinetService cabinetService;
@Resource
private SupplierService supplierService;
@Override @Override
public InventoryDto getInventoryDetail(InventoryReq req) { public InventoryDto getInventoryDetail(InventoryReq req) {
...@@ -188,24 +213,6 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory ...@@ -188,24 +213,6 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS); return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS);
} }
@Override
public ResponseResult updateInventoryNum(Map<String, Object> msg) {
//参数校验
try {
checkNotBlank(msg.get("locationType"), "locationType不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
String locationType = msg.get("locationType").toString();
if (!locationType.equals("warehouse") && !locationType.equals("cabinet")){
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,"输入的locationType值有误");
}else if(locationType.equals("warehouse")){
warehouseService.setWarehouseInventory(msg);
}else if(locationType.equals("cabinet")){
cabinetService.setCabinetInventory(msg);
}
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS);
}
@Override @Override
public ResponseResult getInventoryList(Map<String, Object> msg) { public ResponseResult getInventoryList(Map<String, Object> msg) {
...@@ -225,7 +232,7 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory ...@@ -225,7 +232,7 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
String typeId = msg.get("typeId").toString(); String typeId = msg.get("typeId").toString();
String sizeId = msg.get("sizeId").toString(); String sizeId = msg.get("sizeId").toString();
//根据传入的queryType来辨别要查询什么信 //根据传入的queryType来辨别要查询什么信
if (queryType.equals("org") || queryType.equals("warehouse") || queryType.equals("cabinet")){ if (queryType.equals("org") || queryType.equals("warehouse") || queryType.equals("cabinet")){
List<Map<String,Object>> returnMsg = inventoryMapper.getInventoryList(queryType,typeCode,typeId,sizeId); List<Map<String,Object>> returnMsg = inventoryMapper.getInventoryList(queryType,typeCode,typeId,sizeId);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,returnMsg); return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,returnMsg);
...@@ -235,16 +242,25 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory ...@@ -235,16 +242,25 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
} }
@Override @Override
public ResponseResult getInventoryByOrgId(Map<String, Object> msg) { public List<EqsSummaryDto> getInventoryByOrgId(InventoryReq req) {
//参数校验 //判断组织机构是否存在
try { pubOrgService.PubOrgExist(req.getOrgId());
checkNotBlank(msg.get("orgId"), "orgId不能为空"); List<EqsSummaryDto> eqsSummaryDtoList=new ArrayList<>();
} catch (IllegalArgumentException e) { List<Inventory> list = list(new LambdaQueryWrapper<Inventory>()
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage()); .eq(Inventory::getOrgId, req.getOrgId()));
for (Inventory inventory:list) {
EqsSummaryDto eqsSummaryDto = new EqsSummaryDto();
BeanPlusUtil.copyProperties(inventory,eqsSummaryDto);
//设置型号名称,类别名称,供应商名称
String sizeName = equipmentSizeService.getById(inventory.getSizeId()).getName();
String typeName = equipmentTypeService.getById(inventory.getTypeId()).getName();
String supplierName = supplierService.getById(inventory.getSupplierId()).getName();
eqsSummaryDto.setSizeName(sizeName);
eqsSummaryDto.setTypeName(typeName);
eqsSummaryDto.setSupplierName(supplierName);
eqsSummaryDtoList.add(eqsSummaryDto);
} }
String orgId = msg.get("orgId").toString(); return eqsSummaryDtoList;
List<Map<String, Object>> returnMsg = inventoryMapper.getInventoryByOrgId(orgId);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,returnMsg);
} }
@Override @Override
...@@ -252,27 +268,82 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory ...@@ -252,27 +268,82 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
return null; return null;
} }
//设置仓库库存数量
@Override @Override
public ResponseResult InvertoryBindBox(Map<String, Object> msg) { public boolean UpdateWarehouseInsNum(WarehouseReq req) {
//参数校验 Warehouse warehouse = warehouseService.WarehoustExist(req.getId());
try { boolean b = warehouseService.SetInventoryInfo(warehouse.getId());
checkNotBlank(msg.get("inventoryId"), "inventoryId不能为空"); return b;
checkNotBlank(msg.get("locationId"), "locationId不能为空"); }
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage()); //设置单警柜库存数量
@Override
public boolean UpdateCabinetInsNum(CabinetReq req) {
Cabinet cabinet = cabinetService.CabinetExist(req.getId());
boolean b = cabinetService.SetInventoryInfo(cabinet.getId());
return b;
}
//装备绑定箱门
@Override
@Transactional(rollbackFor = Exception.class)
public boolean InvertoryBind(EquipmentBindReq req) {
//判断箱门是否存在
CabinetBox one = cabinetBoxService.getOne(new LambdaQueryWrapper<CabinetBox>()
.eq(CabinetBox::getCabinetId, req.getCabinetId())
.eq(CabinetBox::getId, req.getCabinetBoxId()));
if (Objects.isNull(one)){
throw new ServiceException(CabinetBoxExceptionEnum.CABINETBOX_ISNOT_EXISTS);
}
//判断组织机构是否存在
pubOrgService.PubOrgExist(req.getOrgId());
List<InventoryReq> equipmentList = req.getEquipmentList();
if (equipmentList.size()==0){
throw new ServiceException(CabinetExceptionEnum.PARAMETER_ERROR);
} }
//将装备和箱门进行绑定(简单来 说就是更新数据库中的单条记录信息) List<Inventory> inventoryList=new ArrayList<>();
Inventory inventory = inventoryMapper.selectOne(new LambdaQueryWrapper<Inventory>() for (InventoryReq inventoryReq: equipmentList) {
.eq(Inventory::getID, msg.get("inventoryId")) Inventory inventory = new Inventory();
.eq(Inventory::getLocationId, msg.get("locationId"))); BeanPlusUtil.copyProperties(inventoryReq,inventory);
if (Objects.isNull(inventory)){ inventory.setShelfId(req.getCabinetBoxId());
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR, ReturnData.NO_DATA); inventoryList.add(inventory);
} }
inventory.setLocationId((String) msg.get("locationId")); return updateBatchById(inventoryList);
inventoryMapper.updateById(inventory);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,"绑定成功");
} }
//根据Epc查询装备信息
@Override
public List<EqsSummaryDto> GetInvInfoByEpc(InventoryReq req) {
List<EqsSummaryDto> eqsSummaryDtoList=new ArrayList<>();
//判断传入的是否为空
List<String> epcList = req.getEpcList();
if (epcList.size()==0){
throw new ServiceException(CabinetExceptionEnum.PARAMETER_ERROR);
}
//迭代器遍历列表
Iterator<String> iterator = epcList.iterator();
while (iterator.hasNext()){
String epc = iterator.next();
Inventory inventory = getOne(new LambdaQueryWrapper<Inventory>().eq(Inventory::getEpc, epc));
if (Objects.isNull(inventory)){
throw new ServiceException(InventoryExceptionEnum.INVENTORY_NOT_EXIST);
}
EqsSummaryDto eqsSummaryDto = new EqsSummaryDto();
BeanPlusUtil.copyProperties(inventory,eqsSummaryDto);
//设置型号名称,类别名称,供应商名称
String sizeName = equipmentSizeService.getById(inventory.getSizeId()).getName();
String typeName = equipmentTypeService.getById(inventory.getTypeId()).getName();
String supplierName = supplierService.getById(inventory.getSupplierId()).getName();
eqsSummaryDto.setSizeName(sizeName);
eqsSummaryDto.setTypeName(typeName);
eqsSummaryDto.setSupplierName(supplierName);
eqsSummaryDtoList.add(eqsSummaryDto);
}
return eqsSummaryDtoList;
}
/** /**
* @Author: Zhaojw * @Author: Zhaojw
......
...@@ -69,7 +69,7 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem ...@@ -69,7 +69,7 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem
} }
List<Long> resultList = new ArrayList<>(); // 存储最终的菜单树结果 List<Long> resultList = new ArrayList<>(); // 存储最终的菜单树结果
Map<String, List<Long>> childrenMap = new HashMap<>(); // 存储每个菜单项的子菜单映射 Map<Long, List<Long>> childrenMap = new HashMap<>(); // 存储每个菜单项的子菜单映射
resultList.add(orgId); //将自己加入到返回的List中 resultList.add(orgId); //将自己加入到返回的List中
...@@ -77,13 +77,13 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem ...@@ -77,13 +77,13 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem
for (PubOrg menu : menuList) { for (PubOrg menu : menuList) {
Long org = menu.getOrgId(); Long org = menu.getOrgId();
if (!childrenMap.containsKey(menu.getOrgParentId().toString())) { // 如果父菜单还不存在于映射表中 if (!childrenMap.containsKey(menu.getOrgParentId())) { // 如果父菜单还不存在于映射表中
childrenMap.put(menu.getOrgParentId().toString(), new ArrayList<>()); // 创建一个新的子菜单列表 childrenMap.put(menu.getOrgParentId(), new ArrayList<>()); // 创建一个新的子菜单列表
} }
childrenMap.get(menu.getOrgParentId()).add(org); // 将当前菜单项放入对应的子菜单列表中 childrenMap.get(menu.getOrgParentId()).add(org); // 将当前菜单项放入对应的子菜单列表中
} }
Long orgInfo = Long.valueOf(orgId);//获取输入的组织机构id信息 // Long orgInfo = Long.valueOf(orgId);//获取输入的组织机构id信息
//Long orgInfo = new BigInteger(orgId); // 获取顶级菜单的标识符 //Long orgInfo = new BigInteger(orgId); // 获取顶级菜单的标识符
// 获取顶级菜单 // 获取顶级菜单
......
...@@ -3,22 +3,23 @@ package com.junmp.jyzb.service.impl; ...@@ -3,22 +3,23 @@ package com.junmp.jyzb.service.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
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.ShelfDto; import com.junmp.jyzb.api.bean.dto.*;
import com.junmp.jyzb.api.bean.query.ShelfReq; import com.junmp.jyzb.api.bean.query.ShelfReq;
import com.junmp.jyzb.api.bean.req.UpdateShelfReq; import com.junmp.jyzb.api.bean.req.UpdateShelfReq;
import com.junmp.jyzb.api.exception.enums.ShelfExceptionEnum; import com.junmp.jyzb.api.exception.enums.ShelfExceptionEnum;
import com.junmp.jyzb.api.exception.enums.WarehouseAreaExceptionEnum;
import com.junmp.jyzb.api.exception.enums.WarehouseExceptionEnum; import com.junmp.jyzb.api.exception.enums.WarehouseExceptionEnum;
import com.junmp.jyzb.entity.Shelf; import com.junmp.jyzb.entity.*;
import com.junmp.jyzb.entity.Warehouse; import com.junmp.jyzb.service.*;
import com.junmp.jyzb.service.WarehouseService; import com.junmp.jyzb.utils.DateTimeUtil;
import com.junmp.v2.common.exception.base.ServiceException; import com.junmp.v2.common.exception.base.ServiceException;
import com.junmp.v2.common.util.BeanPlusUtil; import com.junmp.v2.common.util.BeanPlusUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import com.junmp.jyzb.mapper.ShelfMapper; import com.junmp.jyzb.mapper.ShelfMapper;
import com.junmp.jyzb.service.ShelfService;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
@Service @Service
...@@ -26,13 +27,31 @@ public class ShelfServiceImpl extends ServiceImpl<ShelfMapper, Shelf> implements ...@@ -26,13 +27,31 @@ public class ShelfServiceImpl extends ServiceImpl<ShelfMapper, Shelf> implements
@Resource @Resource
private WarehouseService warehouseService; private WarehouseService warehouseService;
@Resource
private WarehouseAreaService warehouseAreaService;
@Resource
private InventorySummaryService inventorySummaryService;
@Resource
private InventoryService inventoryService;
@Override @Override
public String AddShelf(UpdateShelfReq req) { public String AddShelf(UpdateShelfReq req) {
//判断仓库是否存在 //判断仓库是否存在
warehouseService.WarehoustExist(req.getWarehouseId()); warehouseService.WarehoustExist(req.getWarehouseId());
//判断区域是否存在
warehouseAreaService.WarehouseAreaExist(req.getAreaId());
//判断区域id是否在该仓库中,如果不是则抛出异常
WarehouseArea one = warehouseAreaService.getOne(new LambdaQueryWrapper<WarehouseArea>()
.eq(WarehouseArea::getWarehouseId, req.getWarehouseId())
.eq(WarehouseArea::getAreaId, req.getAreaId()));
if (ObjectUtil.isNull(one)){
throw new ServiceException(WarehouseAreaExceptionEnum.AREA_ERROR);
}
Shelf shelf = new Shelf(); Shelf shelf = new Shelf();
BeanPlusUtil.copyProperties(req,shelf); BeanPlusUtil.copyProperties(req,shelf);
shelf.setCreateTime(DateTimeUtil.getCurrentDateTime());
shelf.setUpdateTime(DateTimeUtil.getCurrentDateTime());
save(shelf); save(shelf);
return shelf.getShelfId(); return shelf.getShelfId();
} }
...@@ -40,14 +59,15 @@ public class ShelfServiceImpl extends ServiceImpl<ShelfMapper, Shelf> implements ...@@ -40,14 +59,15 @@ public class ShelfServiceImpl extends ServiceImpl<ShelfMapper, Shelf> implements
@Override @Override
public boolean UpdateShelf(UpdateShelfReq req) { public boolean UpdateShelf(UpdateShelfReq req) {
//判断货架id是否正确 //判断货架id是否正确
Shelf shelf = this.QueryShelf(req); Shelf shelf = ShelfExist(req.getShelfId());
BeanPlusUtil.copyProperties(req, shelf); BeanPlusUtil.copyProperties(req, shelf);
shelf.setUpdateTime(DateTimeUtil.getCurrentDateTime());
return this.updateById(shelf); return this.updateById(shelf);
} }
@Override @Override
public boolean DeleteShelf(UpdateShelfReq req) { public boolean DeleteShelf(UpdateShelfReq req) {
QueryShelf(req); ShelfExist(req.getShelfId());
return removeById(req.getShelfId()); return removeById(req.getShelfId());
} }
...@@ -65,14 +85,82 @@ public class ShelfServiceImpl extends ServiceImpl<ShelfMapper, Shelf> implements ...@@ -65,14 +85,82 @@ 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 req * @param
* @return * @return
*/ */
private Shelf QueryShelf(UpdateShelfReq req) { private Shelf ShelfExist(String id) {
Shelf shelf = this.getById(req.getShelfId()); 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);
} }
......
...@@ -3,14 +3,18 @@ package com.junmp.jyzb.service.impl; ...@@ -3,14 +3,18 @@ package com.junmp.jyzb.service.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
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.WarehouseAreaDto; import com.junmp.jyzb.api.bean.dto.*;
import com.junmp.jyzb.api.bean.query.WarehouseAreaReq; import com.junmp.jyzb.api.bean.query.WarehouseAreaReq;
import com.junmp.jyzb.api.bean.req.UpdateWarehouseAreaReq; import com.junmp.jyzb.api.bean.req.UpdateWarehouseAreaReq;
import com.junmp.jyzb.api.exception.enums.WarehouseAreaExceptionEnum; import com.junmp.jyzb.api.exception.enums.WarehouseAreaExceptionEnum;
import com.junmp.jyzb.api.exception.enums.WarehouseExceptionEnum; import com.junmp.jyzb.entity.Inventory;
import com.junmp.jyzb.entity.InventorySummary;
import com.junmp.jyzb.entity.Warehouse; import com.junmp.jyzb.entity.Warehouse;
import com.junmp.jyzb.entity.WarehouseArea; import com.junmp.jyzb.entity.WarehouseArea;
import com.junmp.jyzb.service.InventoryService;
import com.junmp.jyzb.service.InventorySummaryService;
import com.junmp.jyzb.service.WarehouseService; import com.junmp.jyzb.service.WarehouseService;
import com.junmp.jyzb.utils.DateTimeUtil;
import com.junmp.v2.common.exception.base.ServiceException; import com.junmp.v2.common.exception.base.ServiceException;
import com.junmp.v2.common.util.BeanPlusUtil; import com.junmp.v2.common.util.BeanPlusUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -19,25 +23,32 @@ import com.junmp.jyzb.mapper.WarehouseAreaMapper; ...@@ -19,25 +23,32 @@ import com.junmp.jyzb.mapper.WarehouseAreaMapper;
import com.junmp.jyzb.service.WarehouseAreaService; import com.junmp.jyzb.service.WarehouseAreaService;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
@Service @Service
public class WarehouseAreaServiceImpl extends ServiceImpl<WarehouseAreaMapper, WarehouseArea> implements WarehouseAreaService{ public class WarehouseAreaServiceImpl extends ServiceImpl<WarehouseAreaMapper, WarehouseArea> implements WarehouseAreaService{
@Resource @Resource
private WarehouseAreaMapper warehouseAreaMapper;
@Resource
private WarehouseService warehouseService; private WarehouseService warehouseService;
@Resource
private InventorySummaryService inventorySummaryService;
@Resource
private InventoryService inventoryService;
/**
* 增加区域
* @param req
* @return
*/
@Override @Override
public boolean addArea(UpdateWarehouseAreaReq req) { public String addArea(UpdateWarehouseAreaReq req) {
WarehouseArea area = new WarehouseArea(); WarehouseArea area = new WarehouseArea();
BeanPlusUtil.copyProperties(req, area); BeanPlusUtil.copyProperties(req, area);
//判断仓库是否存在 //判断仓库是否存在
WarehouseExist(req.getWarehouseId()); warehouseService.WarehoustExist(req.getWarehouseId());
//判断区域名称是否存在如果存在则抛出异常 //判断区域名称是否存在如果存在则抛出异常
List<WarehouseArea> list = list(new LambdaQueryWrapper<WarehouseArea>() List<WarehouseArea> list = list(new LambdaQueryWrapper<WarehouseArea>()
.eq(WarehouseArea::getWarehouseId, req.getWarehouseId()) .eq(WarehouseArea::getWarehouseId, req.getWarehouseId())
...@@ -45,20 +56,34 @@ public class WarehouseAreaServiceImpl extends ServiceImpl<WarehouseAreaMapper, W ...@@ -45,20 +56,34 @@ public class WarehouseAreaServiceImpl extends ServiceImpl<WarehouseAreaMapper, W
if (list.size()>0){ if (list.size()>0){
throw new ServiceException(WarehouseAreaExceptionEnum.AREA_IS_EXISTS); throw new ServiceException(WarehouseAreaExceptionEnum.AREA_IS_EXISTS);
} }
return this.save(area); area.setCreateTime(DateTimeUtil.getCurrentDateTime());
area.setUpdateTime(DateTimeUtil.getCurrentDateTime());
save(area);
return area.getAreaId();
} }
/**
* 更新区域信息
* @param req
* @return
*/
@Override @Override
public boolean updateArea(UpdateWarehouseAreaReq req) { public boolean updateArea(UpdateWarehouseAreaReq req) {
WarehouseArea warehouseArea = new WarehouseArea(); WarehouseArea warehouseArea = new WarehouseArea();
BeanPlusUtil.copyProperties(req,warehouseArea); BeanPlusUtil.copyProperties(req,warehouseArea);
//判断仓库是否存在 //判断仓库是否存在
WarehouseExist(req.getWarehouseId()); warehouseService.WarehoustExist(req.getWarehouseId());
//判断传入的区域id是否存在 //判断传入的区域id是否存在
WarehouseAreaExist(req.getAreaId()); WarehouseAreaExist(req.getAreaId());
warehouseArea.setUpdateTime(DateTimeUtil.getCurrentDateTime());
return this.updateById(warehouseArea); return this.updateById(warehouseArea);
} }
/**
* 删除区域
* @param req
* @return
*/
@Override @Override
public boolean deleteArea(UpdateWarehouseAreaReq req) { public boolean deleteArea(UpdateWarehouseAreaReq req) {
//判断传入的区域id是否存在 //判断传入的区域id是否存在
...@@ -68,10 +93,15 @@ public class WarehouseAreaServiceImpl extends ServiceImpl<WarehouseAreaMapper, W ...@@ -68,10 +93,15 @@ public class WarehouseAreaServiceImpl extends ServiceImpl<WarehouseAreaMapper, W
return this.removeById(warehouseArea); return this.removeById(warehouseArea);
} }
/**
* 通过区域id查询区域信息
* @param req
* @return
*/
@Override @Override
public List<WarehouseAreaDto> getAreaList(WarehouseAreaReq req) { public List<WarehouseAreaDto> getAreaList(WarehouseAreaReq req) {
//判断仓库是否存在 //判断仓库是否存在
WarehouseExist(req.getWarehouseId()); warehouseService.WarehoustExist(req.getWarehouseId());
List<WarehouseArea> list = list(new LambdaQueryWrapper<WarehouseArea>() List<WarehouseArea> list = list(new LambdaQueryWrapper<WarehouseArea>()
.eq(WarehouseArea::getWarehouseId, req.getWarehouseId())); .eq(WarehouseArea::getWarehouseId, req.getWarehouseId()));
List<WarehouseAreaDto> warehouseAreaDtoList=new ArrayList<>(); List<WarehouseAreaDto> warehouseAreaDtoList=new ArrayList<>();
...@@ -84,22 +114,88 @@ public class WarehouseAreaServiceImpl extends ServiceImpl<WarehouseAreaMapper, W ...@@ -84,22 +114,88 @@ public class WarehouseAreaServiceImpl extends ServiceImpl<WarehouseAreaMapper, W
} }
//判断仓库是否存在
private Warehouse WarehouseExist(String id){
Warehouse one = warehouseService.getOne(new LambdaQueryWrapper<Warehouse>()
.eq(Warehouse::getId, id));
if (ObjectUtil.isNull(one)){
throw new ServiceException(WarehouseExceptionEnum.WAREHOUSE_NOT_EXIST);
}
return one;
}
//判断区域id是否正确存在 //判断区域id是否正确存在
private WarehouseArea WarehouseAreaExist(String id){ public WarehouseArea WarehouseAreaExist(String id){
WarehouseArea warehouseArea = this.getById(id); WarehouseArea warehouseArea = this.getById(id);
if (ObjectUtil.isNull(warehouseArea)){ if (ObjectUtil.isNull(warehouseArea)){
throw new ServiceException(WarehouseAreaExceptionEnum.WAREHOUSEAREA_NOT_EXIST); throw new ServiceException(WarehouseAreaExceptionEnum.WAREHOUSEAREA_NOT_EXIST);
} }
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;
}
} }
...@@ -44,6 +44,8 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse> ...@@ -44,6 +44,8 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse>
public String AddWarehouse(UpdateWarehouseReq req) { public String AddWarehouse(UpdateWarehouseReq req) {
Warehouse warehouse = new Warehouse(); Warehouse warehouse = new Warehouse();
BeanPlusUtil.copyProperties(req, warehouse); BeanPlusUtil.copyProperties(req, warehouse);
warehouse.setCreateTime(DateTimeUtil.getCurrentDateTime());
warehouse.setUpdateTime(DateTimeUtil.getCurrentDateTime());
save(warehouse); save(warehouse);
return warehouse.getId(); return warehouse.getId();
} }
...@@ -76,6 +78,7 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse> ...@@ -76,6 +78,7 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse>
public boolean updateWarehouse(UpdateWarehouseReq req) { public boolean updateWarehouse(UpdateWarehouseReq req) {
Warehouse warehouse = new Warehouse(); Warehouse warehouse = new Warehouse();
BeanPlusUtil.copyProperties(req,warehouse); BeanPlusUtil.copyProperties(req,warehouse);
warehouse.setUpdateTime(DateTimeUtil.getCurrentDateTime());
return this.updateById(warehouse); return this.updateById(warehouse);
} }
...@@ -83,30 +86,15 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse> ...@@ -83,30 +86,15 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse>
@Override @Override
public List<WarehouseDto> getAllWarehouse(WarehouseReq msg) { public List<WarehouseDto> getAllWarehouse(WarehouseReq msg) {
List<Warehouse> allWarehouse=new ArrayList<>();
List<WarehouseDto> warehouseDtoList=new ArrayList<>(); List<WarehouseDto> warehouseDtoList=new ArrayList<>();
//判断组织机构是否存在 //判断组织机构是否存在
PubOrg pubOrg = pubOrgService.PubOrgExist(msg.getOrgId()); PubOrg pubOrg = pubOrgService.PubOrgExist(msg.getOrgId());
//根据组织机构id查询组织机构名称 //根据组织机构id查询组织机构名称
String orgName = pubOrg.getOrgName(); String orgName = pubOrg.getOrgName();
//如果组织机构是浙江省公安厅
if (msg.getOrgId().equals(1369509498032808905L) && msg.getIncludeLowerLevel().equals("true")){
allWarehouse = this.list();
for (Warehouse warehouse:allWarehouse) {
WarehouseDto warehouseDto = new WarehouseDto();
BeanPlusUtil.copyProperties(warehouse,warehouseDto);
warehouseDto.setOrgName(orgName);
warehouseDtoList.add(warehouseDto);
}
return warehouseDtoList;
}
//获取组织机构Id
List<Long> allOrgId =getAllOrgId(msg);
allWarehouse = getAllWarehouseByOrg(allOrgId);
for (Warehouse warehouse:allWarehouse) { List<Warehouse> list = list(new LambdaQueryWrapper<Warehouse>()
.eq(Warehouse::getOrgId, msg.getOrgId()));
for (Warehouse warehouse:list) {
WarehouseDto warehouseDto = new WarehouseDto(); WarehouseDto warehouseDto = new WarehouseDto();
BeanPlusUtil.copyProperties(warehouse,warehouseDto); BeanPlusUtil.copyProperties(warehouse,warehouseDto);
warehouseDto.setOrgName(orgName); warehouseDto.setOrgName(orgName);
...@@ -146,24 +134,6 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse> ...@@ -146,24 +134,6 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse>
return this.updateById(warehouse); return this.updateById(warehouse);
} }
@Override
public ResponseResult setWarehouseInventory(Map<String, Object> msg) {
String id;
if (msg.containsKey("locationId") && msg.get("locationId")!=""){
id = msg.get("locationId").toString();
}else {
id = null;
}
//统计仓库 装备总数
warehouseMapper.setWarehouseSumInventory(id);
//统计仓库 装备在库总数
warehouseMapper.setWarehouseInSumInventory(id);
//统计仓库 装备出库总数
warehouseMapper.setWarehouseOutSumInventory(id);
//统计仓库 装备出库总数
warehouseMapper.setWarehousePriceInventory(id);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS);
}
...@@ -182,4 +152,13 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse> ...@@ -182,4 +152,13 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse>
return warehouseMsg; return warehouseMsg;
} }
//设置仓库中的装备信息(在库数,总数,出库数,价格)
@Override
@Transactional(rollbackFor = Exception.class)
public boolean SetInventoryInfo(String id) {
//统计仓库总数,在库总数,出库总数,装备总价格
warehouseMapper.SetInventoryInfo(id);
return true;
}
} }
...@@ -30,7 +30,26 @@ ...@@ -30,7 +30,26 @@
id, cabinet_num, `name`, org_id, `location`, error_state, create_time, update_time, id, cabinet_num, `name`, org_id, `location`, error_state, create_time, update_time,
create_user, update_user create_user, update_user
</sql> </sql>
<update id="SetInventoryInfo" parameterType="java.lang.String">
UPDATE base_cabinet AS w
SET sum = (
SELECT sum(number) as sum
FROM base_inventory_summary AS bis
WHERE bis.location_id = w.id),
in_sum=(
SELECT sum(stock_number) as sum
FROM base_inventory_summary AS bis
WHERE bis.location_id = w.id),
out_sum=(
SELECT sum(outbound_number) as sum
FROM base_inventory_summary AS bis
WHERE bis.location_id = w.id),
price_total=(
SELECT sum(price) as sum
FROM base_inventory_summary AS bis
WHERE bis.location_id = w.id)
WHERE w.id=#{id}
</update>
<select id="getAllCabinetByOrgList" parameterType="java.util.List" resultType="com.junmp.jyzb.entity.Cabinet"> <select id="getAllCabinetByOrgList" parameterType="java.util.List" resultType="com.junmp.jyzb.entity.Cabinet">
......
...@@ -24,11 +24,12 @@ ...@@ -24,11 +24,12 @@
<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 destruction_number, expire_number, create_time, update_time,location_shelf_id
</sql> </sql>
</mapper> </mapper>
\ No newline at end of file
...@@ -112,52 +112,26 @@ ...@@ -112,52 +112,26 @@
</foreach> </foreach>
</select> </select>
<update id="setWarehouseSumInventory">
UPDATE base_warehouse AS w
SET sum = (
SELECT count(id)
FROM base_inventory AS i
WHERE i.location_id = w.id
)
<if test="updateId != null and updateId != ''">
where w.id = #{updateId}
</if>
</update>
<update id="setWarehouseInSumInventory">
UPDATE base_warehouse AS w
SET in_sum = (
SELECT count(id)
FROM base_inventory AS i
WHERE i.location_id = w.id and i.location_state="in"
)
<if test="updateId != null and updateId != ''">
where w.id = #{updateId}
</if>
</update>
<update id="setWarehouseOutSumInventory"> <update id="SetInventoryInfo" parameterType="java.lang.String">
UPDATE base_warehouse AS w UPDATE base_warehouse AS w
SET out_sum = ( SET sum = (
SELECT count(id) SELECT sum(number) as sum
FROM base_inventory AS i FROM base_inventory_summary AS bis
WHERE i.location_id = w.id and i.location_state="out" WHERE bis.location_id = w.id),
) in_sum=(
<if test="updateId != null and updateId != ''"> SELECT sum(stock_number) as sum
where w.id = #{updateId} FROM base_inventory_summary AS bis
</if> WHERE bis.location_id = w.id),
</update> out_sum=(
SELECT sum(outbound_number) as sum
<update id="setWarehousePriceInventory"> FROM base_inventory_summary AS bis
UPDATE base_warehouse AS w WHERE bis.location_id = w.id),
SET price_total = ( price_total=(
SELECT sum(price) SELECT sum(price) as sum
FROM base_inventory AS i FROM base_inventory_summary AS bis
WHERE i.location_id = w.id WHERE bis.location_id = w.id)
) WHERE w.id=#{id}
<if test="updateId != null and updateId != ''">
where w.id = #{updateId}
</if>
</update> </update>
</mapper> </mapper>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论