Browse Source

YT-885采购换货申请,添加明细的时候不能添加重复的物料

intex
zhaoyiran 4 days ago
parent
commit
4d1d1406aa
  1. 2
      win-module-wms/win-module-wms-api/src/main/java/com/win/module/wms/enums/ErrorCodeConstants.java
  2. 8
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/mysql/purchaseBarterRequest/PurchaseBarterRequestDetailMapper.java
  3. 7
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchaseBarterRequest/PurchaseBarterRequestDetailServiceImpl.java

2
win-module-wms/win-module-wms-api/src/main/java/com/win/module/wms/enums/ErrorCodeConstants.java

@ -1838,6 +1838,8 @@ public interface ErrorCodeConstants {
ErrorCode PURCHASE_BARTER_REQUEST_MAIN_NOT_EXISTS = new ErrorCode(1_000_022_001, "采购换货申请单不存在");
ErrorCode PURCHASE_BARTER_REQUEST_MAIN_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_000_022_002, "采购换货申请单导入数据为空");
ErrorCode PURCHASE_BARTER_REQUEST_DETAIL_EXISTS = new ErrorCode(1_000_022_003, "该物料已存在,不能重复添加");
ErrorCode ADJUSTMENT_AMOUNT_ZERO = new ErrorCode(1_000_021_012, "当前品番数量为0,调整金额只能为0,不能修改");
ErrorCode NO_MATCHING_PURCHASE_PLAN_STRATEGY = new ErrorCode(1_000_022_002, "没有匹配的采购计划策略");
ErrorCode ADJUSTMENT_AMOUNT_NOT_ZORE = new ErrorCode(1_000_022_003, "调整金额列相加之和不等于0,无法确认分摊");

8
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/mysql/purchaseBarterRequest/PurchaseBarterRequestDetailMapper.java

@ -6,6 +6,7 @@ import com.win.framework.datapermission.annotation.SubDataScope;
import com.win.framework.mybatis.core.mapper.BaseMapperX;
import com.win.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.win.framework.mybatis.core.util.QueryWrapperUtils;
import com.win.module.wms.controller.purchaseBarterRequest.vo.PurchaseBarterRequestDetailCreateReqVO;
import com.win.module.wms.controller.purchaseBarterRequest.vo.PurchaseBarterRequestDetailExportReqVO;
import com.win.module.wms.controller.purchaseBarterRequest.vo.PurchaseBarterRequestDetailPageReqVO;
import com.win.module.wms.dal.dataobject.purchaseBarterRequest.PurchaseBarterRequestDetailDO;
@ -71,4 +72,11 @@ public interface PurchaseBarterRequestDetailMapper extends BaseMapperX<PurchaseB
.orderByDesc(PurchaseBarterRequestDetailDO::getId));
}
default Long validateExists(PurchaseBarterRequestDetailCreateReqVO createReqVO){
return selectCount(new LambdaQueryWrapperX<PurchaseBarterRequestDetailDO>()
.eq(PurchaseBarterRequestDetailDO::getItemCode, createReqVO.getItemCode())
.eq(PurchaseBarterRequestDetailDO::getBatch, createReqVO.getBatch())
.eq(PurchaseBarterRequestDetailDO::getLocationCode, createReqVO.getLocationCode())
.eq(PurchaseBarterRequestDetailDO::getInventoryStatus, createReqVO.getInventoryStatus()));
}
}

7
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchaseBarterRequest/PurchaseBarterRequestDetailServiceImpl.java

@ -14,6 +14,9 @@ import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.win.module.wms.enums.ErrorCodeConstants.PURCHASE_BARTER_REQUEST_DETAIL_EXISTS;
/**
* 采购换货申请明细 Service 实现类
*
@ -28,6 +31,10 @@ public class PurchaseBarterRequestDetailServiceImpl implements PurchaseBarterReq
@Override
public Long createPurchaseBarterRequestDetail(PurchaseBarterRequestDetailCreateReqVO createReqVO) {
Long count = purchaseBarterRequestDetailMapper.validateExists(createReqVO);
if(count > 0){
throw exception(PURCHASE_BARTER_REQUEST_DETAIL_EXISTS);
}
// 插入
PurchaseBarterRequestDetailDO purchaseBarterRequestDetail = PurchaseBarterRequestDetailConvert.INSTANCE.convert(createReqVO);
purchaseBarterRequestDetailMapper.insert(purchaseBarterRequestDetail);

Loading…
Cancel
Save