mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-13 13:22:07 +08:00
余料库逻辑修改,柜体删除修改
This commit is contained in:
+23
@@ -0,0 +1,23 @@
|
||||
package com.cf.imes.module.manage.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DeletedCodeEnum {
|
||||
|
||||
DELETED(1, "删除"),
|
||||
NOT_DELETED(0, "未删除");
|
||||
|
||||
private final Integer status;
|
||||
private String description;
|
||||
|
||||
public boolean equals(Integer status) {
|
||||
return this.status .equals(status) ;
|
||||
}
|
||||
|
||||
public boolean equals(DeletedCodeEnum DeletedCodeEnum) {
|
||||
return DeletedCodeEnum != null && DeletedCodeEnum.status .equals(this.getStatus()) ;
|
||||
}
|
||||
}
|
||||
+4
-3
@@ -7,9 +7,10 @@ import lombok.Getter;
|
||||
@AllArgsConstructor
|
||||
public enum RemainPlateUseTypeEnum {
|
||||
|
||||
TYPE_ONE(0, "核销"),
|
||||
TYPE_TWO(1, "排单"),
|
||||
TYPE_THREE(2, "补板");
|
||||
TYPE_ZERO(0, ""),
|
||||
TYPE_ONE(1, "核销"),
|
||||
TYPE_TWO(2, "排单"),
|
||||
TYPE_THREE(3, "补板");
|
||||
|
||||
private final Integer status;
|
||||
private String description;
|
||||
|
||||
+3
-3
@@ -43,7 +43,7 @@ public class RemainPlateController {
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建生产单余料板表(单个)")
|
||||
@PreAuthorize("@ss.hasPermission('placeorder:remain')")
|
||||
public CommonResult<Long> createRemainPlate(@Valid @RequestBody RemainPlateSaveReqVO createReqVO) {
|
||||
public CommonResult<Boolean> createRemainPlate(@Valid @RequestBody RemainPlateSaveReqVO createReqVO) {
|
||||
return success(remainPlateService.createRemainPlate(createReqVO));
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class RemainPlateController {
|
||||
@Operation(summary = "余料板批量核销")
|
||||
@PreAuthorize("@ss.hasPermission('placeorder:remain')")
|
||||
public CommonResult<Boolean> updateRemainPlate(@RequestBody RemainPlateUptReqVO updateReqVO) {
|
||||
remainPlateService.updateRemainPlateStatus(updateReqVO.getIds(),
|
||||
remainPlateService.updateRemainPlateStatus(updateReqVO.getId(),
|
||||
updateReqVO.getStatus(),
|
||||
updateReqVO.getUseType(),
|
||||
updateReqVO.getPlanId());
|
||||
@@ -77,7 +77,7 @@ public class RemainPlateController {
|
||||
@Operation(summary = "余料板批量释放")
|
||||
@PreAuthorize("@ss.hasPermission('manage:remain-plate:update')")
|
||||
public CommonResult<Boolean> revertRemainPlate(@RequestBody RemainPlateUptReqVO updateReqVO) {
|
||||
remainPlateService.revertRemainPlateStatus(updateReqVO.getIds(),updateReqVO.getStatus());
|
||||
remainPlateService.revertRemainPlateStatus(updateReqVO.getId(),updateReqVO.getStatus());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -9,13 +9,13 @@ import java.util.Set;
|
||||
@Data
|
||||
public class RemainPlateUptReqVO {
|
||||
|
||||
@Schema(description = "余料板集", requiredMode = Schema.RequiredMode.REQUIRED, example = "16470")
|
||||
private Set<Long> ids;
|
||||
@Schema(description = "余料板集", example = "16470")
|
||||
private Set<Long> id;
|
||||
|
||||
@Schema(description = "余料板状态,0未使用,1使用中", example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "使用类型,0核销,1排单,2补板", example = "0")
|
||||
@Schema(description = "使用类型,1核销,2排单,3补板", example = "0")
|
||||
private Integer useType;
|
||||
|
||||
@Schema(description = "排单 ID", example = "6628")
|
||||
|
||||
+3
@@ -116,6 +116,9 @@ public class OrderPlateDO extends BaseDO {
|
||||
// 是否孤形对角
|
||||
private Boolean isArcAcross;
|
||||
|
||||
// 是否排孔
|
||||
private Boolean isRowHole;
|
||||
|
||||
// 模块类型 ID
|
||||
private Long moduleTypeId;
|
||||
|
||||
|
||||
+42
-4
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.manage.dal.mysql.remainplaten;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
@@ -8,6 +9,7 @@ import com.cf.imes.module.manage.controller.admin.plate.vo.remain.RemainPlatePag
|
||||
import com.cf.imes.module.manage.dal.dataobject.remainplaten.RemainPlateDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -20,20 +22,21 @@ public interface RemainPlateMapper extends BaseMapperX<RemainPlateDO> {
|
||||
|
||||
default PageResult<RemainPlateDO> selectPage(RemainPlatePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<RemainPlateDO>()
|
||||
.eqIfPresent(RemainPlateDO::getId, reqVO.getId())
|
||||
.eqIfPresent(RemainPlateDO::getPlanId, reqVO.getPlanId())
|
||||
.eqIfPresent(RemainPlateDO::getInitPlanId, reqVO.getInitPlanId())
|
||||
.eqIfPresent(RemainPlateDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(RemainPlateDO::getGoodsId, reqVO.getGoodsId())
|
||||
.eqIfPresent(RemainPlateDO::getIsCutting, reqVO.getIsCutting())
|
||||
.likeIfPresent(RemainPlateDO::getName, reqVO.getName())
|
||||
.eqIfPresent(RemainPlateDO::getMaterial, reqVO.getMaterial())
|
||||
.eqIfPresent(RemainPlateDO::getColor, reqVO.getColor())
|
||||
.likeIfPresent(RemainPlateDO::getMaterial, reqVO.getMaterial())
|
||||
.likeIfPresent(RemainPlateDO::getColor, reqVO.getColor())
|
||||
.eqIfPresent(RemainPlateDO::getThickness, reqVO.getThickness())
|
||||
.eqIfPresent(RemainPlateDO::getBrand, reqVO.getBrand())
|
||||
.eqIfPresent(RemainPlateDO::getPlaceStyle, reqVO.getPlaceStyle())
|
||||
.eqIfPresent(RemainPlateDO::getStore, reqVO.getStore())
|
||||
.likeIfPresent(RemainPlateDO::getStore, reqVO.getStore())
|
||||
.eqIfPresent(RemainPlateDO::getCount, reqVO.getCount())
|
||||
.eqIfPresent(RemainPlateDO::getRemark, reqVO.getRemark())
|
||||
.likeIfPresent(RemainPlateDO::getRemark, reqVO.getRemark())
|
||||
.eqIfPresent(RemainPlateDO::getUseType, reqVO.getUseType())
|
||||
.eqIfPresent(RemainPlateDO::getOrganId, reqVO.getOrganId())
|
||||
.eqIfPresent(RemainPlateDO::getOutLineJson, reqVO.getOutLineJson())
|
||||
@@ -52,4 +55,39 @@ public interface RemainPlateMapper extends BaseMapperX<RemainPlateDO> {
|
||||
.eq("organ_id",organId)
|
||||
.in("id", ids));
|
||||
}
|
||||
|
||||
// 查询该排单是否已经添加余料
|
||||
default List<RemainPlateDO> selectRemainPlatesByInitPlanId(Long initPlanId, Integer deleted, Long organId) {
|
||||
return selectList(new LambdaUpdateWrapper<RemainPlateDO>()
|
||||
.eq(RemainPlateDO::getInitPlanId, initPlanId)
|
||||
.eq(RemainPlateDO::getDeleted, deleted)
|
||||
.eq(RemainPlateDO::getOrganId, organId));
|
||||
}
|
||||
|
||||
// 判断该排单是否存在以使用的余料
|
||||
default List<RemainPlateDO> selectRemainPlatesByPlanId(Long planId, Integer status, Integer deleted, Long organId) {
|
||||
return selectList(new LambdaUpdateWrapper<RemainPlateDO>()
|
||||
.eq(RemainPlateDO::getPlanId, planId)
|
||||
.eq(RemainPlateDO::getStatus, status)
|
||||
.eq(RemainPlateDO::getDeleted, deleted)
|
||||
.eq(RemainPlateDO::getOrganId, organId));
|
||||
}
|
||||
|
||||
// 通过排单id批量余料板
|
||||
default void deleteRemainPlate(Long initPlanId, Long organId) {
|
||||
update(new UpdateWrapper<RemainPlateDO>()
|
||||
.set("deleted", 1)
|
||||
.eq("init_plan_id", initPlanId)
|
||||
.eq("organ_id", organId));
|
||||
}
|
||||
|
||||
// 根据使用排单id批量还原状态
|
||||
default void updateRemainPlateStatusByPlanId(Integer status, Integer useType,Long organId,Long planId) {
|
||||
update(new UpdateWrapper<RemainPlateDO>()
|
||||
.set("status", status)
|
||||
.set("use_type", useType)
|
||||
.set("plan_id","")
|
||||
.eq("organ_id",organId)
|
||||
.eq("plan_id", planId));
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -21,12 +21,12 @@ public interface RemainPlateService {
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createRemainPlate(@Valid RemainPlateSaveReqVO createReqVO);
|
||||
Boolean createRemainPlate(@Valid RemainPlateSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 创建生产单余料板表
|
||||
*
|
||||
* @param createReqVOS 创建信息
|
||||
* @param createReqVOS 创建信息 多个
|
||||
* @return 编号
|
||||
*/
|
||||
Boolean createRemainPlateMultiple(@Valid Set<RemainPlateSaveReqVO> createReqVOS);
|
||||
|
||||
+47
-18
@@ -5,6 +5,7 @@ import com.cf.imes.module.manage.controller.admin.plate.vo.remain.RemainPlatePag
|
||||
import com.cf.imes.module.manage.controller.admin.plate.vo.remain.RemainPlateSaveReqVO;
|
||||
import com.cf.imes.module.manage.dal.dataobject.remainplaten.RemainPlateDO;
|
||||
import com.cf.imes.module.manage.dal.mysql.remainplaten.RemainPlateMapper;
|
||||
import com.cf.imes.module.manage.enums.DeletedCodeEnum;
|
||||
import com.cf.imes.module.manage.enums.RemainPlateStatusEnum;
|
||||
import com.cf.imes.module.manage.enums.RemainPlateUseTypeEnum;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -35,18 +36,29 @@ public class RemainPlateServiceImpl implements RemainPlateService {
|
||||
private RemainPlateMapper remainPlateMapper;
|
||||
|
||||
@Override
|
||||
public Long createRemainPlate(RemainPlateSaveReqVO createReqVO) {
|
||||
public Boolean createRemainPlate(RemainPlateSaveReqVO createReqVO) {
|
||||
List<RemainPlateDO> remainPlates = new ArrayList<>();
|
||||
// 插入
|
||||
RemainPlateDO remainPlate = BeanUtils.toBean(createReqVO, RemainPlateDO.class);
|
||||
remainPlateMapper.insert(remainPlate);
|
||||
// 返回
|
||||
return remainPlate.getId();
|
||||
if (createReqVO.getCount() > 1) {
|
||||
for (int i = 0; i < createReqVO.getCount(); i++) {
|
||||
RemainPlateDO remainPlate = BeanUtils.toBean(createReqVO, RemainPlateDO.class).setCount(1);
|
||||
remainPlates.add(remainPlate);
|
||||
}
|
||||
}
|
||||
// 批量增加
|
||||
return remainPlateMapper.insertBatch(remainPlates);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean createRemainPlateMultiple(Set<RemainPlateSaveReqVO> createReqVOS) {
|
||||
Collection<RemainPlateDO> remainPlates = new ArrayList<>();
|
||||
createReqVOS.forEach(createReqVO -> {
|
||||
// 判断该排单是否已经添加过余料
|
||||
if (remainPlateMapper.selectRemainPlatesByInitPlanId(createReqVO.getInitPlanId(), DeletedCodeEnum.NOT_DELETED.getStatus(), OrganContextHolder.getOrganId()).size() > 0) {
|
||||
// 删除余料
|
||||
remainPlateMapper.deleteRemainPlate(createReqVO.getInitPlanId(), OrganContextHolder.getOrganId());
|
||||
}
|
||||
RemainPlateDO remainPlate = BeanUtils.toBean(createReqVO, RemainPlateDO.class);
|
||||
remainPlates.add(remainPlate);
|
||||
});
|
||||
@@ -55,25 +67,39 @@ public class RemainPlateServiceImpl implements RemainPlateService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateRemainPlateStatus(Set<Long> ids, Integer status, Integer useType,Long planId) {
|
||||
//判断是否符合核销标准
|
||||
validateRemainPlateStatus(ids,RemainPlateStatusEnum.IN_USE.getStatus());
|
||||
//以id为条件批量修改余料库中的状态
|
||||
remainPlateMapper.updateRemainPlateStatus(ids, status, useType, OrganContextHolder.getOrganId(),planId);
|
||||
public void updateRemainPlateStatus(Set<Long> ids, Integer status, Integer useType, Long planId) {
|
||||
if (useType != RemainPlateUseTypeEnum.TYPE_ONE.getStatus() && useType != RemainPlateUseTypeEnum.TYPE_ZERO.getStatus()) { //余料使用状态为2或3
|
||||
// 判断该排单是否存在以使用的余料
|
||||
if (remainPlateMapper.selectRemainPlatesByPlanId(planId, RemainPlateStatusEnum.IN_USE.getStatus(),
|
||||
DeletedCodeEnum.NOT_DELETED.getStatus(), OrganContextHolder.getOrganId()).size() > 0) {
|
||||
// 余料状态还原
|
||||
remainPlateMapper.updateRemainPlateStatusByPlanId(RemainPlateStatusEnum.UNUSED.getStatus(), RemainPlateUseTypeEnum.TYPE_ZERO.getStatus(),
|
||||
OrganContextHolder.getOrganId(), planId);
|
||||
}
|
||||
}
|
||||
if (ids != null){
|
||||
//判断是否符合核销标准
|
||||
validateRemainPlateStatus(ids, RemainPlateStatusEnum.IN_USE.getStatus());
|
||||
//以id为条件批量修改余料库中的状态
|
||||
remainPlateMapper.updateRemainPlateStatus(ids, status, useType, OrganContextHolder.getOrganId(), planId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void revertRemainPlateStatus(Set<Long> ids, Integer status) {
|
||||
if (ids == null) {
|
||||
throw exception(REMAIN_PLATE_ID_NOT_EXISTS);
|
||||
}
|
||||
// 判断余料的状态是否存在使用中
|
||||
validateRemainPlateStatus(ids,RemainPlateStatusEnum.UNUSED.getStatus());
|
||||
validateRemainPlateStatus(ids, RemainPlateStatusEnum.UNUSED.getStatus());
|
||||
// 判断使用类型是否为核销
|
||||
for (Long id : ids) {
|
||||
if (validateRemainPlateUseType(id).equals( RemainPlateUseTypeEnum.TYPE_ONE.getStatus())) {
|
||||
if (!validateRemainPlateUseType(id).equals(RemainPlateUseTypeEnum.TYPE_ONE.getStatus())) {
|
||||
throw exception(REMAIN_PLATE_USR_TYPE);
|
||||
}
|
||||
}
|
||||
remainPlateMapper.updateRemainPlateStatus(ids, status, null, OrganContextHolder.getOrganId(),0L);
|
||||
remainPlateMapper.updateRemainPlateStatus(ids, status, null, OrganContextHolder.getOrganId(), 0L);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -81,14 +107,14 @@ public class RemainPlateServiceImpl implements RemainPlateService {
|
||||
// 校验存在
|
||||
validateRemainPlateExists(updateReqVO.getId());
|
||||
// 是否使用
|
||||
if (validateRemainPlateStatus(updateReqVO.getId()) == RemainPlateStatusEnum.IN_USE.getStatus()){
|
||||
if (validateRemainPlateStatus(updateReqVO.getId()) == RemainPlateStatusEnum.IN_USE.getStatus()) {
|
||||
throw exception(REMAIN_PLATE_STATUS_USED);
|
||||
}
|
||||
// 判断是否为开料添加
|
||||
RemainPlateDO updateObj = new RemainPlateDO();
|
||||
if (validateRemainPlateIsCutting(updateReqVO.getId())){
|
||||
if (validateRemainPlateIsCutting(updateReqVO.getId())) {
|
||||
updateObj.setRemark(updateReqVO.getRemark());
|
||||
}else {
|
||||
} else {
|
||||
// 更新
|
||||
updateObj = BeanUtils.toBean(updateReqVO, RemainPlateDO.class);
|
||||
}
|
||||
@@ -98,8 +124,11 @@ public class RemainPlateServiceImpl implements RemainPlateService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteRemainPlate(Set<Long> ids) {
|
||||
if (ids == null) {
|
||||
throw exception(REMAIN_PLATE_ID_NOT_EXISTS);
|
||||
}
|
||||
// 判断余料的状态是否存在使用中
|
||||
validateRemainPlateStatus(ids,RemainPlateStatusEnum.IN_USE.getStatus());
|
||||
validateRemainPlateStatus(ids, RemainPlateStatusEnum.IN_USE.getStatus());
|
||||
// 删除
|
||||
remainPlateMapper.deleteBatchIds(ids);
|
||||
}
|
||||
@@ -123,7 +152,7 @@ public class RemainPlateServiceImpl implements RemainPlateService {
|
||||
}
|
||||
|
||||
private boolean validateRemainPlateIsCutting(Long id) {
|
||||
return remainPlateMapper.selectById(id).getIsCutting();
|
||||
return remainPlateMapper.selectById(id).getIsCutting();
|
||||
}
|
||||
|
||||
private Integer validateRemainPlateStatus(Long id) {
|
||||
|
||||
Reference in New Issue
Block a user