Commit 456522edf8beb66447cd9c1a6bbd7913f9aeb28b
1 parent
daf7ae48
1. 更新ERP接口
2. swagger适配
Showing
8 changed files
with
58 additions
and
40 deletions
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/erp/controller/ErpController.java
1 | package org.jeecg.modules.wms.api.erp.controller; | 1 | package org.jeecg.modules.wms.api.erp.controller; |
2 | 2 | ||
3 | -import java.util.Map; | ||
4 | - | ||
5 | import javax.annotation.Resource; | 3 | import javax.annotation.Resource; |
6 | import javax.servlet.http.HttpServletRequest; | 4 | import javax.servlet.http.HttpServletRequest; |
7 | 5 | ||
8 | import org.jeecg.common.api.vo.Result; | 6 | import org.jeecg.common.api.vo.Result; |
9 | -import org.jeecg.modules.wms.api.erp.entity.ErpReceipt; | ||
10 | -import org.jeecg.modules.wms.api.erp.entity.ErpShipment; | ||
11 | -import org.jeecg.modules.wms.api.erp.entity.InventoryQueryParam; | 7 | +import org.jeecg.modules.wms.api.erp.entity.*; |
12 | import org.jeecg.modules.wms.api.erp.service.IErpService; | 8 | import org.jeecg.modules.wms.api.erp.service.IErpService; |
13 | -import org.jeecg.modules.wms.config.material.entity.Material; | ||
14 | import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger; | 9 | import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger; |
15 | import org.jeecg.modules.wms.framework.controller.HuahengBaseController; | 10 | import org.jeecg.modules.wms.framework.controller.HuahengBaseController; |
16 | import org.jeecg.utils.HuahengJwtUtil; | 11 | import org.jeecg.utils.HuahengJwtUtil; |
@@ -43,9 +38,9 @@ public class ErpController extends HuahengBaseController { | @@ -43,9 +38,9 @@ public class ErpController extends HuahengBaseController { | ||
43 | @ResponseBody | 38 | @ResponseBody |
44 | @ApiOperation("取消入库单") | 39 | @ApiOperation("取消入库单") |
45 | @ApiLogger(apiName = "取消入库单", from = "ERP") | 40 | @ApiLogger(apiName = "取消入库单", from = "ERP") |
46 | - public Result cancelReceipt(@RequestBody Map<String, String> param, HttpServletRequest req) { | ||
47 | - String referCode = param.get("referCode"); | ||
48 | - String warehouseCode = param.get("warehouseCode"); | 41 | + public Result cancelReceipt(@RequestBody ErpCancel erpCancel, HttpServletRequest req) { |
42 | + String referCode = erpCancel.getReferCode(); | ||
43 | + String warehouseCode = erpCancel.getWarehouseCode(); | ||
49 | return erpService.cancelReceipt(referCode, warehouseCode); | 44 | return erpService.cancelReceipt(referCode, warehouseCode); |
50 | } | 45 | } |
51 | 46 | ||
@@ -61,9 +56,9 @@ public class ErpController extends HuahengBaseController { | @@ -61,9 +56,9 @@ public class ErpController extends HuahengBaseController { | ||
61 | @ResponseBody | 56 | @ResponseBody |
62 | @ApiOperation("取消出库单") | 57 | @ApiOperation("取消出库单") |
63 | @ApiLogger(apiName = "取消出库单", from = "ERP") | 58 | @ApiLogger(apiName = "取消出库单", from = "ERP") |
64 | - public Result cancelShipment(@RequestBody Map<String, String> param, HttpServletRequest req) { | ||
65 | - String referCode = param.get("referCode"); | ||
66 | - String warehouseCode = param.get("warehouseCode"); | 59 | + public Result cancelShipment(@RequestBody ErpCancel erpCancel, HttpServletRequest req) { |
60 | + String referCode = erpCancel.getReferCode(); | ||
61 | + String warehouseCode = erpCancel.getWarehouseCode(); | ||
67 | return erpService.cancelShipment(referCode, warehouseCode); | 62 | return erpService.cancelShipment(referCode, warehouseCode); |
68 | } | 63 | } |
69 | 64 | ||
@@ -80,7 +75,8 @@ public class ErpController extends HuahengBaseController { | @@ -80,7 +75,8 @@ public class ErpController extends HuahengBaseController { | ||
80 | @ResponseBody | 75 | @ResponseBody |
81 | @ApiOperation("增加物料") | 76 | @ApiOperation("增加物料") |
82 | @ApiLogger(apiName = "增加物料", from = "ERP") | 77 | @ApiLogger(apiName = "增加物料", from = "ERP") |
83 | - public Result addMaterial(@RequestBody Material material) { | ||
84 | - return erpService.addMaterial(material); | 78 | + public Result addMaterial(@RequestBody ErpMaterial erpMaterial) { |
79 | + return erpService.addMaterial(erpMaterial); | ||
85 | } | 80 | } |
81 | + | ||
86 | } | 82 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/erp/entity/ErpCancel.java
0 → 100644
1 | +package org.jeecg.modules.wms.api.erp.entity; | ||
2 | + | ||
3 | +import io.swagger.annotations.ApiModelProperty; | ||
4 | +import lombok.Data; | ||
5 | + | ||
6 | +/** | ||
7 | + * @author 游杰 | ||
8 | + */ | ||
9 | +@Data | ||
10 | +public class ErpCancel { | ||
11 | + | ||
12 | + /** 上游系统单号 */ | ||
13 | + @ApiModelProperty(value = "上游系统单号", required = true) | ||
14 | + private String referCode; | ||
15 | + /** 仓库编码 */ | ||
16 | + @ApiModelProperty(value = "仓库编码", required = true) | ||
17 | + private String warehouseCode; | ||
18 | + | ||
19 | +} |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/erp/entity/ErpMaterial.java
@@ -3,11 +3,25 @@ package org.jeecg.modules.wms.api.erp.entity; | @@ -3,11 +3,25 @@ package org.jeecg.modules.wms.api.erp.entity; | ||
3 | import io.swagger.annotations.ApiModelProperty; | 3 | import io.swagger.annotations.ApiModelProperty; |
4 | import lombok.Data; | 4 | import lombok.Data; |
5 | 5 | ||
6 | +/** | ||
7 | + * @author 游杰 | ||
8 | + */ | ||
6 | @Data | 9 | @Data |
7 | public class ErpMaterial { | 10 | public class ErpMaterial { |
8 | 11 | ||
12 | + /** 物料编码 */ | ||
9 | @ApiModelProperty(value = "物料编码", required = true) | 13 | @ApiModelProperty(value = "物料编码", required = true) |
10 | private String code; | 14 | private String code; |
15 | + /** 物料名称 */ | ||
11 | @ApiModelProperty(value = "物料名称", required = true) | 16 | @ApiModelProperty(value = "物料名称", required = true) |
12 | private String name; | 17 | private String name; |
18 | + /** 规格 */ | ||
19 | + @ApiModelProperty(value = "规格") | ||
20 | + private String spec; | ||
21 | + /** 单位 */ | ||
22 | + @ApiModelProperty(value = "单位") | ||
23 | + private String unit; | ||
24 | + /** 类别 */ | ||
25 | + @ApiModelProperty(value = "类别") | ||
26 | + private String type; | ||
13 | } | 27 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/erp/service/IErpService.java
1 | package org.jeecg.modules.wms.api.erp.service; | 1 | package org.jeecg.modules.wms.api.erp.service; |
2 | 2 | ||
3 | import org.jeecg.common.api.vo.Result; | 3 | import org.jeecg.common.api.vo.Result; |
4 | +import org.jeecg.modules.wms.api.erp.entity.ErpMaterial; | ||
4 | import org.jeecg.modules.wms.api.erp.entity.ErpReceipt; | 5 | import org.jeecg.modules.wms.api.erp.entity.ErpReceipt; |
5 | import org.jeecg.modules.wms.api.erp.entity.ErpShipment; | 6 | import org.jeecg.modules.wms.api.erp.entity.ErpShipment; |
6 | import org.jeecg.modules.wms.api.erp.entity.InventoryQueryParam; | 7 | import org.jeecg.modules.wms.api.erp.entity.InventoryQueryParam; |
7 | -import org.jeecg.modules.wms.config.material.entity.Material; | ||
8 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; | 8 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; |
9 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader; | 9 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader; |
10 | 10 | ||
@@ -38,7 +38,7 @@ public interface IErpService { | @@ -38,7 +38,7 @@ public interface IErpService { | ||
38 | /** | 38 | /** |
39 | * 增加物料信息 | 39 | * 增加物料信息 |
40 | */ | 40 | */ |
41 | - public Result addMaterial(Material material); | 41 | + public Result addMaterial(ErpMaterial erpMaterial); |
42 | 42 | ||
43 | /** | 43 | /** |
44 | * 回传入库单 | 44 | * 回传入库单 |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/erp/service/impl/ErpServiceImpl.java
@@ -33,6 +33,7 @@ import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentHeaderServ | @@ -33,6 +33,7 @@ import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentHeaderServ | ||
33 | import org.jeecg.utils.OkHttpUtils; | 33 | import org.jeecg.utils.OkHttpUtils; |
34 | import org.jeecg.utils.StringUtils; | 34 | import org.jeecg.utils.StringUtils; |
35 | import org.jeecg.utils.constant.QuantityConstant; | 35 | import org.jeecg.utils.constant.QuantityConstant; |
36 | +import org.springframework.beans.BeanUtils; | ||
36 | import org.springframework.stereotype.Service; | 37 | import org.springframework.stereotype.Service; |
37 | import org.springframework.transaction.annotation.Transactional; | 38 | import org.springframework.transaction.annotation.Transactional; |
38 | 39 | ||
@@ -383,26 +384,15 @@ public class ErpServiceImpl implements IErpService { | @@ -383,26 +384,15 @@ public class ErpServiceImpl implements IErpService { | ||
383 | 384 | ||
384 | @Override | 385 | @Override |
385 | @Transactional(rollbackFor = Exception.class) | 386 | @Transactional(rollbackFor = Exception.class) |
386 | - public Result addMaterial(Material material) { | ||
387 | - if (StringUtils.isEmpty(material.getCode())) { | 387 | + public Result addMaterial(ErpMaterial erpMaterial) { |
388 | + if (StringUtils.isEmpty(erpMaterial.getCode())) { | ||
388 | return Result.error("增加物料失败, 物料编码不能为空!!"); | 389 | return Result.error("增加物料失败, 物料编码不能为空!!"); |
389 | } | 390 | } |
390 | - if (StringUtils.isEmpty(material.getName())) { | 391 | + if (StringUtils.isEmpty(erpMaterial.getName())) { |
391 | return Result.error("增加物料失败, 物料名称不能为空!!"); | 392 | return Result.error("增加物料失败, 物料名称不能为空!!"); |
392 | } | 393 | } |
393 | - if (StringUtils.isEmpty(material.getWarehouseCode())) { | ||
394 | - return Result.error("增加物料失败, 仓库编码不能为空!!"); | ||
395 | - } | ||
396 | - | ||
397 | - Warehouse warehouse = warehouseService.getWarehouseByCode(material.getWarehouseCode()); | ||
398 | - if (warehouse == null) { | ||
399 | - return Result.error("增加物料失败, 仓库为空!!"); | ||
400 | - } | ||
401 | - material.setEnable(QuantityConstant.STATUS_ENABLE); | ||
402 | - Material material1 = materialService.getMaterialByCode(material.getCode()); | ||
403 | - if (material1 != null) { | ||
404 | - return Result.error("增加物料失败, 物料已经存在!!"); | ||
405 | - } | 394 | + Material material = new Material(); |
395 | + BeanUtils.copyProperties(erpMaterial, material); | ||
406 | boolean success = materialService.save(material); | 396 | boolean success = materialService.save(material); |
407 | if (!success) { | 397 | if (!success) { |
408 | throw new ServiceException("增加物料失败, 保存时报错"); | 398 | throw new ServiceException("增加物料失败, 保存时报错"); |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/material/controller/MaterialController.java
@@ -56,8 +56,6 @@ public class MaterialController extends JeecgController<Material, IMaterialServi | @@ -56,8 +56,6 @@ public class MaterialController extends JeecgController<Material, IMaterialServi | ||
56 | @GetMapping(value = "/list") | 56 | @GetMapping(value = "/list") |
57 | public Result<IPage<Material>> queryPageList(Material material, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, | 57 | public Result<IPage<Material>> queryPageList(Material material, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
58 | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { | 58 | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { |
59 | - String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); | ||
60 | - material.setWarehouseCode(warehouseCode); | ||
61 | QueryWrapper<Material> queryWrapper = QueryGenerator.initQueryWrapper(material, req.getParameterMap()); | 59 | QueryWrapper<Material> queryWrapper = QueryGenerator.initQueryWrapper(material, req.getParameterMap()); |
62 | Page<Material> page = new Page<Material>(pageNo, pageSize); | 60 | Page<Material> page = new Page<Material>(pageNo, pageSize); |
63 | IPage<Material> pageList = materialService.page(page, queryWrapper); | 61 | IPage<Material> pageList = materialService.page(page, queryWrapper); |
huaheng-wms-core/src/main/java/org/jeecg/utils/Swagger3Config.java
@@ -25,6 +25,9 @@ import springfox.documentation.spi.service.contexts.SecurityContext; | @@ -25,6 +25,9 @@ import springfox.documentation.spi.service.contexts.SecurityContext; | ||
25 | import springfox.documentation.spring.web.plugins.Docket; | 25 | import springfox.documentation.spring.web.plugins.Docket; |
26 | import springfox.documentation.swagger2.annotations.EnableSwagger2; | 26 | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
27 | 27 | ||
28 | +/** | ||
29 | + * @author 游杰 | ||
30 | + */ | ||
28 | @Configuration | 31 | @Configuration |
29 | @EnableSwagger2 | 32 | @EnableSwagger2 |
30 | @EnableKnife4j | 33 | @EnableKnife4j |
huaheng-wms-core/src/main/java/org/jeecg/utils/interceptor/HuahengBatisInterceptor.java
@@ -45,12 +45,10 @@ public class HuahengBatisInterceptor implements Interceptor { | @@ -45,12 +45,10 @@ public class HuahengBatisInterceptor implements Interceptor { | ||
45 | Object local_createBy = field.get(parameter); | 45 | Object local_createBy = field.get(parameter); |
46 | field.setAccessible(false); | 46 | field.setAccessible(false); |
47 | if (local_createBy == null || local_createBy.equals("")) { | 47 | if (local_createBy == null || local_createBy.equals("")) { |
48 | - if (sysUser != null) { | ||
49 | - // 登录人账号 | ||
50 | - field.setAccessible(true); | ||
51 | - field.set(parameter, sysUser.getRealname()); | ||
52 | - field.setAccessible(false); | ||
53 | - } | 48 | + // 登录人账号 |
49 | + field.setAccessible(true); | ||
50 | + field.set(parameter, HuahengJwtUtil.getCurrentOperator()); | ||
51 | + field.setAccessible(false); | ||
54 | } | 52 | } |
55 | } | 53 | } |
56 | // 注入创建时间 | 54 | // 注入创建时间 |