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 | 1 | package org.jeecg.modules.wms.api.erp.controller; |
2 | 2 | |
3 | -import java.util.Map; | |
4 | - | |
5 | 3 | import javax.annotation.Resource; |
6 | 4 | import javax.servlet.http.HttpServletRequest; |
7 | 5 | |
8 | 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 | 8 | import org.jeecg.modules.wms.api.erp.service.IErpService; |
13 | -import org.jeecg.modules.wms.config.material.entity.Material; | |
14 | 9 | import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger; |
15 | 10 | import org.jeecg.modules.wms.framework.controller.HuahengBaseController; |
16 | 11 | import org.jeecg.utils.HuahengJwtUtil; |
... | ... | @@ -43,9 +38,9 @@ public class ErpController extends HuahengBaseController { |
43 | 38 | @ResponseBody |
44 | 39 | @ApiOperation("取消入库单") |
45 | 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 | 44 | return erpService.cancelReceipt(referCode, warehouseCode); |
50 | 45 | } |
51 | 46 | |
... | ... | @@ -61,9 +56,9 @@ public class ErpController extends HuahengBaseController { |
61 | 56 | @ResponseBody |
62 | 57 | @ApiOperation("取消出库单") |
63 | 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 | 62 | return erpService.cancelShipment(referCode, warehouseCode); |
68 | 63 | } |
69 | 64 | |
... | ... | @@ -80,7 +75,8 @@ public class ErpController extends HuahengBaseController { |
80 | 75 | @ResponseBody |
81 | 76 | @ApiOperation("增加物料") |
82 | 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 | 3 | import io.swagger.annotations.ApiModelProperty; |
4 | 4 | import lombok.Data; |
5 | 5 | |
6 | +/** | |
7 | + * @author 游杰 | |
8 | + */ | |
6 | 9 | @Data |
7 | 10 | public class ErpMaterial { |
8 | 11 | |
12 | + /** 物料编码 */ | |
9 | 13 | @ApiModelProperty(value = "物料编码", required = true) |
10 | 14 | private String code; |
15 | + /** 物料名称 */ | |
11 | 16 | @ApiModelProperty(value = "物料名称", required = true) |
12 | 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 | 1 | package org.jeecg.modules.wms.api.erp.service; |
2 | 2 | |
3 | 3 | import org.jeecg.common.api.vo.Result; |
4 | +import org.jeecg.modules.wms.api.erp.entity.ErpMaterial; | |
4 | 5 | import org.jeecg.modules.wms.api.erp.entity.ErpReceipt; |
5 | 6 | import org.jeecg.modules.wms.api.erp.entity.ErpShipment; |
6 | 7 | import org.jeecg.modules.wms.api.erp.entity.InventoryQueryParam; |
7 | -import org.jeecg.modules.wms.config.material.entity.Material; | |
8 | 8 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; |
9 | 9 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader; |
10 | 10 | |
... | ... | @@ -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 | 33 | import org.jeecg.utils.OkHttpUtils; |
34 | 34 | import org.jeecg.utils.StringUtils; |
35 | 35 | import org.jeecg.utils.constant.QuantityConstant; |
36 | +import org.springframework.beans.BeanUtils; | |
36 | 37 | import org.springframework.stereotype.Service; |
37 | 38 | import org.springframework.transaction.annotation.Transactional; |
38 | 39 | |
... | ... | @@ -383,26 +384,15 @@ public class ErpServiceImpl implements IErpService { |
383 | 384 | |
384 | 385 | @Override |
385 | 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 | 389 | return Result.error("增加物料失败, 物料编码不能为空!!"); |
389 | 390 | } |
390 | - if (StringUtils.isEmpty(material.getName())) { | |
391 | + if (StringUtils.isEmpty(erpMaterial.getName())) { | |
391 | 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 | 396 | boolean success = materialService.save(material); |
407 | 397 | if (!success) { |
408 | 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 | 56 | @GetMapping(value = "/list") |
57 | 57 | public Result<IPage<Material>> queryPageList(Material material, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
58 | 58 | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { |
59 | - String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); | |
60 | - material.setWarehouseCode(warehouseCode); | |
61 | 59 | QueryWrapper<Material> queryWrapper = QueryGenerator.initQueryWrapper(material, req.getParameterMap()); |
62 | 60 | Page<Material> page = new Page<Material>(pageNo, pageSize); |
63 | 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 | 25 | import springfox.documentation.spring.web.plugins.Docket; |
26 | 26 | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
27 | 27 | |
28 | +/** | |
29 | + * @author 游杰 | |
30 | + */ | |
28 | 31 | @Configuration |
29 | 32 | @EnableSwagger2 |
30 | 33 | @EnableKnife4j |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/utils/interceptor/HuahengBatisInterceptor.java
... | ... | @@ -45,12 +45,10 @@ public class HuahengBatisInterceptor implements Interceptor { |
45 | 45 | Object local_createBy = field.get(parameter); |
46 | 46 | field.setAccessible(false); |
47 | 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 | // 注入创建时间 |
... | ... |