Commit 2a113c61f48ea3baba306690013c6a728c3b7244

Authored by 肖超群
1 parent ded8cb8d

修改物料新增接口

huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/agvcall/controller/AgvCallController.java 0 → 100644
  1 +package org.jeecg.modules.wms.api.agvcall.controller;
  2 +
  3 +import org.jeecg.modules.wms.framework.controller.HuahengBaseController;
  4 +import org.springframework.web.bind.annotation.RequestMapping;
  5 +import org.springframework.web.bind.annotation.RestController;
  6 +
  7 +import io.swagger.annotations.Api;
  8 +
  9 +/**
  10 + * @author 游杰
  11 + */
  12 +@RestController
  13 +@RequestMapping("/api/agvcall")
  14 +@Api(tags = "AGV接口")
  15 +public class AgvCallController extends HuahengBaseController {
  16 +
  17 +}
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/erp/entity/ErpMaterial.java
... ... @@ -24,4 +24,6 @@ public class ErpMaterial {
24 24 /** 类别 */
25 25 @ApiModelProperty(value = "类别")
26 26 private String type;
  27 +
  28 + private String warehouseCode;
27 29 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/erp/service/impl/ErpServiceImpl.java
... ... @@ -391,9 +391,22 @@ public class ErpServiceImpl implements IErpService {
391 391 }
392 392 Material material = new Material();
393 393 BeanUtils.copyProperties(erpMaterial, material);
394   - boolean success = materialService.save(material);
395   - if (!success) {
396   - throw new JeecgBootException("增加物料失败, 保存时报错");
  394 + String materialCode = material.getCode();
  395 + if (StringUtils.isEmpty(materialCode)) {
  396 + return Result.error("增加物料失败, 物料编码不能为空!!");
  397 + }
  398 + Material material1 = materialService.isMaterialExsit(materialCode);
  399 + if (material1 != null) {
  400 + material.setId(material1.getId());
  401 + boolean success = materialService.updateById(material);
  402 + if (!success) {
  403 + throw new JeecgBootException("增加物料失败, 更新时报错");
  404 + }
  405 + } else {
  406 + boolean success = materialService.save(material);
  407 + if (!success) {
  408 + throw new JeecgBootException("增加物料失败, 保存时报错");
  409 + }
397 410 }
398 411 return Result.ok("增加物料成功");
399 412 }
... ...