diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/controller/GroupController.java b/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/controller/GroupController.java index eb1e675..276bbee 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/controller/GroupController.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/controller/GroupController.java @@ -3,6 +3,7 @@ package org.nl.wms.sch.group.controller; import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -12,6 +13,8 @@ import org.nl.common.exception.BadRequestException; import org.nl.common.logging.annotation.Log; import org.nl.common.utils.IdUtil; import org.nl.common.utils.SecurityUtils; +import org.nl.wms.basedata.master.vehicle.service.IStoragevehicleinfoService; +import org.nl.wms.basedata.master.vehicle.service.dao.Storagevehicleinfo; import org.nl.wms.sch.group.service.IMdPbGroupplateService; import org.nl.wms.sch.group.service.dao.GroupPlate; import org.nl.wms.sch.group.service.enums.GroupStatus; @@ -42,6 +45,8 @@ public class GroupController { @Autowired private final IMdPbGroupplateService iMdPbGroupplateService; + @Autowired + private final IStoragevehicleinfoService iStoragevehicleinfoService; @GetMapping @@ -54,17 +59,12 @@ public class GroupController { @PostMapping @Log("新增组盘组盘") public ResponseEntity create(@RequestBody JSONObject group) { - Assert.noNullElements(new Object[]{group,group.get("material_id"),group.get("storagevehicle_code"),group.get("qty")},"请求参数不能为空"); + Assert.noNullElements(new Object[]{group,group.get("material_code"),group.get("storagevehicle_code"),group.get("qty")},"请求参数不能为空"); GroupPlate groupPlate = group.toJavaObject(GroupPlate.class); - String storagevehicleCode = groupPlate.getStoragevehicle_code(); - { -// iMdPbStoragevehicleinfoService.getByCode(storagevehicleCode); -// int has = iMdPbGroupplateService.count(new LambdaUpdateWrapper() -// .eq(GroupPlate::getStoragevehicle_code, groupPlate.getStoragevehicle_code()) -// .lt(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))); -// if (has>0){ -// throw new BadRequestException("当前载具组盘信息已存在"); -// } + Storagevehicleinfo one = iStoragevehicleinfoService.getOne(new LambdaQueryWrapper() + .eq(Storagevehicleinfo::getStoragevehicle_code, groupPlate.getStoragevehicle_code())); + if (one != null){ + throw new BadRequestException("当前载具组盘信息已存在"); } groupPlate.setGroup_id(IdUtil.getStringId()); groupPlate.setCreate_id(SecurityUtils.getCurrentUserId());