Browse Source

仓库管理

master
liupopo 2 years ago
parent
commit
15aebd7dd6
  1. 36
      warehousing-system/README.en.md
  2. 37
      warehousing-system/README.md
  3. 97
      warehousing-system/project/pom.xml
  4. 16
      warehousing-system/project/wh-common/pom.xml
  5. 13
      warehousing-system/project/wh-common/src/main/java/com/wh/api/Api.java
  6. 19
      warehousing-system/project/wh-common/src/main/java/com/wh/pojo/BasePojo.java
  7. 22
      warehousing-system/project/wh-common/src/main/java/com/wh/pojo/InStorehouse.java
  8. 18
      warehousing-system/project/wh-common/src/main/java/com/wh/pojo/Location.java
  9. 13
      warehousing-system/project/wh-common/src/main/java/com/wh/pojo/LocationType.java
  10. 29
      warehousing-system/project/wh-common/src/main/java/com/wh/pojo/OnShelves.java
  11. 29
      warehousing-system/project/wh-common/src/main/java/com/wh/pojo/OutStorehouse.java
  12. 22
      warehousing-system/project/wh-common/src/main/java/com/wh/pojo/Picking.java
  13. 24
      warehousing-system/project/wh-common/src/main/java/com/wh/pojo/Product.java
  14. 25
      warehousing-system/project/wh-common/src/main/java/com/wh/pojo/Purchase.java
  15. 25
      warehousing-system/project/wh-common/src/main/java/com/wh/pojo/Receiving.java
  16. 28
      warehousing-system/project/wh-common/src/main/java/com/wh/pojo/Remove.java
  17. 23
      warehousing-system/project/wh-common/src/main/java/com/wh/pojo/Rights.java
  18. 20
      warehousing-system/project/wh-common/src/main/java/com/wh/pojo/Stock.java
  19. 17
      warehousing-system/project/wh-common/src/main/java/com/wh/pojo/Storehouse.java
  20. 17
      warehousing-system/project/wh-common/src/main/java/com/wh/pojo/Supplier.java
  21. 20
      warehousing-system/project/wh-common/src/main/java/com/wh/pojo/User.java
  22. 13
      warehousing-system/project/wh-common/src/main/java/com/wh/vo/Options.java
  23. 14
      warehousing-system/project/wh-common/src/main/java/com/wh/vo/PageResult.java
  24. 11
      warehousing-system/project/wh-common/src/main/java/com/wh/vo/PickingUser.java
  25. 13
      warehousing-system/project/wh-common/src/main/java/com/wh/vo/QueryInfo.java
  26. 43
      warehousing-system/project/wh-common/src/main/java/com/wh/vo/SysResult.java
  27. 6
      warehousing-system/project/wh-common/src/test/java/Test.java
  28. 47
      warehousing-system/project/wh-manage/pom.xml
  29. 14
      warehousing-system/project/wh-manage/src/main/java/com/wh/WarehouseApplication.java
  30. 15
      warehousing-system/project/wh-manage/src/main/java/com/wh/aop/AOPException.java
  31. 16
      warehousing-system/project/wh-manage/src/main/java/com/wh/config/MyInterceptor.java
  32. 35
      warehousing-system/project/wh-manage/src/main/java/com/wh/controller/RightsController.java
  33. 26
      warehousing-system/project/wh-manage/src/main/java/com/wh/controller/UserController.java
  34. 33
      warehousing-system/project/wh-manage/src/main/java/com/wh/controller/UserInterceptor.java
  35. 57
      warehousing-system/project/wh-manage/src/main/java/com/wh/controller/initial/LocationController.java
  36. 50
      warehousing-system/project/wh-manage/src/main/java/com/wh/controller/initial/ProductController.java
  37. 41
      warehousing-system/project/wh-manage/src/main/java/com/wh/controller/initial/StorehouseController.java
  38. 41
      warehousing-system/project/wh-manage/src/main/java/com/wh/controller/initial/SupplierController.java
  39. 70
      warehousing-system/project/wh-manage/src/main/java/com/wh/controller/instorehouse/PurchaseController.java
  40. 52
      warehousing-system/project/wh-manage/src/main/java/com/wh/controller/instorehouse/ReceivingController.java
  41. 57
      warehousing-system/project/wh-manage/src/main/java/com/wh/controller/outstorehouse/OutStorehouseController.java
  42. 46
      warehousing-system/project/wh-manage/src/main/java/com/wh/controller/outstorehouse/PickingController.java
  43. 26
      warehousing-system/project/wh-manage/src/main/java/com/wh/controller/stock/StockController.java
  44. 54
      warehousing-system/project/wh-manage/src/main/java/com/wh/controller/storehousemanage/PutInController.java
  45. 44
      warehousing-system/project/wh-manage/src/main/java/com/wh/controller/storehousemanage/RemoveController.java
  46. 57
      warehousing-system/project/wh-manage/src/main/java/com/wh/controller/storehousemanage/ShelvesController.java
  47. 7
      warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/RightsMapper.java
  48. 7
      warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/UserMapper.java
  49. 7
      warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/initial/LocationMapper.java
  50. 7
      warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/initial/LocationTypeMapper.java
  51. 7
      warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/initial/ProductMapper.java
  52. 7
      warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/initial/StorehouseMapper.java
  53. 7
      warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/initial/SupplierMapper.java
  54. 7
      warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/instorehouse/PurchaseMapper.java
  55. 8
      warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/instorehouse/PutInMapper.java
  56. 7
      warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/instorehouse/ReceivingMapper.java
  57. 7
      warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/outstorehouse/OutStorehouseMapper.java
  58. 7
      warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/outstorehouse/PickingMapper.java
  59. 7
      warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/stock/StockMapper.java
  60. 7
      warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/storehousemanage/RemoveMapper.java
  61. 7
      warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/storehousemanage/ShelvesMapper.java
  62. 9
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/RightsService.java
  63. 42
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/RightsServiceImpl.java
  64. 7
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/UserService.java
  65. 28
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/UserServiceImpl.java
  66. 22
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/LocationService.java
  67. 67
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/LocationServiceImpl.java
  68. 19
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/ProductService.java
  69. 63
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/ProductServiceImpl.java
  70. 14
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/StorehouseService.java
  71. 60
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/StorehouseServiceImpl.java
  72. 15
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/SupplierService.java
  73. 44
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/SupplierServiceImpl.java
  74. 25
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/instorehouse/PurchaseService.java
  75. 84
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/instorehouse/PurchaseServiceImpl.java
  76. 20
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/instorehouse/PutInService.java
  77. 220
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/instorehouse/PutInServiceImpl.java
  78. 19
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/instorehouse/ReceivingService.java
  79. 132
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/instorehouse/ReceivingServiceImpl.java
  80. 20
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/outstorehouse/OutStorehouseService.java
  81. 157
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/outstorehouse/OutStorehouseServiceImpl.java
  82. 16
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/outstorehouse/PickingService.java
  83. 82
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/outstorehouse/PickingServiceImpl.java
  84. 8
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/stock/StockService.java
  85. 29
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/stock/StockServiceImpl.java
  86. 17
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/storehousemanage/RemoveService.java
  87. 119
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/storehousemanage/RemoveServiceImpl.java
  88. 19
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/storehousemanage/ShelvesService.java
  89. 295
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/storehousemanage/ShelvesServiceImpl.java
  90. 21
      warehousing-system/project/wh-manage/src/main/resources/application.yml
  91. 7
      warehousing-system/project/wh-manage/src/main/resources/mappers/UserMapper.xml
  92. 11
      warehousing-system/project/wh-manage/src/test/java/Test01.java
  93. 3
      warehousing-system/project_web/.browserslistrc
  94. 5
      warehousing-system/project_web/.editorconfig
  95. 26
      warehousing-system/project_web/.eslintrc.js
  96. 23
      warehousing-system/project_web/.gitignore
  97. 24
      warehousing-system/project_web/README.md
  98. 14
      warehousing-system/project_web/babel.config.js
  99. 12742
      warehousing-system/project_web/package-lock.json
  100. 38
      warehousing-system/project_web/package.json

36
warehousing-system/README.en.md

@ -0,0 +1,36 @@
# 仓储系统
#### Description
简单的仓储系统,出库入库订单供应商商品库存。
#### Software Architecture
Software architecture description
#### Installation
1. xxxx
2. xxxx
3. xxxx
#### Instructions
1. xxxx
2. xxxx
3. xxxx
#### Contribution
1. Fork the repository
2. Create Feat_xxx branch
3. Commit your code
4. Create Pull Request
#### Gitee Feature
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
4. The most valuable open source project [GVP](https://gitee.com/gvp)
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

37
warehousing-system/README.md

@ -0,0 +1,37 @@
# 仓储系统
#### 介绍
简单的仓储系统,出库入库订单供应商商品库存。
#### 软件架构
软件架构说明
#### 安装教程
1. xxxx
2. xxxx
3. xxxx
#### 使用说明
1. xxxx
2. xxxx
3. xxxx
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
#### 特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

97
warehousing-system/project/pom.xml

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.wh</groupId>
<artifactId>wh</artifactId>
<version>1.0-SNAPSHOT</version>
<modules>
<module>wh-common</module>
<module>wh-manage</module>
</modules>
<!--指定打包方式 jar/war/pom聚合工程 -->
<packaging>pom</packaging>
<!--引入父级工程-->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.5</version>
<relativePath/>
</parent>
<properties>
<java.version>1.8</java.version>
<!--跳过测试类打包-->
<skipTests>true</skipTests>
</properties>
<dependencies>
<!--SpringMVCjar包文件-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- 引入aop支持 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<!--热部署工具-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<!--lombok插件-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<!--测试包-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!--引入jdbc包-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<!--引入数据库驱动 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<!--spring整合mybatis-plus -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.2</version>
</dependency>
<!--spring整合redis -->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
</dependency>
</dependencies>
<!--父级工程是一种结构 没有java代码 不需要执行运行,所以不需要build标签-->
</project>

16
warehousing-system/project/wh-common/pom.xml

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>wh</artifactId>
<groupId>com.wh</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.wh</groupId>
<artifactId>wh-common</artifactId>
</project>

13
warehousing-system/project/wh-common/src/main/java/com/wh/api/Api.java

@ -0,0 +1,13 @@
package com.wh.api;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Api {
public String getTime(){
Date dNow = new Date( );
SimpleDateFormat ft = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss");
return ft.format(dNow);
}
}

19
warehousing-system/project/wh-common/src/main/java/com/wh/pojo/BasePojo.java

@ -0,0 +1,19 @@
package com.wh.pojo;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
//pojo基类,完成2个任务,2个日期,实现序列化
@Data
@Accessors(chain=true)
public class BasePojo implements Serializable{
@TableField(fill = FieldFill.INSERT)
private Date created; //表示入库时需要赋值
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updated; //表示入库/更新时赋值.
}

22
warehousing-system/project/wh-common/src/main/java/com/wh/pojo/InStorehouse.java

@ -0,0 +1,22 @@
package com.wh.pojo;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
@TableName("in_storehouse")
public class InStorehouse {
@TableId("in_storehouse_id")
private String inStorehouseId; //入库单号
private String receivingId; //接货单号
private String locationId; //货位编码
private String createPerson; //创建者
private String createTime; //创建时间
private String checkPerson; //审批人id
private String checkTime; //审批时间
private String status; //状态
private String remarks; //备注
}

18
warehousing-system/project/wh-common/src/main/java/com/wh/pojo/Location.java

@ -0,0 +1,18 @@
package com.wh.pojo;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
@TableName("location")
public class Location {
private String name; //货位名称
@TableId("location_id")
private String locationId; //货位编号
private String type; //货位类型
private String status; //货位状态
private String storehouse; //所属仓库
}

13
warehousing-system/project/wh-common/src/main/java/com/wh/pojo/LocationType.java

@ -0,0 +1,13 @@
package com.wh.pojo;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
@TableName("location_type")
public class LocationType {
private Integer id; //类型序号
private String type; //类型
}

29
warehousing-system/project/wh-common/src/main/java/com/wh/pojo/OnShelves.java

@ -0,0 +1,29 @@
package com.wh.pojo;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
@TableName("on_shelves")
@ToString
public class OnShelves {
@TableId("shelves_id")
private String shelvesId; //上架单号
private String barCode; //商品编码
private String productName; //商品名称
private String locationId; //货位编号
private String locationName; //货位名称
private String fromLocationId; //源货位编号
private String fromLocationName; //源货位名称
private Integer count; //数量
private String status; //状态
private String createPerson; //创建人
private String createTime; //创建时间
private String checkPerson; //审核人
private String checkTime; //审核时间
}

29
warehousing-system/project/wh-common/src/main/java/com/wh/pojo/OutStorehouse.java

@ -0,0 +1,29 @@
package com.wh.pojo;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
@TableName("out_storehouse")
public class OutStorehouse {
@TableId("out_storehouse_id")
private String outStorehouseId; //出库单号
private String pickingId; //拣货单号
private String barCode; //商品条码
private String productName; //商品名
private Integer count; //数量
private String locationId; //货位id
private String status; //状态
private String receivePerson; //收件人
private String addr; //地址
private String outTime; //出库时间
private String createPerson; //创建人
private String createTime; //创建时间
private String checkPerson; //审核人
private String checkTime; //审核时间
}

22
warehousing-system/project/wh-common/src/main/java/com/wh/pojo/Picking.java

@ -0,0 +1,22 @@
package com.wh.pojo;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
@Data
@Accessors(chain = true)
@TableName("picking")
public class Picking {
@TableId("picking_id")
private String pickingId; //拣货单号
private String outStorehouseId; //出库单号
private String status; //状态
private String recipientPerson; //领取人
private String recipientTime; //领取时间
private String createPerson; //创建人
private String createTime; //创建时间
}

24
warehousing-system/project/wh-common/src/main/java/com/wh/pojo/Product.java

@ -0,0 +1,24 @@
package com.wh.pojo;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;
@TableName("product")
@Data
@Accessors(chain = true)
@ToString
public class Product {
@TableId("bar_code")
private String barCode; //条码
private String name; //商品名
private String anotherName; //别名
private Double value; //价值
private Double netWeight; //净重
private Double roughWeight; //毛重
private Integer effectiveDays; //有效天数
private String warehouse; //所属仓库
private String remarks; //备注
}

25
warehousing-system/project/wh-common/src/main/java/com/wh/pojo/Purchase.java

@ -0,0 +1,25 @@
package com.wh.pojo;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;
import java.util.Date;
@Data
@Accessors(chain = true)
@TableName("purchase")
@ToString
public class Purchase {
@TableId("purchase_id")
private String purchaseId; //订单编号
private String product; //商品
private String barCode; //条码
private String supplier; //供应商名称
private Integer count; //数量
private String storehouse; //仓库名称
private String status; //状态
}

25
warehousing-system/project/wh-common/src/main/java/com/wh/pojo/Receiving.java

@ -0,0 +1,25 @@
package com.wh.pojo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
@Data
@Accessors(chain = true)
@TableName("receiving")
public class Receiving {
@TableId("receiving_id")
private String receivingId; //接货单编号
private String purchaseId; //采购单编号
private String removeId; //调拨编号
private String remarks; //备注
private String receivingPerson; //接货人id
private String receivingTime; //接货时间
private String checkPerson; //审批人id
private String checkTime; //审批时间
private String status; //状态
}

28
warehousing-system/project/wh-common/src/main/java/com/wh/pojo/Remove.java

@ -0,0 +1,28 @@
package com.wh.pojo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
@Data
@Accessors(chain = true)
@TableName("remove")
public class Remove {
@TableId
private String removeId; //序号
private String barCode; //商品编码
private String productName; //商品名称
private String locationId; //货位编号
private String fromLocationId; //源货位编号
private Integer count; //数量
private String status; //状态
private String createPerson; //创建人
private String createTime; //创建时间
private String checkPerson; //审核人
private String checkTime; //审核时间
}

23
warehousing-system/project/wh-common/src/main/java/com/wh/pojo/Rights.java

@ -0,0 +1,23 @@
package com.wh.pojo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.wh.pojo.BasePojo;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
@TableName("rights")
@Data
@Accessors(chain = true)
public class Rights extends BasePojo {
private Integer id; //序号
private String name; //选项名
private Integer parentId; //父id
private String path; //url路径
private Integer level; //选项等级
@TableField(exist = false)
private List<Rights> children; //不是表格固有属性
}

20
warehousing-system/project/wh-common/src/main/java/com/wh/pojo/Stock.java

@ -0,0 +1,20 @@
package com.wh.pojo;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
public class Stock {
private String inStorehouseId;
@TableId("location_id")
private String locationId;
private String locationName;
private String barCode;
private String productName;
private Integer totalQuantity;
private Integer availableQuantity;
private Integer lockedQuantity;
private String status;
}

17
warehousing-system/project/wh-common/src/main/java/com/wh/pojo/Storehouse.java

@ -0,0 +1,17 @@
package com.wh.pojo;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
@TableName("storehouse")
public class Storehouse {
@TableId("name")
private String name; //仓库名称
private String simpleName; //仓库简称
private String addr; //仓库地址
private String remarks; //备注
}

17
warehousing-system/project/wh-common/src/main/java/com/wh/pojo/Supplier.java

@ -0,0 +1,17 @@
package com.wh.pojo;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
@TableName("supplier")
public class Supplier {
@TableId("name")
private String name; //供应商名称
private String contacts; //联系人
private String number; //电话
private String remarks; //备注
}

20
warehousing-system/project/wh-common/src/main/java/com/wh/pojo/User.java

@ -0,0 +1,20 @@
package com.wh.pojo;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
@TableName("user")
public class User {
@TableId("id")
private String id;
private String username;
private String password;
private String phone;
private String email;
private String status;
}

13
warehousing-system/project/wh-common/src/main/java/com/wh/vo/Options.java

@ -0,0 +1,13 @@
package com.wh.vo;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
@Data
@Accessors(chain = true)
public class Options {
private String value;
private String label;
private List<Options> children;
}

14
warehousing-system/project/wh-common/src/main/java/com/wh/vo/PageResult.java

@ -0,0 +1,14 @@
package com.wh.vo;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
public class PageResult {
private String query;
private Integer pageNum;
private Integer pageSize;
private Long total;
private Object rows;
}

11
warehousing-system/project/wh-common/src/main/java/com/wh/vo/PickingUser.java

@ -0,0 +1,11 @@
package com.wh.vo;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
public class PickingUser {
private String outStorehouseId;
private String user;
}

13
warehousing-system/project/wh-common/src/main/java/com/wh/vo/QueryInfo.java

@ -0,0 +1,13 @@
package com.wh.vo;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
public class QueryInfo {
private String barCode;
private String locationId;
private String fromLocationId;
private Integer count;
}

43
warehousing-system/project/wh-common/src/main/java/com/wh/vo/SysResult.java

@ -0,0 +1,43 @@
package com.wh.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
public class SysResult {
private Integer status; //状态码信息 200成功 201失败
private String msg; //服务器提示信息
private Object data; //服务器返回值
public static SysResult fail(){
return new com.wh.vo.SysResult(201,"服务器运行失败",null);
}
public static com.wh.vo.SysResult success(){
return new com.wh.vo.SysResult(200, "服务器运行成功", null);
}
public static SysResult noAccess(){
return new SysResult(202,"无访问权限",null);
}
public static SysResult notEnough(){
return new SysResult(203,"数量不足",null);
}
public static com.wh.vo.SysResult success(Object data){
return new com.wh.vo.SysResult(200, "服务器运行成功", data);
}
public static com.wh.vo.SysResult success(String msg, Object data){
return new com.wh.vo.SysResult(200, msg, data);
}
}

6
warehousing-system/project/wh-common/src/test/java/Test.java

@ -0,0 +1,6 @@
public class Test {
}

47
warehousing-system/project/wh-manage/pom.xml

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>wh</artifactId>
<groupId>com.wh</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wh-manage</artifactId>
<!-- 依赖工具API-->
<dependencies>
<dependency>
<groupId>com.wh</groupId>
<artifactId>wh-common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>21.0.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
<!--添加build标签-->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>

14
warehousing-system/project/wh-manage/src/main/java/com/wh/WarehouseApplication.java

@ -0,0 +1,14 @@
package com.wh;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@MapperScan("com.wh.mapper")
public class WarehouseApplication {
public static void main(String[] args) {
SpringApplication.run(WarehouseApplication.class,args);
}
}

15
warehousing-system/project/wh-manage/src/main/java/com/wh/aop/AOPException.java

@ -0,0 +1,15 @@
package com.wh.aop;
import com.wh.vo.SysResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
@RestControllerAdvice
public class AOPException {
@ExceptionHandler({RuntimeException.class})
public Object Exception(){
return SysResult.fail();
}
}

16
warehousing-system/project/wh-manage/src/main/java/com/wh/config/MyInterceptor.java

@ -0,0 +1,16 @@
package com.wh.config;
import com.wh.controller.UserInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class MyInterceptor implements WebMvcConfigurer {
// @Autowired
// private UserInterceptor userInterceptor;
@Override
public void addInterceptors(InterceptorRegistry registry) {
// registry.addInterceptor(userInterceptor);
}
}

35
warehousing-system/project/wh-manage/src/main/java/com/wh/controller/RightsController.java

@ -0,0 +1,35 @@
package com.wh.controller;
import com.wh.pojo.Rights;
import com.wh.service.RightsService;
import com.wh.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@CrossOrigin
@RequestMapping("/rights")
public class RightsController {
@Autowired
private RightsService rightsService;
/**
* URL: /rights/getRightsList
* 参数: null
* 类型: get
* 返回值: SysResult对象 List
* 业务: 只查询前 2级权限
*/
@GetMapping("/getRightsList")
public SysResult getRightsList(){
List<Rights> rightsList =
rightsService.findRightsList();
return SysResult.success(rightsList);
}
}

26
warehousing-system/project/wh-manage/src/main/java/com/wh/controller/UserController.java

@ -0,0 +1,26 @@
package com.wh.controller;
import com.wh.pojo.User;
import com.wh.service.UserService;
import com.wh.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
@RestController
@CrossOrigin
@RequestMapping("/user/")
public class UserController {
@Autowired
private UserService userService;
@PostMapping("login")
public SysResult login(@RequestBody User user){
String token = userService.findUserByUP(user);
if (StringUtils.hasLength(token)){
return SysResult.success(token);
}else {
return SysResult.fail();
}
}
}

33
warehousing-system/project/wh-manage/src/main/java/com/wh/controller/UserInterceptor.java

@ -0,0 +1,33 @@
package com.wh.controller;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Component
public class UserInterceptor implements HandlerInterceptor {
long start;
long end ;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
System.out.println("拦截器拦截成功");
start = System.currentTimeMillis();
return true;
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
end = System.currentTimeMillis();
System.out.println("拦截结束");
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
System.out.println("释放资源"+(end-start)+"ms");
}
}

57
warehousing-system/project/wh-manage/src/main/java/com/wh/controller/initial/LocationController.java

@ -0,0 +1,57 @@
package com.wh.controller.initial;
import com.wh.pojo.Location;
import com.wh.pojo.LocationType;
import com.wh.pojo.Storehouse;
import com.wh.service.initial.LocationService;
import com.wh.vo.PageResult;
import com.wh.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@CrossOrigin
@RequestMapping("/location/")
public class LocationController {
@Autowired
private LocationService locationService;
@GetMapping("list")
public SysResult getLocationList(PageResult pageResult){
pageResult = locationService.getLocationList(pageResult);
return SysResult.success(pageResult);
}
@PostMapping("addLocation")
public SysResult addLocation(@RequestBody Location location){
locationService.addLocation(location);
return SysResult.success();
}
@PutMapping("updataLocation")
public SysResult updataLocation(@RequestBody Location location){
locationService.updataLocation(location);
return SysResult.success();
}
@DeleteMapping("delete/{name}")
public SysResult deleteLocation(@PathVariable String name){
locationService.deleteLocation(name);
return SysResult.success();
}
@GetMapping("getStorehouse")
public SysResult getStorehouse(){
List<Storehouse> storehouseList = locationService.getStorehouse();
return SysResult.success(storehouseList);
}
@GetMapping("getType")
public SysResult getType(){
List<LocationType> locationTypeList = locationService.getType();
return SysResult.success(locationTypeList);
}
}

50
warehousing-system/project/wh-manage/src/main/java/com/wh/controller/initial/ProductController.java

@ -0,0 +1,50 @@
package com.wh.controller.initial;
import com.wh.pojo.Product;
import com.wh.pojo.Storehouse;
import com.wh.service.initial.ProductService;
import com.wh.vo.PageResult;
import com.wh.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@CrossOrigin
@RequestMapping("/product/")
public class ProductController {
@Autowired
private ProductService productService;
@GetMapping("list")
public SysResult getProductList(PageResult pageResult){
pageResult = productService.getProductList(pageResult);
return SysResult.success(pageResult);
}
@PostMapping("addProduct")
public SysResult addProduct(@RequestBody Product product){
productService.addProduct(product);
return SysResult.success();
}
@PutMapping("updataProduct")
public SysResult updataProduct(@RequestBody Product product){
productService.updataProduct(product);
return SysResult.success();
}
@DeleteMapping("delete/{barCode}")
public SysResult deleteProduct(@PathVariable String barCode){
productService.deleteProduct(barCode);
return SysResult.success();
}
@GetMapping("getStorehouse")
public SysResult getStorehouse(){
List<Storehouse> storehouses = productService.getStorehouse();
return SysResult.success(storehouses);
}
}

41
warehousing-system/project/wh-manage/src/main/java/com/wh/controller/initial/StorehouseController.java

@ -0,0 +1,41 @@
package com.wh.controller.initial;
import com.wh.pojo.Storehouse;
import com.wh.service.initial.StorehouseService;
import com.wh.vo.PageResult;
import com.wh.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@CrossOrigin
@RequestMapping("/storehouse/")
public class StorehouseController {
@Autowired
private StorehouseService storehouseService;
@GetMapping("list")
public SysResult getStorehouseList(PageResult pageResult){
pageResult = storehouseService.getStorehouseList(pageResult);
return SysResult.success(pageResult);
}
@PostMapping("addStorehouse")
public SysResult addStorehouse(@RequestBody Storehouse storehouse){
storehouseService.addStorehouse(storehouse);
return SysResult.success();
}
@PutMapping("updataStorehouse")
public SysResult updataStorehouse(@RequestBody Storehouse storehouse){
storehouseService.updataStorehouse(storehouse);
return SysResult.success();
}
@DeleteMapping("delete/{name}")
public SysResult deleteStorehouse(@PathVariable String name) throws Exception {
storehouseService.deleteStorehouse(name);
return SysResult.success();
}
}

41
warehousing-system/project/wh-manage/src/main/java/com/wh/controller/initial/SupplierController.java

@ -0,0 +1,41 @@
package com.wh.controller.initial;
import com.wh.pojo.Supplier;
import com.wh.service.initial.SupplierService;
import com.wh.vo.PageResult;
import com.wh.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@CrossOrigin
@RequestMapping("/supplier/")
public class SupplierController {
@Autowired
private SupplierService supplierService;
@GetMapping("list")
public SysResult getSupplierList(PageResult pageResult){
pageResult = supplierService.getSupplierList(pageResult);
return SysResult.success(pageResult);
}
@PostMapping("addSupplier")
public SysResult addSupplier(@RequestBody Supplier supplier){
supplierService.addSupplier(supplier);
return SysResult.success();
}
@PutMapping("updataSupplier")
public SysResult updataSupplier(@RequestBody Supplier supplier){
supplierService.updataSupplier(supplier);
return SysResult.success();
}
@DeleteMapping("delete/{name}")
public SysResult deleteSupplier(@PathVariable String name){
supplierService.deleteSupplier(name);
return SysResult.success();
}
}

70
warehousing-system/project/wh-manage/src/main/java/com/wh/controller/instorehouse/PurchaseController.java

@ -0,0 +1,70 @@
package com.wh.controller.instorehouse;
import com.wh.controller.initial.StorehouseController;
import com.wh.pojo.Product;
import com.wh.pojo.Purchase;
import com.wh.pojo.Storehouse;
import com.wh.pojo.Supplier;
import com.wh.service.instorehouse.PurchaseService;
import com.wh.vo.PageResult;
import com.wh.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@RestController
@CrossOrigin
@RequestMapping("/purchase/")
public class PurchaseController {
@Autowired
private PurchaseService purchaseService;
@GetMapping("list")
public SysResult getPurchaseList(PageResult pageResult){
pageResult = purchaseService.getPurchaseList(pageResult);
return SysResult.success(pageResult);
}
@PostMapping("addPurchase")
public SysResult addPurchase(@RequestBody Purchase purchase){
purchaseService.addPurchase(purchase);
return SysResult.success();
}
@GetMapping("getProductList")
public SysResult getProductList(Product product){
// String name = (String) map.get("name");
// System.out.println(product.getName());
// System.out.println(map.toString());
List<Product> productList = purchaseService.getProductList(product.getName());
return SysResult.success(productList);
}
@GetMapping("getSupplier")
public SysResult getSupplier(){
List<Supplier> supplierList = purchaseService.getSupplier();
return SysResult.success(supplierList);
}
@GetMapping("getStorehouse")
public SysResult getStorehouse(){
List<Storehouse> storehouseList = purchaseService.getStorehouse();
return SysResult.success(storehouseList);
}
@DeleteMapping("delete/{purchaseId}")
public SysResult deletePurchase(@PathVariable String purchaseId){
purchaseService.deletePurchase(purchaseId);
return SysResult.success();
}
@PutMapping("updata")
public SysResult updataPurchase(@RequestBody Purchase purchase){
purchaseService.updataPurchase(purchase);
return SysResult.success();
}
}

52
warehousing-system/project/wh-manage/src/main/java/com/wh/controller/instorehouse/ReceivingController.java

@ -0,0 +1,52 @@
package com.wh.controller.instorehouse;
import com.wh.pojo.Receiving;
import com.wh.service.instorehouse.ReceivingService;
import com.wh.vo.Options;
import com.wh.vo.PageResult;
import com.wh.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@RestController
@CrossOrigin
@RequestMapping("/receiving/")
public class ReceivingController {
@Autowired
private ReceivingService receivingService;
@GetMapping("getOptions")
public SysResult getOptions(){
List<Options> optionsList = receivingService.getOptions();
return SysResult.success(optionsList);
}
@PostMapping("addReceiving")
public SysResult addReceiving(@RequestBody Map<String,String> map){
System.out.println(map);
receivingService.addReceiving(map.get("id"),map.get("user"));
return SysResult.success();
}
@GetMapping("getReceiving")
public SysResult getReceiving(PageResult pageResult){
pageResult = receivingService.getReceiving(pageResult);
return SysResult.success(pageResult);
}
@PutMapping("updataReceiving")
public SysResult updataReceiving(@RequestBody Receiving receiving){
receivingService.updataReceiving(receiving);
return SysResult.success();
}
@DeleteMapping("deleteReceiving/{receivingId}/{purchaseId}")
public SysResult deleteReceiving(@PathVariable String receivingId,@PathVariable String purchaseId){
receivingService.deleteReceiving(receivingId,purchaseId);
return SysResult.success();
}
}

57
warehousing-system/project/wh-manage/src/main/java/com/wh/controller/outstorehouse/OutStorehouseController.java

@ -0,0 +1,57 @@
package com.wh.controller.outstorehouse;
import com.wh.pojo.OutStorehouse;
import com.wh.service.outstorehouse.OutStorehouseService;
import com.wh.vo.PageResult;
import com.wh.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@RestController
@CrossOrigin
@RequestMapping("/outStorehouse/")
public class OutStorehouseController {
@Autowired
private OutStorehouseService outStorehouseService;
@GetMapping("getQuery")
public SysResult getQuery(OutStorehouse outStorehouse){
Map<String,Object> map = outStorehouseService.getQuery(outStorehouse);
return SysResult.success(map);
}
@GetMapping("list")
public SysResult getOutStorehouseList(PageResult pageResult){
pageResult = outStorehouseService.getOutStorehouseList(pageResult);
return SysResult.success(pageResult);
}
@PostMapping("addOutStorehouse")
public SysResult addOutStorehouse(@RequestBody OutStorehouse outStorehouse){
outStorehouseService.addOutStorehouse(outStorehouse);
return SysResult.success();
}
@PutMapping("updataOutStorehouse")
public SysResult updataOutStorehouse(@RequestBody OutStorehouse outStorehouse){
outStorehouseService.updataOutStorehouse(outStorehouse);
return SysResult.success();
}
@DeleteMapping("dalete/{outStorehouseId}")
public SysResult deleteOutStorehouse(@PathVariable String outStorehouseId){
// outStorehouseService.deleteOutStorehouse(outStorehouseId);
return SysResult.success("连接成功");
}
@PutMapping("out")
public SysResult out(@RequestBody OutStorehouse outStorehouse){
outStorehouseService.out(outStorehouse);
return SysResult.success();
}
}

46
warehousing-system/project/wh-manage/src/main/java/com/wh/controller/outstorehouse/PickingController.java

@ -0,0 +1,46 @@
package com.wh.controller.outstorehouse;
import com.wh.pojo.Picking;
import com.wh.service.outstorehouse.PickingService;
import com.wh.vo.PageResult;
import com.wh.vo.PickingUser;
import com.wh.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@CrossOrigin
@RequestMapping("/picking/")
public class PickingController {
@Autowired
private PickingService pickingService;
@GetMapping("getOptions")
public SysResult getOptions(){
List<String> outStorehouseIdList = pickingService.getOptions();
return SysResult.success(outStorehouseIdList);
}
@PutMapping("picking")
public SysResult picking(@RequestBody PickingUser pickingUser){
pickingService.picking(pickingUser.getOutStorehouseId(),pickingUser.getUser());
return SysResult.success();
}
@GetMapping("list")
public SysResult getPickingList(PageResult pageResult){
pageResult = pickingService.getPickingList(pageResult);
return SysResult.success(pageResult);
}
@PutMapping("finish")
public SysResult finish(@RequestBody Picking picking){
pickingService.finish(picking);
return SysResult.success();
}
}

26
warehousing-system/project/wh-manage/src/main/java/com/wh/controller/stock/StockController.java

@ -0,0 +1,26 @@
package com.wh.controller.stock;
import com.wh.service.stock.StockService;
import com.wh.vo.PageResult;
import com.wh.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@CrossOrigin
@RequestMapping("/stock/")
public class StockController {
@Autowired
private StockService stockService;
@GetMapping("list")
public SysResult getStockList(PageResult pageResult){
pageResult = stockService.getStockList(pageResult);
return SysResult.success(pageResult);
}
}

54
warehousing-system/project/wh-manage/src/main/java/com/wh/controller/storehousemanage/PutInController.java

@ -0,0 +1,54 @@
package com.wh.controller.storehousemanage;
import com.wh.pojo.InStorehouse;
import com.wh.service.instorehouse.PutInService;
import com.wh.vo.PageResult;
import com.wh.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@RestController
@CrossOrigin
@RequestMapping("/putIn/")
public class PutInController {
@Autowired
private PutInService putInService;
@GetMapping("getQuery")
public SysResult getQuery(InStorehouse inStorehouse){
Map<String,Object> map = putInService.getQuery(inStorehouse);
return SysResult.success(map);
}
@PostMapping("addInStorehouse")
public SysResult addInStorehouse(@RequestBody InStorehouse inStorehouse){
String data = putInService.addInStorehouse(inStorehouse);
return SysResult.success(data);
}
@GetMapping("list")
public SysResult getInStorehouseList(PageResult pageResult){
pageResult = putInService.getInStorehouseList(pageResult);
return SysResult.success(pageResult);
}
@PutMapping("updataInStorehouse")
public SysResult updataInStorehouse(@RequestBody InStorehouse inStorehouse){
// System.out.println(inStorehouse);
putInService.updataInStorehouse(inStorehouse);
return SysResult.success();
}
@DeleteMapping("deleteInStorehouse/{inStorehouseId}/{receivingId}")
public SysResult deleteInStorehouse(@PathVariable String inStorehouseId,@PathVariable String receivingId){
String data = putInService.deleteInStorehouse(inStorehouseId,receivingId);
return SysResult.success(data);
}
}

44
warehousing-system/project/wh-manage/src/main/java/com/wh/controller/storehousemanage/RemoveController.java

@ -0,0 +1,44 @@
package com.wh.controller.storehousemanage;
import com.wh.pojo.Remove;
import com.wh.service.storehousemanage.RemoveService;
import com.wh.vo.PageResult;
import com.wh.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@RestController
@CrossOrigin
@RequestMapping("/remove/")
public class RemoveController {
@Autowired
private RemoveService removeService;
@GetMapping("getQuery")
public SysResult getQuery(Remove remove){
Map<String,Object> map = removeService.getQuery(remove);
return SysResult.success(map);
}
@PostMapping("addRemove")
public SysResult addRemove(@RequestBody Remove remove){
removeService.addRemove(remove);
return SysResult.success();
}
@GetMapping("list")
public SysResult getRemoveList(PageResult pageResult){
pageResult = removeService.getRemoveList(pageResult);
return SysResult.success(pageResult);
}
@PutMapping("updata")
public SysResult updataRemove(@RequestBody Remove remove){
removeService.updataRemove(remove);
return SysResult.success();
}
}

57
warehousing-system/project/wh-manage/src/main/java/com/wh/controller/storehousemanage/ShelvesController.java

@ -0,0 +1,57 @@
package com.wh.controller.storehousemanage;
import com.wh.pojo.OnShelves;
import com.wh.service.storehousemanage.ShelvesService;
import com.wh.vo.PageResult;
import com.wh.vo.QueryInfo;
import com.wh.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@RestController
@CrossOrigin
@RequestMapping("/shelves/")
public class ShelvesController {
@Autowired
private ShelvesService shelvesService;
@GetMapping("getQuery")
public SysResult getQuery(QueryInfo queryInfo){
Map<String,Object> map = shelvesService.getQuery(queryInfo);
if (map.size()==0){
return SysResult.notEnough();
}else {
return SysResult.success(map);
}
}
@PostMapping("add")
public SysResult addShelves(@RequestBody OnShelves onShelves){
// System.out.println(onShelves);
shelvesService.addShelves(onShelves);
return SysResult.success();
}
@GetMapping("getShelves")
public SysResult getShelves(PageResult pageResult){
pageResult = shelvesService.getShelves(pageResult);
return SysResult.success(pageResult);
}
@DeleteMapping("deleteShelves/{id}")
public SysResult deleteShelves(@PathVariable String id){
shelvesService.deleteShelves(id);
return SysResult.success();
}
@PutMapping("updataShelves")
public SysResult updataShelves(@RequestBody OnShelves onShelves) throws Exception {
System.out.println(onShelves);
shelvesService.updataShelves(onShelves);
return SysResult.success();
}
}

7
warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/RightsMapper.java

@ -0,0 +1,7 @@
package com.wh.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wh.pojo.Rights;
public interface RightsMapper extends BaseMapper<Rights> {
}

7
warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/UserMapper.java

@ -0,0 +1,7 @@
package com.wh.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wh.pojo.User;
public interface UserMapper extends BaseMapper<User> {
}

7
warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/initial/LocationMapper.java

@ -0,0 +1,7 @@
package com.wh.mapper.initial;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wh.pojo.Location;
public interface LocationMapper extends BaseMapper<Location> {
}

7
warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/initial/LocationTypeMapper.java

@ -0,0 +1,7 @@
package com.wh.mapper.initial;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wh.pojo.LocationType;
public interface LocationTypeMapper extends BaseMapper<LocationType> {
}

7
warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/initial/ProductMapper.java

@ -0,0 +1,7 @@
package com.wh.mapper.initial;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wh.pojo.Product;
public interface ProductMapper extends BaseMapper<Product> {
}

7
warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/initial/StorehouseMapper.java

@ -0,0 +1,7 @@
package com.wh.mapper.initial;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wh.pojo.Storehouse;
public interface StorehouseMapper extends BaseMapper<Storehouse> {
}

7
warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/initial/SupplierMapper.java

@ -0,0 +1,7 @@
package com.wh.mapper.initial;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wh.pojo.Supplier;
public interface SupplierMapper extends BaseMapper<Supplier> {
}

7
warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/instorehouse/PurchaseMapper.java

@ -0,0 +1,7 @@
package com.wh.mapper.instorehouse;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wh.pojo.Purchase;
public interface PurchaseMapper extends BaseMapper<Purchase> {
}

8
warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/instorehouse/PutInMapper.java

@ -0,0 +1,8 @@
package com.wh.mapper.instorehouse;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wh.pojo.InStorehouse;
public interface PutInMapper extends BaseMapper<InStorehouse> {
}

7
warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/instorehouse/ReceivingMapper.java

@ -0,0 +1,7 @@
package com.wh.mapper.instorehouse;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wh.pojo.Receiving;
public interface ReceivingMapper extends BaseMapper<Receiving> {
}

7
warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/outstorehouse/OutStorehouseMapper.java

@ -0,0 +1,7 @@
package com.wh.mapper.outstorehouse;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wh.pojo.OutStorehouse;
public interface OutStorehouseMapper extends BaseMapper<OutStorehouse> {
}

7
warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/outstorehouse/PickingMapper.java

@ -0,0 +1,7 @@
package com.wh.mapper.outstorehouse;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wh.pojo.Picking;
public interface PickingMapper extends BaseMapper<Picking> {
}

7
warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/stock/StockMapper.java

@ -0,0 +1,7 @@
package com.wh.mapper.stock;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wh.pojo.Stock;
public interface StockMapper extends BaseMapper<Stock> {
}

7
warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/storehousemanage/RemoveMapper.java

@ -0,0 +1,7 @@
package com.wh.mapper.storehousemanage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wh.pojo.Remove;
public interface RemoveMapper extends BaseMapper<Remove> {
}

7
warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/storehousemanage/ShelvesMapper.java

@ -0,0 +1,7 @@
package com.wh.mapper.storehousemanage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wh.pojo.OnShelves;
public interface ShelvesMapper extends BaseMapper<OnShelves> {
}

9
warehousing-system/project/wh-manage/src/main/java/com/wh/service/RightsService.java

@ -0,0 +1,9 @@
package com.wh.service;
import com.wh.pojo.Rights;
import java.util.List;
public interface RightsService {
List<Rights> findRightsList();
}

42
warehousing-system/project/wh-manage/src/main/java/com/wh/service/RightsServiceImpl.java

@ -0,0 +1,42 @@
package com.wh.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wh.mapper.RightsMapper;
import com.wh.pojo.Rights;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class RightsServiceImpl implements RightsService{
@Autowired
private RightsMapper rightsMapper;
/**
* 查询一级/二级菜单
* 查询条件: 一级菜单 parent_id = 0
* 二级菜单 parent_id = 一级的Id
* 作业: 利用左连接的方式 实现数据的封装 restMap
* @return
*/
@Override
public List<Rights> findRightsList() {
//1.查询一级菜单数据
QueryWrapper<Rights> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("parent_id",0);
List<Rights> oneList =
rightsMapper.selectList(queryWrapper);
//2.如何查询二级菜单 父子关系的封装!!!
for (Rights oneRights : oneList){
//查询该元素的二级菜单
//QueryWrapper<Rights> queryWrapper2 = new QueryWrapper<>();
queryWrapper.clear();
queryWrapper.eq("parent_id",oneRights.getId());
List<Rights> twoList = rightsMapper.selectList(queryWrapper);
oneRights.setChildren(twoList);
}
return oneList;
}
}

7
warehousing-system/project/wh-manage/src/main/java/com/wh/service/UserService.java

@ -0,0 +1,7 @@
package com.wh.service;
import com.wh.pojo.User;
public interface UserService {
String findUserByUP(User user);
}

28
warehousing-system/project/wh-manage/src/main/java/com/wh/service/UserServiceImpl.java

@ -0,0 +1,28 @@
package com.wh.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wh.mapper.UserMapper;
import com.wh.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;
import java.util.UUID;
@Service
public class UserServiceImpl implements UserService{
@Autowired
private UserMapper userMapper;
@Override
public String findUserByUP(User user) {
String md5Pass = DigestUtils.md5DigestAsHex(user.getPassword().getBytes());
user.setPassword(md5Pass);
QueryWrapper queryWrapper = new QueryWrapper(user);
User userDB = userMapper.selectOne(queryWrapper);
String token = UUID.randomUUID().toString().replace("-", "")+user.getUsername();
return userDB==null?null:token;
}
}

22
warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/LocationService.java

@ -0,0 +1,22 @@
package com.wh.service.initial;
import com.wh.pojo.Location;
import com.wh.pojo.LocationType;
import com.wh.pojo.Storehouse;
import com.wh.vo.PageResult;
import java.util.List;
public interface LocationService {
PageResult getLocationList(PageResult pageResult);
void addLocation(Location location);
void updataLocation(Location location);
void deleteLocation(String name);
List<Storehouse> getStorehouse();
List<LocationType> getType();
}

67
warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/LocationServiceImpl.java

@ -0,0 +1,67 @@
package com.wh.service.initial;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wh.mapper.initial.LocationMapper;
import com.wh.mapper.initial.LocationTypeMapper;
import com.wh.mapper.initial.StorehouseMapper;
import com.wh.pojo.Location;
import com.wh.pojo.LocationType;
import com.wh.pojo.Storehouse;
import com.wh.vo.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.List;
@Service
public class LocationServiceImpl implements LocationService{
@Autowired
private LocationTypeMapper locationTypeMapper;
@Autowired
private StorehouseMapper storehouseMapper;
@Autowired
private LocationMapper locationMapper;
@Override
public PageResult getLocationList(PageResult pageResult) {
Page<Location> locationPage = new Page<>(pageResult.getPageNum(),pageResult.getPageSize());
QueryWrapper<Location> queryWrapper = new QueryWrapper<>();
boolean flag = StringUtils.hasLength(pageResult.getQuery());
queryWrapper.like(flag,"name",pageResult.getQuery());
locationPage = locationMapper.selectPage(locationPage,queryWrapper);
pageResult.setTotal((long) locationPage.getRecords().size()).setRows(locationPage.getRecords());
return pageResult;
}
@Override
public void addLocation(Location location) {
locationMapper.insert(location);
}
@Override
public void updataLocation(Location location) {
locationMapper.updateById(location);
}
@Override
public void deleteLocation(String name) {
locationMapper.deleteById(name);
}
@Override
public List<Storehouse> getStorehouse() {
return storehouseMapper.selectList(null);
}
@Override
public List<LocationType> getType() {
return locationTypeMapper.selectList(null);
}
}

19
warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/ProductService.java

@ -0,0 +1,19 @@
package com.wh.service.initial;
import com.wh.pojo.Product;
import com.wh.pojo.Storehouse;
import com.wh.vo.PageResult;
import java.util.List;
public interface ProductService {
PageResult getProductList(PageResult pageResult);
void addProduct(Product product);
void updataProduct(Product product);
void deleteProduct(String barCode);
List<Storehouse> getStorehouse();
}

63
warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/ProductServiceImpl.java

@ -0,0 +1,63 @@
package com.wh.service.initial;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wh.mapper.initial.ProductMapper;
import com.wh.mapper.initial.StorehouseMapper;
import com.wh.pojo.Product;
import com.wh.pojo.Storehouse;
import com.wh.vo.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class ProductServiceImpl implements ProductService{
@Autowired
private StorehouseMapper storehouseMapper;
@Autowired
private ProductMapper productMapper;
@Override
public PageResult getProductList(PageResult pageResult) {
Page<Product> productPage = new Page<>(pageResult.getPageNum(),pageResult.getPageSize());
QueryWrapper<Product> queryWrapper = new QueryWrapper<>();
boolean flag = StringUtils.hasLength(pageResult.getQuery());
queryWrapper.like(flag,"name",pageResult.getQuery());
productPage = productMapper.selectPage(productPage,queryWrapper);
pageResult.setTotal((long) productPage.getRecords().size()).setRows(productPage.getRecords());
// System.out.println(productPage.getRecords().size());
return pageResult;
}
@Override
public void addProduct(Product product) {
productMapper.insert(product);
}
@Override
public void updataProduct(Product product) {
productMapper.updateById(product);
}
@Override
public void deleteProduct(String barCode) {
Map<String,Object> map = new HashMap<>();
map.put("bar_code",barCode);
productMapper.deleteByMap(map);
}
@Override
public List<Storehouse> getStorehouse() {
List<Storehouse> storehouses = storehouseMapper.selectList(null);
return storehouses;
}
}

14
warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/StorehouseService.java

@ -0,0 +1,14 @@
package com.wh.service.initial;
import com.wh.pojo.Storehouse;
import com.wh.vo.PageResult;
public interface StorehouseService {
PageResult getStorehouseList(PageResult pageResult);
void addStorehouse(Storehouse storehouse);
void updataStorehouse(Storehouse storehouse);
void deleteStorehouse(String name) throws Exception;
}

60
warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/StorehouseServiceImpl.java

@ -0,0 +1,60 @@
package com.wh.service.initial;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wh.mapper.initial.LocationMapper;
import com.wh.mapper.initial.StorehouseMapper;
import com.wh.pojo.Location;
import com.wh.pojo.Storehouse;
import com.wh.vo.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.List;
@Service
public class StorehouseServiceImpl implements StorehouseService{
@Autowired
private StorehouseMapper storehouseMapper;
@Autowired
private LocationMapper locationMapper;
@Override
public PageResult getStorehouseList(PageResult pageResult) {
Page<Storehouse> storehousePage = new Page<>(pageResult.getPageNum(),pageResult.getPageSize());
QueryWrapper<Storehouse> queryWrapper = new QueryWrapper<>();
boolean flag = StringUtils.hasLength(pageResult.getQuery());
queryWrapper.like(flag,"name",pageResult.getQuery());
storehousePage = storehouseMapper.selectPage(storehousePage,queryWrapper);
pageResult.setTotal((long) storehousePage.getRecords().size()).setRows(storehousePage.getRecords());
return pageResult;
}
@Override
public void addStorehouse(Storehouse storehouse) {
storehouseMapper.insert(storehouse);
}
@Override
public void updataStorehouse(Storehouse storehouse) {
storehouseMapper.updateById(storehouse);
}
@Override
public void deleteStorehouse(String name) throws Exception {
Storehouse storehouse = storehouseMapper.selectById(name);
QueryWrapper<Location> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("storehouse",name);
List<Location> locationList = locationMapper.selectList(queryWrapper);
if (locationList.size() != 0) throw new Exception("出库中有货位");
storehouseMapper.deleteById(name);
}
}

15
warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/SupplierService.java

@ -0,0 +1,15 @@
package com.wh.service.initial;
import com.wh.pojo.Supplier;
import com.wh.vo.PageResult;
public interface SupplierService {
PageResult getSupplierList(PageResult pageResult);
void addSupplier(Supplier supplier);
void updataSupplier(Supplier supplier);
void deleteSupplier(String name);
}

44
warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/SupplierServiceImpl.java

@ -0,0 +1,44 @@
package com.wh.service.initial;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wh.mapper.initial.SupplierMapper;
import com.wh.pojo.Supplier;
import com.wh.vo.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
@Service
public class SupplierServiceImpl implements SupplierService{
@Autowired
private SupplierMapper supplierMapper;
@Override
public PageResult getSupplierList(PageResult pageResult) {
Page<Supplier> supplierPage = new Page<>(pageResult.getPageNum(),pageResult.getPageSize());
QueryWrapper<Supplier> queryWrapper = new QueryWrapper<>();
boolean flag = StringUtils.hasLength(pageResult.getQuery());
queryWrapper.like(flag,"name",pageResult.getQuery());
supplierPage = supplierMapper.selectPage(supplierPage,queryWrapper);
pageResult.setTotal((long) supplierPage.getRecords().size()).setRows(supplierPage.getRecords());
return pageResult;
}
@Override
public void addSupplier(Supplier supplier) {
supplierMapper.insert(supplier);
}
@Override
public void updataSupplier(Supplier supplier) {
supplierMapper.updateById(supplier);
}
@Override
public void deleteSupplier(String name) {
supplierMapper.deleteById(name);
}
}

25
warehousing-system/project/wh-manage/src/main/java/com/wh/service/instorehouse/PurchaseService.java

@ -0,0 +1,25 @@
package com.wh.service.instorehouse;
import com.wh.pojo.Product;
import com.wh.pojo.Purchase;
import com.wh.pojo.Storehouse;
import com.wh.pojo.Supplier;
import com.wh.vo.PageResult;
import java.util.List;
public interface PurchaseService {
PageResult getPurchaseList(PageResult pageResult);
void addPurchase(Purchase purchase);
List<Product> getProductList(String name);
List<Supplier> getSupplier();
List<Storehouse> getStorehouse();
void deletePurchase(String purchaseId);
void updataPurchase(Purchase purchase);
}

84
warehousing-system/project/wh-manage/src/main/java/com/wh/service/instorehouse/PurchaseServiceImpl.java

@ -0,0 +1,84 @@
package com.wh.service.instorehouse;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wh.mapper.initial.ProductMapper;
import com.wh.mapper.initial.StorehouseMapper;
import com.wh.mapper.initial.SupplierMapper;
import com.wh.mapper.instorehouse.PurchaseMapper;
import com.wh.pojo.*;
import com.wh.vo.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.List;
@Service
public class PurchaseServiceImpl implements PurchaseService{
@Autowired
private StorehouseMapper storehouseMapper;
@Autowired
private SupplierMapper supplierMapper;
@Autowired
private ProductMapper productMapper;
@Autowired
private PurchaseMapper purchaseMapper;
@Override
public PageResult getPurchaseList(PageResult pageResult) {
Page<Purchase> purchasePage = new Page<>(pageResult.getPageNum(),pageResult.getPageSize());
QueryWrapper<Purchase> queryWrapper = new QueryWrapper<>();
boolean flag = StringUtils.hasLength(pageResult.getQuery());
queryWrapper.like(flag,"purchase_id",pageResult.getQuery());
purchasePage = purchaseMapper.selectPage(purchasePage,queryWrapper);
pageResult.setTotal((long) purchasePage.getRecords().size()).setRows(purchasePage.getRecords());
// System.out.println(purchasePage.getRecords().size());
return pageResult;
}
@Override
public void addPurchase(Purchase purchase) {
purchaseMapper.insert(purchase);
}
@Override
public List<Product> getProductList(String name) {
boolean flag = StringUtils.hasLength(name);
QueryWrapper<Product> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(flag,"name",name);
List<Product> productList = productMapper.selectList(queryWrapper);
return productList;
}
@Override
public List<Supplier> getSupplier() {
List<Supplier> supplierList = supplierMapper.selectList(null);
return supplierList;
}
@Override
public List<Storehouse> getStorehouse() {
// QueryWrapper<Storehouse> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("type","入库区");
// return storehouseMapper.selectList(queryWrapper);
return storehouseMapper.selectList(null);
}
@Override
public void deletePurchase(String purchaseId) {
purchaseMapper.deleteById(purchaseId);
}
@Override
public void updataPurchase(Purchase purchase) {
purchaseMapper.updateById(purchase);
}
}

20
warehousing-system/project/wh-manage/src/main/java/com/wh/service/instorehouse/PutInService.java

@ -0,0 +1,20 @@
package com.wh.service.instorehouse;
import com.wh.pojo.InStorehouse;
import com.wh.vo.PageResult;
import java.util.Map;
public interface PutInService {
Map<String, Object> getQuery(InStorehouse inStorehouse);
String addInStorehouse(InStorehouse inStorehouse);
PageResult getInStorehouseList(PageResult pageResult);
void updataInStorehouse(InStorehouse inStorehouse);
String deleteInStorehouse(String inStorehouseId, String receivingId);
}

220
warehousing-system/project/wh-manage/src/main/java/com/wh/service/instorehouse/PutInServiceImpl.java

@ -0,0 +1,220 @@
package com.wh.service.instorehouse;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wh.api.Api;
import com.wh.mapper.initial.LocationMapper;
import com.wh.mapper.initial.ProductMapper;
import com.wh.mapper.instorehouse.PurchaseMapper;
import com.wh.mapper.instorehouse.ReceivingMapper;
import com.wh.mapper.stock.StockMapper;
import com.wh.mapper.instorehouse.PutInMapper;
import com.wh.mapper.storehousemanage.RemoveMapper;
import com.wh.pojo.*;
import com.wh.vo.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class PutInServiceImpl implements PutInService {
@Autowired
private PutInMapper putInMapper;
@Autowired
private ReceivingMapper receivingMapper;
@Autowired
private LocationMapper locationMapper;
@Autowired
private StockMapper stockMapper;
@Autowired
private PurchaseMapper purchaseMapper;
@Autowired
private ProductMapper productMapper;
@Autowired
private RemoveMapper removeMapper;
@Override
public Map<String, Object> getQuery(InStorehouse inStorehouse) {
Purchase purchase = new Purchase();
if (StringUtils.hasLength(inStorehouse.getReceivingId())){
Receiving receivingAble = receivingMapper.selectById(inStorehouse.getReceivingId());
purchase = purchaseMapper.selectById(receivingAble.getPurchaseId());
}
QueryWrapper<Receiving> receivingQueryWrapper = new QueryWrapper<>();
receivingQueryWrapper.eq("status","已审核")
.select("receiving_id");
QueryWrapper<Location> locationQueryWrapper = new QueryWrapper<>();
locationQueryWrapper.eq("status","空闲")
.eq("type","入库区")
.eq(StringUtils.hasLength(purchase.getStorehouse()),"storehouse",purchase.getStorehouse())
.select("location_id");
List<Receiving> receivingList = receivingMapper.selectList(receivingQueryWrapper);
List<Location> locationList = locationMapper.selectList(locationQueryWrapper);
List<String> receivingIdList = new ArrayList<>();
List<String> locationIdList = new ArrayList<>();
for (Receiving receiving : receivingList){
receivingIdList.add(receiving.getReceivingId());
}
if (locationList != null){
for (Location location : locationList){
locationIdList.add(location.getLocationId());
}
}
Map<String,Object> map = new HashMap<>();
map.put("receivingIdList",receivingIdList);
map.put("locationIdList",locationIdList);
return map;
}
@Override
public String addInStorehouse(InStorehouse inStorehouse) {
QueryWrapper<InStorehouse> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("location_id",inStorehouse.getLocationId());
if(putInMapper.selectCount(queryWrapper) != 0){
return "已有记录";
}
inStorehouse.setStatus("待审核")
.setInStorehouseId("IN" + System.currentTimeMillis())
.setCreateTime(new Api().getTime());
putInMapper.insert(inStorehouse);
Receiving receiving = receivingMapper.selectById(inStorehouse.getReceivingId());
receiving.setStatus("进行中");
receivingMapper.updateById(receiving);
return "添加成功";
}
@Override
public PageResult getInStorehouseList(PageResult pageResult) {
Page<InStorehouse> page = new Page<>(pageResult.getPageNum(),pageResult.getPageSize());
boolean flag = StringUtils.hasLength(pageResult.getQuery());
QueryWrapper<InStorehouse> queryWrapper = new QueryWrapper<>();
queryWrapper.like(flag,"in_storehouse_id",pageResult.getQuery());
page = putInMapper.selectPage(page,queryWrapper);
pageResult.setTotal((long) page.getRecords().size()).setRows(page.getRecords());
return pageResult;
}
@Override
//
public void updataInStorehouse(InStorehouse inStorehouse) {
//判断订单状态
if (inStorehouse.getStatus().equals("已审核")){
//设置审核时间
inStorehouse.setCheckTime(new Api().getTime());
check(inStorehouse);
}else if(inStorehouse.getStatus().equals("待审核")){
inStorehouse.setCheckTime("")
.setCheckPerson("");
stockMapper.deleteById(inStorehouse.getLocationId());
Location location = locationMapper.selectById(inStorehouse.getLocationId());
location.setStatus("空闲");
locationMapper.updateById(location);
}
putInMapper.updateById(inStorehouse);
}
@Override
public String deleteInStorehouse(String inStorehouseId, String receivingId) {
Receiving receiving = receivingMapper.selectById(receivingId);
receiving.setStatus("已审核");
receivingMapper.updateById(receiving);
putInMapper.deleteById(inStorehouseId);
return "撤销成功";
}
public void check(InStorehouse inStorehouse){
Stock stock = new Stock();
//获取货位名称
Location location = locationMapper.selectById(inStorehouse.getLocationId());
String locationName = location.getName();
//获取商品条码
String barCode = null;
//获取接货单
Receiving receiving = receivingMapper.selectById(inStorehouse.getReceivingId());
if (StringUtils.hasLength(receiving.getPurchaseId())) {
Purchase purchase = purchaseMapper.selectById(receiving.getPurchaseId());
barCode = purchase.getBarCode();
stock.setTotalQuantity(purchase.getCount())
.setAvailableQuantity(purchase.getCount());
} else {
Remove remove = removeMapper.selectById(receiving.getRemoveId());
barCode = remove.getBarCode();
stock.setTotalQuantity(remove.getCount())
.setAvailableQuantity(remove.getCount());
}
//获取商品名称
Product product = productMapper.selectById(barCode);
String productName = product.getName();
//赋值
stock.setInStorehouseId(inStorehouse.getInStorehouseId())
.setLocationId(inStorehouse.getLocationId())
.setLocationName(locationName)
.setBarCode(barCode)
.setProductName(productName)
.setLockedQuantity(0)
.setStatus("待上架");
stockMapper.insert(stock);
//修改移库源货位库存
if (receiving.getRemoveId() != null){
Remove remove = removeMapper.selectById(receiving.getRemoveId());
Stock fromStock = stockMapper.selectById(remove.getFromLocationId());
fromStock.setLockedQuantity(fromStock.getLockedQuantity() - remove.getCount())
.setTotalQuantity(fromStock.getTotalQuantity() - remove.getCount());
stockMapper.updateById(fromStock);
}
location.setStatus(barCode);
locationMapper.updateById(location);
}
}

19
warehousing-system/project/wh-manage/src/main/java/com/wh/service/instorehouse/ReceivingService.java

@ -0,0 +1,19 @@
package com.wh.service.instorehouse;
import com.wh.pojo.Receiving;
import com.wh.vo.Options;
import com.wh.vo.PageResult;
import java.util.List;
public interface ReceivingService {
List<Options> getOptions();
void addReceiving(String id,String user);
PageResult getReceiving(PageResult pageResult);
void updataReceiving(Receiving receiving);
void deleteReceiving(String receivingId,String purchaseId);
}

132
warehousing-system/project/wh-manage/src/main/java/com/wh/service/instorehouse/ReceivingServiceImpl.java

@ -0,0 +1,132 @@
package com.wh.service.instorehouse;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wh.api.Api;
import com.wh.mapper.instorehouse.PurchaseMapper;
import com.wh.mapper.instorehouse.ReceivingMapper;
import com.wh.mapper.storehousemanage.RemoveMapper;
import com.wh.pojo.Purchase;
import com.wh.pojo.Receiving;
import com.wh.pojo.Remove;
import com.wh.vo.Options;
import com.wh.vo.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Service
public class ReceivingServiceImpl implements ReceivingService{
@Autowired
private ReceivingMapper receivingMapper;
@Autowired
private PurchaseMapper purchaseMapper;
@Autowired
private RemoveMapper removeMapper;
@Override
public List<Options> getOptions() {
List<Options> optionsList = new ArrayList<>();
List<Options> optionsList2 = new ArrayList<>();
List<Options> optionsList3 = new ArrayList<>();
Options optionsPurchase = new Options();
Options optionsRemove = new Options();
QueryWrapper<Purchase> purchaseQueryWrapper = new QueryWrapper<>();
purchaseQueryWrapper.eq("status","已审核");
List<Purchase> purchaseList = purchaseMapper.selectList(purchaseQueryWrapper);
// System.out.println(purchaseList);
// System.out.println(purchaseList.get(0).getPurchaseId());
for(Purchase purchase : purchaseList){
optionsList2.add(new Options().setLabel(purchase.getPurchaseId()).setValue(purchase.getPurchaseId()));
}
optionsPurchase.setValue("purchase").setLabel("采购订单编号").setChildren(optionsList2);
// System.out.println(optionsList2);
optionsList.add(optionsPurchase);
QueryWrapper<Remove> removeQueryWrapper = new QueryWrapper<>();
removeQueryWrapper.eq("status","已审核");
List<Remove> removeList = removeMapper.selectList(removeQueryWrapper);
for(Remove remove : removeList){
optionsList3.add(new Options().setLabel(remove.getRemoveId()).setValue(remove.getRemoveId()));
}
optionsRemove.setValue("remove").setLabel("移库编号").setChildren(optionsList3);
optionsList.add(optionsRemove);
System.out.println(optionsList);
return optionsList;
}
@Override
public void addReceiving(String id,String user) {
// System.out.println(purchase);
Receiving receiving = new Receiving();
receiving.setReceivingId("IR" + Long.toString(System.currentTimeMillis()))
.setReceivingPerson(user)
.setReceivingTime(new Api().getTime())
.setStatus("待审核");
if (id.charAt(0) == 'I'){
Purchase purchase = purchaseMapper.selectById(id);
receiving.setPurchaseId(purchase.getPurchaseId());
purchase.setStatus("进行中");
purchaseMapper.updateById(purchase);
}else {
Remove remove = removeMapper.selectById(id);
receiving.setRemoveId(remove.getRemoveId());
remove.setStatus("进行中");
removeMapper.updateById(remove);
}
receivingMapper.insert(receiving);
}
@Override
public PageResult getReceiving(PageResult pageResult) {
Page<Receiving> receivingPage = new Page<>(pageResult.getPageNum(),pageResult.getPageSize());
QueryWrapper<Receiving> queryWrapper = new QueryWrapper<>();
boolean flag = StringUtils.hasLength(pageResult.getQuery());
queryWrapper.like(flag,"receiving_id",pageResult.getQuery());
receivingPage = receivingMapper.selectPage(receivingPage,queryWrapper);
pageResult.setTotal((long) receivingPage.getRecords().size()).setRows(receivingPage.getRecords());
// System.out.println(receivingPage.getRecords().size());
return pageResult;
}
@Override
public void updataReceiving(Receiving receiving) {
if (StringUtils.hasLength(receiving.getCheckPerson())){
receiving.setCheckTime(new Api().getTime());
}
receivingMapper.updateById(receiving);
}
@Override
public void deleteReceiving(String receivingId,String purchaseId) {
receivingMapper.deleteById(receivingId);
Purchase purchase = purchaseMapper.selectById(purchaseId);
purchase.setStatus("已审核");
purchaseMapper.updateById(purchase);
}
}

20
warehousing-system/project/wh-manage/src/main/java/com/wh/service/outstorehouse/OutStorehouseService.java

@ -0,0 +1,20 @@
package com.wh.service.outstorehouse;
import com.wh.pojo.OutStorehouse;
import com.wh.vo.PageResult;
import java.util.Map;
public interface OutStorehouseService {
Map<String, Object> getQuery(OutStorehouse outStorehouse);
PageResult getOutStorehouseList(PageResult pageResult);
void addOutStorehouse(OutStorehouse outStorehouse);
void updataOutStorehouse(OutStorehouse outStorehouse);
void deleteOutStorehouse(String id,Integer count , String locationId);
void out(OutStorehouse outStorehouse);
}

157
warehousing-system/project/wh-manage/src/main/java/com/wh/service/outstorehouse/OutStorehouseServiceImpl.java

@ -0,0 +1,157 @@
package com.wh.service.outstorehouse;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wh.api.Api;
import com.wh.mapper.initial.ProductMapper;
import com.wh.mapper.outstorehouse.OutStorehouseMapper;
import com.wh.mapper.outstorehouse.PickingMapper;
import com.wh.mapper.stock.StockMapper;
import com.wh.pojo.*;
import com.wh.vo.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.*;
@Service
public class OutStorehouseServiceImpl implements OutStorehouseService {
@Autowired
private OutStorehouseMapper outStorehouseMapper;
@Autowired
private StockMapper stockMapper;
@Autowired
private ProductMapper productMapper;
@Autowired
private PickingMapper pickingMapper;
@Override
public Map<String, Object> getQuery(OutStorehouse outStorehouse) {
Map<String,Object> map = new HashMap<>();
Set<String> barCodeList = new HashSet<>();
Set<String> locationIdList = new HashSet<>();
String productName = "";
Integer availableQuantity = 0;
boolean barCodeFlag = StringUtils.hasLength(outStorehouse.getBarCode());
boolean locationIdFlag = StringUtils.hasLength(outStorehouse.getLocationId());
QueryWrapper<Stock> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(barCodeFlag,"bar_code",outStorehouse.getBarCode())
.eq(locationIdFlag,"location_id",outStorehouse.getLocationId())
.eq("status","已上架");
List<Stock> stockList = stockMapper.selectList(queryWrapper);
if (stockList.size() == 1){
productName = stockList.get(0).getProductName();
availableQuantity = stockList.get(0).getAvailableQuantity();
}
for (Stock stock : stockList){
barCodeList.add(stock.getBarCode());
locationIdList.add(stock.getLocationId());
}
map.put("barCodeList",barCodeList);
map.put("locationIdList",locationIdList);
map.put("availableQuantity",availableQuantity);
map.put("productName",productName);
return map;
}
@Override
public PageResult getOutStorehouseList(PageResult pageResult) {
Page<OutStorehouse> page = new Page<>(pageResult.getPageNum(),pageResult.getPageSize());
boolean flag = StringUtils.hasLength(pageResult.getQuery());
QueryWrapper<OutStorehouse> queryWrapper = new QueryWrapper<>();
queryWrapper.like(flag,"out_storehouse_id",pageResult.getQuery());
page = outStorehouseMapper.selectPage(page,queryWrapper);
pageResult.setTotal((long) page.getRecords().size()).setRows(page.getRecords());
return pageResult;
}
@Override
public void addOutStorehouse(OutStorehouse outStorehouse) {
outStorehouse.setCreateTime(new Api().getTime());
/**修改stock*/
Stock stock = stockMapper.selectById(outStorehouse.getLocationId());
stock.setAvailableQuantity(
stock.getAvailableQuantity() - outStorehouse.getCount()
);
stockMapper.updateById(stock);
outStorehouseMapper.insert(outStorehouse);
}
@Override
public void updataOutStorehouse(OutStorehouse outStorehouse) {
/** 修改stock*/
Stock stock = stockMapper.selectById(outStorehouse.getLocationId());
if (outStorehouse.getStatus().equals("已审核")){
//设置锁定数量
stock.setLockedQuantity(
stock.getLockedQuantity() + outStorehouse.getCount()
);
//设置审核时间
outStorehouse.setCheckTime(new Api().getTime());
//设置拣货id/添加拣货单
if (!StringUtils.hasLength(outStorehouse.getPickingId())){
String pickingId = "PI" + System.currentTimeMillis();
outStorehouse.setPickingId(pickingId);
Picking picking = new Picking();
picking.setPickingId(pickingId)
.setOutStorehouseId(outStorehouse.getOutStorehouseId())
.setCreatePerson(outStorehouse.getCheckPerson())
.setCreateTime(new Api().getTime())
.setStatus("待拣货");
pickingMapper.insert(picking);
}
} else if (outStorehouse.getStatus().equals("待审核")){
stock.setLockedQuantity(
stock.getLockedQuantity() - outStorehouse.getCount()
);
if (StringUtils.hasLength(outStorehouse.getPickingId())){
pickingMapper.deleteById(outStorehouse.getPickingId());
}
outStorehouse.setPickingId("")
.setCheckPerson("")
.setCheckTime("");
}
stockMapper.updateById(stock);
outStorehouseMapper.updateById(outStorehouse);
}
@Override
public void deleteOutStorehouse(String id , Integer count , String locationId) {
Stock stock = stockMapper.selectById(locationId);
stock.setAvailableQuantity(
stock.getAvailableQuantity() + count
);
stockMapper.updateById(stock);
outStorehouseMapper.deleteById(id);
}
@Override
public void out(OutStorehouse outStorehouse) {
outStorehouse.setOutTime(new Api().getTime());
outStorehouseMapper.updateById(outStorehouse);
Stock stock = stockMapper.selectById(outStorehouse.getLocationId());
stock.setTotalQuantity(stock.getTotalQuantity() - outStorehouse.getCount())
.setLockedQuantity(stock.getLockedQuantity() - outStorehouse.getCount());
stockMapper.updateById(stock);
}
}

16
warehousing-system/project/wh-manage/src/main/java/com/wh/service/outstorehouse/PickingService.java

@ -0,0 +1,16 @@
package com.wh.service.outstorehouse;
import com.wh.pojo.Picking;
import com.wh.vo.PageResult;
import java.util.List;
public interface PickingService {
List<String> getOptions();
void picking(String id,String user);
PageResult getPickingList(PageResult pageResult);
void finish(Picking picking);
}

82
warehousing-system/project/wh-manage/src/main/java/com/wh/service/outstorehouse/PickingServiceImpl.java

@ -0,0 +1,82 @@
package com.wh.service.outstorehouse;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wh.api.Api;
import com.wh.mapper.outstorehouse.OutStorehouseMapper;
import com.wh.mapper.outstorehouse.PickingMapper;
import com.wh.pojo.OutStorehouse;
import com.wh.pojo.Picking;
import com.wh.vo.PageResult;
import org.apache.ibatis.annotations.Select;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@Service
public class PickingServiceImpl implements PickingService{
@Autowired
private PickingMapper pickingMapper;
@Autowired
private OutStorehouseMapper outStorehouseMapper;
@Override
public List<String> getOptions() {
QueryWrapper<Picking> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("status","待拣货");
List<Picking> pickingList = pickingMapper.selectList(queryWrapper);
List<String> outStorehouseIdList = new ArrayList<>();
for (Picking picking : pickingList){
outStorehouseIdList.add(picking.getPickingId());
}
return outStorehouseIdList;
}
@Override
public void picking(String id , String user) {
Picking picking = pickingMapper.selectById(id);
OutStorehouse outStorehouse = outStorehouseMapper.selectById(picking.getOutStorehouseId());
//更新拣货单
picking.setStatus("拣货中")
.setRecipientPerson(user)
.setRecipientTime(new Api().getTime());
pickingMapper.updateById(picking);
//更新出库单
outStorehouse.setStatus("拣货中");
outStorehouseMapper.updateById(outStorehouse);
}
@Override
public PageResult getPickingList(PageResult pageResult) {
Page<Picking> page = new Page<>(pageResult.getPageNum(),pageResult.getPageSize());
boolean flag = StringUtils.hasLength(pageResult.getQuery());
QueryWrapper<Picking> queryWrapper = new QueryWrapper<>();
queryWrapper.like(flag,"pickingId",pageResult.getQuery());
page = pickingMapper.selectPage(page,queryWrapper);
pageResult.setRows(page.getRecords()).setTotal((long) page.getRecords().size());
return pageResult;
}
@Override
public void finish(Picking picking) {
pickingMapper.updateById(picking);
OutStorehouse outStorehouse = outStorehouseMapper.selectById(picking.getOutStorehouseId());
outStorehouse.setStatus("已拣货");
outStorehouseMapper.updateById(outStorehouse);
}
}

8
warehousing-system/project/wh-manage/src/main/java/com/wh/service/stock/StockService.java

@ -0,0 +1,8 @@
package com.wh.service.stock;
import com.wh.vo.PageResult;
public interface StockService {
PageResult getStockList(PageResult pageResult);
}

29
warehousing-system/project/wh-manage/src/main/java/com/wh/service/stock/StockServiceImpl.java

@ -0,0 +1,29 @@
package com.wh.service.stock;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wh.mapper.stock.StockMapper;
import com.wh.pojo.Stock;
import com.wh.vo.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
@Service
public class StockServiceImpl implements StockService{
@Autowired
private StockMapper stockMapper;
@Override
public PageResult getStockList(PageResult pageResult) {
Page<Stock> page = new Page<>(pageResult.getPageNum(),pageResult.getPageSize());
boolean flag = StringUtils.hasLength(pageResult.getQuery());
QueryWrapper<Stock> queryWrapper = new QueryWrapper<>();
queryWrapper.like(flag,"product_name",pageResult.getQuery());
page = stockMapper.selectPage(page,queryWrapper);
pageResult.setTotal((long) page.getRecords().size()).setRows(page.getRecords());
return pageResult;
}
}

17
warehousing-system/project/wh-manage/src/main/java/com/wh/service/storehousemanage/RemoveService.java

@ -0,0 +1,17 @@
package com.wh.service.storehousemanage;
import com.wh.pojo.Remove;
import com.wh.vo.PageResult;
import java.util.Map;
public interface RemoveService {
Map<String, Object> getQuery(Remove remove);
void addRemove(Remove remove);
PageResult getRemoveList(PageResult pageResult);
void updataRemove(Remove remove);
}

119
warehousing-system/project/wh-manage/src/main/java/com/wh/service/storehousemanage/RemoveServiceImpl.java

@ -0,0 +1,119 @@
package com.wh.service.storehousemanage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wh.api.Api;
import com.wh.mapper.initial.LocationMapper;
import com.wh.mapper.initial.ProductMapper;
import com.wh.mapper.stock.StockMapper;
import com.wh.mapper.storehousemanage.RemoveMapper;
import com.wh.pojo.Location;
import com.wh.pojo.Product;
import com.wh.pojo.Remove;
import com.wh.pojo.Stock;
import com.wh.vo.PageResult;
import net.sf.jsqlparser.statement.select.Select;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.*;
@Service
public class RemoveServiceImpl implements RemoveService{
@Autowired
private RemoveMapper removeMapper;
@Autowired
private StockMapper stockMapper;
@Autowired
private LocationMapper locationMapper;
@Autowired
private ProductMapper productMapper;
//获取可用的库存
@Override
public Map<String, Object> getQuery(Remove remove) {
boolean barCodeFlag = StringUtils.hasLength(remove.getBarCode());
boolean fromLocationIdFlag = StringUtils.hasLength(remove.getFromLocationId());
//获取传入条件下的商品
QueryWrapper<Stock> stockQueryWrapper = new QueryWrapper<>();
stockQueryWrapper.eq(barCodeFlag,"bar_code",remove.getBarCode())
.eq(fromLocationIdFlag,"location_id",remove.getFromLocationId());
List<Stock> stocks = stockMapper.selectList(stockQueryWrapper);
Set<String> barCodeList = new HashSet<>();
Set<String> fromLocationIdList = new HashSet<>();
Integer availableQuantity = 0;
Map<String,Object> map = new HashMap<>();
for (Stock stock : stocks){
barCodeList.add(stock.getBarCode());
fromLocationIdList.add(stock.getLocationId());
}
if (stocks.size() == 1){
availableQuantity = stocks.get(0).getAvailableQuantity();
}
map.put("barCodeList",barCodeList);
map.put("fromLocationIdList",fromLocationIdList);
map.put("availableQuantity",availableQuantity);
return map;
}
@Override
public void addRemove(Remove remove) {
//设置商品名
Product product = productMapper.selectById(remove.getBarCode());
remove.setProductName(product.getName());
//设置创建时间
remove.setCreateTime(new Api().getTime());
//修改库存
Stock fromStock = stockMapper.selectById(remove.getFromLocationId());
fromStock.setLockedQuantity(fromStock.getLockedQuantity()+remove.getCount())
.setAvailableQuantity(fromStock.getAvailableQuantity() - remove.getCount());
stockMapper.updateById(fromStock);
//添加记录
removeMapper.insert(remove);
}
@Override
public PageResult getRemoveList(PageResult pageResult) {
Page<Remove> page = new Page<>(pageResult.getPageNum(),pageResult.getPageSize());
boolean flag = StringUtils.hasLength(pageResult.getQuery());
QueryWrapper<Remove> queryWrapper = new QueryWrapper<>();
queryWrapper.like(flag,"remove_id",pageResult.getQuery());
page = removeMapper.selectPage(page,queryWrapper);
pageResult.setTotal((long) page.getRecords().size()).setRows(page.getRecords());
return pageResult;
}
@Override
public void updataRemove(Remove remove) {
if (remove.getStatus().equals("已审核")) {
remove.setCheckTime(new Api().getTime());
}else if (remove.getStatus().equals("待审核")){
remove.setCheckTime("").setCheckPerson("");
}
removeMapper.updateById(remove);
}
}

19
warehousing-system/project/wh-manage/src/main/java/com/wh/service/storehousemanage/ShelvesService.java

@ -0,0 +1,19 @@
package com.wh.service.storehousemanage;
import com.wh.pojo.OnShelves;
import com.wh.vo.PageResult;
import com.wh.vo.QueryInfo;
import java.util.Map;
public interface ShelvesService {
Map<String, Object> getQuery(QueryInfo queryInfo);
void addShelves(OnShelves onShelves);
PageResult getShelves(PageResult pageResult);
void deleteShelves(String id);
void updataShelves(OnShelves onShelves) throws Exception;
}

295
warehousing-system/project/wh-manage/src/main/java/com/wh/service/storehousemanage/ShelvesServiceImpl.java

@ -0,0 +1,295 @@
package com.wh.service.storehousemanage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wh.api.Api;
import com.wh.mapper.initial.LocationMapper;
import com.wh.mapper.initial.ProductMapper;
import com.wh.mapper.instorehouse.PurchaseMapper;
import com.wh.mapper.instorehouse.ReceivingMapper;
import com.wh.mapper.stock.StockMapper;
import com.wh.mapper.instorehouse.PutInMapper;
import com.wh.mapper.storehousemanage.ShelvesMapper;
import com.wh.pojo.*;
import com.wh.vo.PageResult;
import com.wh.vo.QueryInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.*;
@Service
public class ShelvesServiceImpl implements ShelvesService{
@Autowired
private ShelvesMapper shelvesMapper;
@Autowired
private StockMapper stockMapper;
@Autowired
private LocationMapper locationMapper;
@Autowired
private ProductMapper productMapper;
@Autowired
private PutInMapper putInMapper;
@Autowired
private PurchaseMapper purchaseMapper;
@Autowired
private ReceivingMapper receivingMapper;
@Override
public Map<String, Object> getQuery(QueryInfo queryInfo) {
QueryWrapper<Stock> stockQueryWrapper = new QueryWrapper<>();
stockQueryWrapper.eq(StringUtils.hasLength(queryInfo.getBarCode()),"bar_code",queryInfo.getBarCode())
.eq(StringUtils.hasLength(queryInfo.getFromLocationId()),"Location_id",queryInfo.getFromLocationId())
.eq("status","待上架")
.select("bar_code","location_id","available_quantity");
List<Stock> stockList = stockMapper.selectList(stockQueryWrapper);
QueryWrapper<Location> locationQueryWrapper = new QueryWrapper<>();
locationQueryWrapper.eq("status","空闲").ne("type","入库区").or().eq("status",queryInfo.getBarCode());
List<Location> locationList = locationMapper.selectList(locationQueryWrapper);
Map<String,Object> map = new HashMap<>();
Set<String> barCodeSet = new HashSet<>();
Set<String> locationIdSet = new HashSet<>();
Set<String> fromLocationIdSet = new HashSet<>();
for (Stock stock : stockList){
barCodeSet.add(stock.getBarCode());
fromLocationIdSet.add(stock.getLocationId());
}
for (Location location : locationList){
locationIdSet.add(location.getLocationId());
}
locationIdSet.remove(queryInfo.getFromLocationId());
fromLocationIdSet.remove(queryInfo.getLocationId());
map.put("barCode",barCodeSet);
map.put("locationId",locationIdSet);
map.put("fromLocationId",fromLocationIdSet);
map.put("availableQuantity",0);
if (stockList.size()==1 && queryInfo.getCount()!=null && queryInfo.getCount()>stockList.get(0).getAvailableQuantity()){
return new HashMap<>();
}if (stockList.size()==1){
map.replace("availableQuantity",stockList.get(0).getAvailableQuantity());
return map;
}else{
return map;
}
}
@Override
public void addShelves(OnShelves onShelves) {
QueryWrapper<Location> locationQueryWrapper = new QueryWrapper<>();
String locationName = locationMapper.selectById(onShelves.getLocationId()).getName();
String fromLocationName = locationMapper.selectById(onShelves.getFromLocationId()).getName();
String productName = productMapper.selectById(onShelves.getBarCode()).getName();
String createTime = new Api().getTime();
onShelves.setFromLocationName(fromLocationName)
.setLocationName(locationName)
.setProductName(productName)
.setCreateTime(createTime)
.setStatus("待审核")
.setCreateTime(new Api().getTime());
shelvesMapper.insert(onShelves);
Stock stock = stockMapper.selectById(onShelves.getFromLocationId());
QueryWrapper<InStorehouse> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("location_id",onShelves.getFromLocationId());
InStorehouse inStorehouse = putInMapper.selectOne(queryWrapper);
inStorehouse.setStatus("进行中");
putInMapper.updateById(inStorehouse);
stock.setAvailableQuantity(
stock.getAvailableQuantity()-onShelves.getCount()
).setLockedQuantity(
stock.getLockedQuantity()+onShelves.getCount()
);
stockMapper.updateById(stock);
Location location = locationMapper.selectById(onShelves.getLocationId());
location.setStatus(onShelves.getBarCode());
locationMapper.updateById(location);
}
@Override
public PageResult getShelves(PageResult pageResult) {
Page<OnShelves> page = new Page<>(pageResult.getPageNum(),pageResult.getPageSize());
boolean flag = StringUtils.hasLength(pageResult.getQuery());
QueryWrapper<OnShelves> queryWrapper = new QueryWrapper<>();
queryWrapper.like(flag,"shelves_id",pageResult.getQuery());
page = shelvesMapper.selectPage(page,queryWrapper);
pageResult.setTotal((long) page.getRecords().size()).setRows(page.getRecords());
return pageResult;
}
@Override
public void deleteShelves(String id) {
OnShelves onShelves = shelvesMapper.selectById(id);
//判断库位是否空闲,修改状态
QueryWrapper<OnShelves> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("location_id",onShelves.getLocationId());
List<OnShelves> list = shelvesMapper.selectList(queryWrapper);
if (list.size() == 1){
Location location = locationMapper.selectById(onShelves.getLocationId());
location.setStatus("空闲");
locationMapper.updateById(location);
}
//更新源货位数据
Stock stock = stockMapper.selectById(onShelves.getFromLocationId());
stock.setAvailableQuantity(stock.getAvailableQuantity() + onShelves.getCount())
.setLockedQuantity(stock.getLockedQuantity() - onShelves.getCount());
stockMapper.updateById(stock);
shelvesMapper.deleteById(id);
}
@Override
public void updataShelves(OnShelves onShelves) throws Exception {
if (onShelves.getStatus().equals("已审核")){
check(onShelves);
onShelves.setCheckTime(new Api().getTime());
}else if (onShelves.getStatus().equals("待审核")){
cancelCheck(onShelves);
onShelves.setCheckTime("").setCheckPerson("");
}
shelvesMapper.updateById(onShelves);
Stock stock = stockMapper.selectById(onShelves.getFromLocationId());
if (stock == null) return;
QueryWrapper<OnShelves> onShelvesQueryWrapper = new QueryWrapper<>();
onShelvesQueryWrapper.eq("from_location_id",onShelves.getFromLocationId()).eq("status","已审核");
List<OnShelves> onShelvesList = shelvesMapper.selectList(onShelvesQueryWrapper);
Integer lockedQuantity = 0;
for (OnShelves onShelves1 : onShelvesList){
lockedQuantity += onShelves1.getCount();
}
if (stock.getAvailableQuantity()==0 && stock.getLockedQuantity() == lockedQuantity){
deleteStock(onShelves.getFromLocationId());
}
}
public void deleteStock(String locationId){
Stock stock = stockMapper.selectById(locationId);
QueryWrapper<InStorehouse> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("location_id",locationId);
InStorehouse inStorehouse = putInMapper.selectOne(queryWrapper);
if (stock.getLockedQuantity() == 0){
inStorehouse.setStatus("已审核");
}
stockMapper.deleteById(locationId);
Location location = locationMapper.selectById(locationId);
location.setStatus("空闲");
locationMapper.updateById(location);
}
public void check(OnShelves onShelves){
Stock stock = stockMapper.selectById(onShelves.getFromLocationId());
QueryWrapper<Stock> stockQueryWrapper = new QueryWrapper<>();
stockQueryWrapper.eq("location_id",onShelves.getLocationId());
Integer num = stockMapper.selectCount(stockQueryWrapper);
System.out.println(num);
Stock newStock;
if (num == 0) {
newStock = new Stock();
newStock.setAvailableQuantity(onShelves.getCount())
.setTotalQuantity(onShelves.getCount())
.setBarCode(onShelves.getBarCode())
.setLockedQuantity(0)
.setInStorehouseId(stock.getInStorehouseId())
.setLocationId(onShelves.getLocationId())
.setLocationName(onShelves.getLocationName())
.setProductName(onShelves.getProductName())
.setStatus("已上架");
stockMapper.insert(newStock);
Location location = locationMapper.selectById(onShelves.getLocationId());
location.setStatus(onShelves.getBarCode());
locationMapper.updateById(location);
}else {
newStock = stockMapper.selectById(onShelves.getLocationId());
newStock.setTotalQuantity(onShelves.getCount()+newStock.getAvailableQuantity())
.setAvailableQuantity(onShelves.getCount()+newStock.getAvailableQuantity());
stockMapper.updateById(newStock);
}
}
public void cancelCheck(OnShelves onShelves) throws Exception {
//获取商品库存
Stock stock2 = stockMapper.selectById(onShelves.getLocationId());
//可用数量
Integer availableQuantity = stock2.getAvailableQuantity()-onShelves.getCount();
if (stock2.getAvailableQuantity()<onShelves.getCount()) throw new Exception("数量不足") ;
QueryWrapper<Stock> stockQueryWrapper = new QueryWrapper<>();
stockQueryWrapper.eq("location_id",onShelves.getFromLocationId());
Stock stock = new Stock();
Integer c = stockMapper.selectCount(stockQueryWrapper);
if (stockMapper.selectCount(stockQueryWrapper) == 0) {
InStorehouse inStorehouse = putInMapper.selectById(stock2.getInStorehouseId());
Receiving receiving = receivingMapper.selectById(inStorehouse.getReceivingId());
Purchase purchase = purchaseMapper.selectById(receiving.getPurchaseId());
stock.setInStorehouseId(stock2.getInStorehouseId())
.setLocationId(onShelves.getFromLocationId())
.setLocationName(onShelves.getFromLocationName())
.setBarCode(stock2.getBarCode())
.setProductName(stock2.getProductName())
.setTotalQuantity(purchase.getCount())
.setAvailableQuantity(0)
.setLockedQuantity(purchase.getCount())
.setStatus("待上架");
stockMapper.insert(stock);
}
if ( availableQuantity == 0){
stockMapper.deleteById(onShelves.getLocationId());
Location location = locationMapper.selectById(onShelves.getLocationId());
location.setStatus("空闲");
locationMapper.updateById(location);
}else {
stock2.setTotalQuantity(stock2.getTotalQuantity()-stock2.getAvailableQuantity()+availableQuantity)
.setAvailableQuantity(availableQuantity);
stockMapper.updateById(stock2);
}
}
}

21
warehousing-system/project/wh-manage/src/main/resources/application.yml

@ -0,0 +1,21 @@
server:
port: 9050
servlet:
context-path: /
spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/warehouse2?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&autoReconnect=true&allowMultiQueries=true
username: root
password: root
#mybatis-plush配置
mybatis-plus:
type-aliases-package: com.wh.pojo
mapper-locations: classpath:/mappers/*.xml
configuration:
map-underscore-to-camel-case: true
logging:
level:
com.jt.mapper: debug

7
warehousing-system/project/wh-manage/src/main/resources/mappers/UserMapper.xml

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.wh.mapper.UserMapper">
</mapper>

11
warehousing-system/project/wh-manage/src/test/java/Test01.java

@ -0,0 +1,11 @@
import com.wh.mapper.initial.LocationMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
public class Test01 {
}

3
warehousing-system/project_web/.browserslistrc

@ -0,0 +1,3 @@
> 1%
last 2 versions
not dead

5
warehousing-system/project_web/.editorconfig

@ -0,0 +1,5 @@
[*.{js,jsx,ts,tsx,vue}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true

26
warehousing-system/project_web/.eslintrc.js

@ -0,0 +1,26 @@
module.exports = {
root: true,
env: {
node: true
},
extends: [
'plugin:vue/essential',
'@vue/standard'
],
parserOptions: {
parser: 'babel-eslint'
},
rules: {
'no-console': 'off',
'no-debugger': 'off'
},
extends: [
'plugin:vue/essential',
'@vue/standard'
]
}

23
warehousing-system/project_web/.gitignore

@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

24
warehousing-system/project_web/README.md

@ -0,0 +1,24 @@
# project_demo
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

14
warehousing-system/project_web/babel.config.js

@ -0,0 +1,14 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
],
plugins: [
[
'component',
{
libraryName: 'element-ui',
styleLibraryName: 'theme-chalk'
}
]
]
}

12742
warehousing-system/project_web/package-lock.json

File diff suppressed because it is too large

38
warehousing-system/project_web/package.json

@ -0,0 +1,38 @@
{
"name": "project_demo",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^0.21.1",
"core-js": "^3.6.5",
"echarts": "^5.1.1",
"element-ui": "^2.4.5",
"less-loader": "^5.0.0",
"vue": "^2.6.11",
"vue-quill-editor": "^3.0.6",
"vue-router": "^3.2.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/eslint-config-standard": "^5.1.2",
"babel-eslint": "^10.1.0",
"babel-plugin-component": "^1.1.1",
"eslint": "^6.7.2",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^6.2.2",
"less": "^4.1.1",
"vue-cli-plugin-element": "^1.0.1",
"vue-template-compiler": "^2.6.11"
}
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save