master:需求单功能完善;

pull/1121/head
liujiang 2025-04-05 22:35:53 +08:00
parent 809b7fc109
commit 03f8682ad3
24 changed files with 730 additions and 277 deletions

View File

@ -14,7 +14,6 @@ import com.ruoyi.xkt.service.IStoreCustomerProductDiscountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -48,12 +47,6 @@ public class StoreCustomerProductDiscountController extends XktBaseController {
}
/**
*
*/
@ -97,7 +90,6 @@ public class StoreCustomerProductDiscountController extends XktBaseController {
}
/**
*
*/

View File

@ -17,7 +17,6 @@ import com.ruoyi.xkt.service.IStoreFactoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -79,11 +78,10 @@ public class StoreFactoryController extends XktBaseController {
@ApiOperation(value = "获取档口合作工厂详细信息", httpMethod = "GET", response = R.class)
@GetMapping(value = "/{storeId}/{storeFactoryId}")
public R<StoreFactoryVO> getInfo(@PathVariable("storeId") Long storeId, @PathVariable("storeFactoryId") Long storeFactoryId) {
return R.ok(BeanUtil.toBean(storeFactoryService.selectByStoreFacId(storeId ,storeFactoryId), StoreFactoryVO.class));
return R.ok(BeanUtil.toBean(storeFactoryService.selectByStoreFacId(storeId, storeFactoryId), StoreFactoryVO.class));
}
/**
*
*/

View File

@ -12,7 +12,6 @@ import com.ruoyi.xkt.domain.StoreProductBarcodeMatch;
import com.ruoyi.xkt.dto.storeProdBarcodeMatch.BarcodeMatchDTO;
import com.ruoyi.xkt.service.IStoreProductBarcodeMatchService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -44,7 +43,6 @@ public class StoreProductBarcodeMatchController extends XktBaseController {
}
/**
*
*/

View File

@ -1,23 +1,18 @@
package com.ruoyi.web.controller.xkt;
import cn.hutool.core.bean.BeanUtil;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.XktBaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.web.controller.xkt.vo.storePordColor.StoreProdColorResVO;
import com.ruoyi.xkt.domain.StoreProductColor;
import com.ruoyi.xkt.service.IStoreProductColorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* Controller
@ -40,7 +35,7 @@ public class StoreProductColorController extends XktBaseController {
@ApiOperation(value = "模糊查询档口所有的商品颜色分类", httpMethod = "GET", response = R.class)
@GetMapping(value = "/fuzzy")
public R<StoreProdColorResVO> fuzzyQueryColorList(@RequestParam(value = "prodArtNum", required = false) String prodArtNum,
@RequestParam("storeId") Long storeId) {
@RequestParam("storeId") Long storeId) {
return success(BeanUtil.copyToList(storeProdColorService.fuzzyQueryColorList(storeId, prodArtNum), StoreProdColorResVO.class));
}

View File

@ -1,30 +1,21 @@
package com.ruoyi.web.controller.xkt;
import cn.hutool.core.bean.BeanUtil;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.XktBaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.Page;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.web.controller.xkt.vo.storeCustomer.StoreCusPageVO;
import com.ruoyi.web.controller.xkt.vo.storeProductDemand.*;
import com.ruoyi.xkt.domain.StoreProductDemand;
import com.ruoyi.xkt.dto.storeCustomer.StoreCusPageDTO;
import com.ruoyi.xkt.dto.storeProductDemand.*;
import com.ruoyi.xkt.service.IStoreProductDemandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
@ -41,22 +32,17 @@ public class StoreProductDemandController extends XktBaseController {
final IStoreProductDemandService storeProdDemandService;
// TODO 入库单判断需求单是否存在
// TODO 入库单判断需求单是否存在
// TODO 入库单判断需求单是否存在
// TODO 入库单判断需求单是否存在
// TODO 删除需求单,若该需求单有已完成的入库单,则该需求单状态改为已完成,并将数量改为已完成的入库单数量
// TODO 删除需求单,若该需求单有已完成的入库单,则该需求单状态改为已完成,并将数量改为已完成的入库单数量
// TODO 删除需求单,若该需求单有已完成的入库单,则该需求单状态改为已完成,并将数量改为已完成的入库单数量
// TODO 删除需求单,若该需求单有已完成的入库单,则该需求单状态改为已完成,并将数量改为已完成的入库单数量
// TODO 点击安排生产,状态才会变成:生产中,若仅仅是由入库单来反推,则不能变更状态
// TODO 点击安排生产,状态才会变成:生产中,若仅仅是由入库单来反推,则不能变更状态
// TODO 点击安排生产,状态才会变成:生产中,若仅仅是由入库单来反推,则不能变更状态
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:demand:query')")
@ApiOperation(value = "商品入库校验是否存在需求单", httpMethod = "POST", response = R.class)
@Log(title = "商品入库校验是否存在需求单", businessType = BusinessType.INSERT)
@PostMapping("/verify")
public R<StoreProdDemandVerifyResVO> verifyDemandExist(@Validated @RequestBody StoreProdDemandVerifyVO demandVerifyVO) {
return R.ok(BeanUtil.toBean(storeProdDemandService
.verifyDemandExist(BeanUtil.toBean(demandVerifyVO, StoreProdDemandVerifyDTO.class)), StoreProdDemandVerifyResVO.class));
}
/**
*
@ -65,7 +51,7 @@ public class StoreProductDemandController extends XktBaseController {
@PreAuthorize("@ss.hasPermi('system:demand:query')")
@GetMapping(value = "/exists-quantity/{storeId}/{storeProdId}")
public R<List<StoreProdDemandQuantityVO>> getStockAndProduceQuantity(@PathVariable("storeId") Long storeId, @PathVariable("storeProdId") Long storeProdId) {
return R.ok(BeanUtil.copyToList(storeProdDemandService.getStockAndProduceQuantity(storeId, storeProdId), StoreProdDemandQuantityVO.class));
return R.ok(BeanUtil.copyToList(storeProdDemandService.getStockAndProduceQuantity(storeId, storeProdId), StoreProdDemandQuantityVO.class));
}
/**
@ -98,39 +84,22 @@ public class StoreProductDemandController extends XktBaseController {
@PutMapping
public R<Integer> updateWorkingStatus(@Validated @RequestBody StoreProdDemandWorkingVO workingVO) {
return R.ok(storeProdDemandService.updateWorkingStatus(BeanUtil.toBean(workingVO, StoreProdDemandWorkingDTO.class)));
// TODO 是否需要导出excel表格
// TODO 是否需要导出excel表格
// TODO 是否需要导出excel表格
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:demand:query')")
@GetMapping(value = "/{storeProdDemandId}")
public R getInfo(@PathVariable("storeProdDemandId") Long storeProdDemandId) {
return success(storeProdDemandService.selectStoreProductDemandByStoreProdDemandId(storeProdDemandId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:demand:remove')")
@Log(title = "档口商品需求单", businessType = BusinessType.DELETE)
@DeleteMapping("/{storeProdDemandIds}")
public R remove(@PathVariable Long[] storeProdDemandIds) {
return success(storeProdDemandService.deleteStoreProductDemandByStoreProdDemandIds(storeProdDemandIds));
@ApiOperation(value = "删除档口商品需求单", httpMethod = "DELETE", response = R.class)
@Log(title = "删除档口商品需求单", businessType = BusinessType.DELETE)
@DeleteMapping("")
public R<Integer> remove(@Validated @RequestBody StoreProdDemandDeleteVO deleteVO) {
return R.ok(storeProdDemandService.deleteByStoreProdDemandIds(BeanUtil.toBean(deleteVO, StoreProdDemandDeleteDTO.class)));
}
}

View File

@ -1,19 +1,10 @@
package com.ruoyi.web.controller.xkt;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.XktBaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.xkt.domain.StoreProductStorageDemandDeduct;
import com.ruoyi.xkt.service.IStoreProductStorageDemandDeducteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* Controller

View File

@ -1,29 +1,19 @@
package com.ruoyi.web.controller.xkt;
import cn.hutool.core.bean.BeanUtil;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.XktBaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.Page;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.web.controller.xkt.vo.storeProdStock.StoreProdStockPageVO;
import com.ruoyi.web.controller.xkt.vo.storeSaleRefundRecord.StoreSaleRefundRecordVO;
import com.ruoyi.xkt.domain.StoreSaleRefundRecord;
import com.ruoyi.xkt.dto.storeProductStock.StoreProdStockPageDTO;
import com.ruoyi.xkt.dto.storeSaleRefundRecord.StoreSaleRefundRecordDTO;
import com.ruoyi.xkt.service.IStoreSaleRefundRecordService;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.util.List;
/**

View File

@ -0,0 +1,26 @@
package com.ruoyi.web.controller.xkt.vo.storeProductDemand;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("档口需求删除")
@Data
public class StoreProdDemandDeleteVO {
@ApiModelProperty(value = "档口ID", required = true)
@NotNull(message = "档口ID不能为空")
private Long storeId;
@NotNull(message = "档口需求明细ID不能为空")
@ApiModelProperty(value = "档口需求明细ID", required = true)
private List<Long> storeProdDemandDetailIdList;
}

View File

@ -0,0 +1,21 @@
package com.ruoyi.web.controller.xkt.vo.storeProductDemand;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("档口商品生产入库校验是否存在需求单返回前端数据")
@Data
public class StoreProdDemandVerifyResVO {
@ApiModelProperty(value = "需求不存在信息列表")
private List<String> errorMsgList;
}

View File

@ -0,0 +1,72 @@
package com.ruoyi.web.controller.xkt.vo.storeProductDemand;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("档口商品生产入库校验是否存在需求单")
@Data
public class StoreProdDemandVerifyVO {
@NotNull(message = "档口ID不能为空")
@ApiModelProperty(value = "档口ID", required = true)
private Long storeId;
@NotNull(message = "需求列表不能为空")
@ApiModelProperty(value = "需求列表", required = true)
private List<DetailVO> detailList;
@Data
@ApiModel(value = "需求列表")
public static class DetailVO {
@NotNull(message = "档口商品ID不能为空")
@ApiModelProperty(value = "档口商品ID", required = true)
private Long storeProdId;
@NotNull(message = "档口商品颜色ID不能为空")
@ApiModelProperty(value = "档口商品颜色ID", required = true)
private Long storeProdColorId;
@NotBlank(message = "货号不能为空")
@ApiModelProperty(value = "货号", required = true)
private String prodArtNum;
@NotBlank(message = "颜色不能为空")
@ApiModelProperty(value = "颜色", required = true)
private String colorName;
@ApiModelProperty(value = "尺码30")
private Integer size30;
@ApiModelProperty(value = "尺码31")
private Integer size31;
@ApiModelProperty(value = "尺码32")
private Integer size32;
@ApiModelProperty(value = "尺码33")
private Integer size33;
@ApiModelProperty(value = "尺码34")
private Integer size34;
@ApiModelProperty(value = "尺码35")
private Integer size35;
@ApiModelProperty(value = "尺码36")
private Integer size36;
@ApiModelProperty(value = "尺码37")
private Integer size37;
@ApiModelProperty(value = "尺码38")
private Integer size38;
@ApiModelProperty(value = "尺码39")
private Integer size39;
@ApiModelProperty(value = "尺码40")
private Integer size40;
@ApiModelProperty(value = "尺码41")
private Integer size41;
@ApiModelProperty(value = "尺码42")
private Integer size42;
@ApiModelProperty(value = "尺码43")
private Integer size43;
}
}

View File

@ -172,7 +172,24 @@ public class Constants
"org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config", "com.ruoyi.generator" };
public static final String UNDELETED = "0";
public static final String DELETED = "2";
public static final Integer SIZE_30 = 30;
public static final Integer SIZE_31 = 31;
public static final Integer SIZE_32 = 32;
public static final Integer SIZE_33 = 33;
public static final Integer SIZE_34 = 34;
public static final Integer SIZE_35 = 35;
public static final Integer SIZE_36 = 36;
public static final Integer SIZE_37 = 37;
public static final Integer SIZE_38 = 38;
public static final Integer SIZE_39 = 39;
public static final Integer SIZE_40 = 40;
public static final Integer SIZE_41 = 41;
public static final Integer SIZE_42 = 42;
public static final Integer SIZE_43 = 43;
}

View File

@ -0,0 +1,23 @@
package com.ruoyi.xkt.dto.storeProductDemand;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("档口需求删除")
@Data
public class StoreProdDemandDeleteDTO {
@ApiModelProperty(value = "档口ID", required = true)
private Long storeId;
@ApiModelProperty(value = "档口需求明细ID", required = true)
private List<Long> storeProdDemandDetailIdList;
}

View File

@ -0,0 +1,64 @@
package com.ruoyi.xkt.dto.storeProductDemand;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("档口商品生产入库校验是否存在需求单")
@Data
public class StoreProdDemandVerifyDTO {
@ApiModelProperty(value = "档口ID", required = true)
private Long storeId;
@ApiModelProperty(value = "需求列表", required = true)
private List<DetailDTO> detailList;
@Data
@ApiModel(value = "需求列表")
public static class DetailDTO {
@ApiModelProperty(value = "档口商品ID", required = true)
private Long storeProdId;
@ApiModelProperty(value = "档口商品颜色ID", required = true)
private Long storeProdColorId;
@ApiModelProperty(value = "货号", required = true)
private String prodArtNum;
@ApiModelProperty(value = "颜色", required = true)
private String colorName;
@ApiModelProperty(value = "尺码30")
private Integer size30;
@ApiModelProperty(value = "尺码31")
private Integer size31;
@ApiModelProperty(value = "尺码32")
private Integer size32;
@ApiModelProperty(value = "尺码33")
private Integer size33;
@ApiModelProperty(value = "尺码34")
private Integer size34;
@ApiModelProperty(value = "尺码35")
private Integer size35;
@ApiModelProperty(value = "尺码36")
private Integer size36;
@ApiModelProperty(value = "尺码37")
private Integer size37;
@ApiModelProperty(value = "尺码38")
private Integer size38;
@ApiModelProperty(value = "尺码39")
private Integer size39;
@ApiModelProperty(value = "尺码40")
private Integer size40;
@ApiModelProperty(value = "尺码41")
private Integer size41;
@ApiModelProperty(value = "尺码42")
private Integer size42;
@ApiModelProperty(value = "尺码43")
private Integer size43;
}
}

View File

@ -0,0 +1,21 @@
package com.ruoyi.xkt.dto.storeProductDemand;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("档口商品生产入库校验是否存在需求单返回前端数据")
@Data
public class StoreProdDemandVerifyResDTO {
@ApiModelProperty(value = "需求不存在信息列表")
private List<String> errorMsgList;
}

View File

@ -68,4 +68,15 @@ public interface StoreProductDemandMapper extends BaseMapper<StoreProductDemand>
*/
void updateStatusByIds(@Param("demandIdList") List<Long> demandIdList);
/**
*
*
* ID
* IDID
*
* @param deleteDemandIdList ID
*/
void deleteDemandList(@Param("deleteDemandIdList") List<Long> deleteDemandIdList);
}

View File

@ -1,7 +1,6 @@
package com.ruoyi.xkt.service;
import com.ruoyi.common.core.page.Page;
import com.ruoyi.xkt.domain.StoreProductDemand;
import com.ruoyi.xkt.dto.storeProductDemand.*;
import java.util.List;
@ -13,53 +12,14 @@ import java.util.List;
* @date 2025-03-26
*/
public interface IStoreProductDemandService {
/**
*
*
* @param storeProdDemandId
* @return
*/
public StoreProductDemand selectStoreProductDemandByStoreProdDemandId(Long storeProdDemandId);
/**
*
*
* @param storeProductDemand
* @return
*/
public List<StoreProductDemand> selectStoreProductDemandList(StoreProductDemand storeProductDemand);
/**
*
*
* @param storeProductDemand
* @return
*/
public int insertStoreProductDemand(StoreProductDemand storeProductDemand);
/**
*
*
* @param storeProductDemand
* @return
*/
public int updateStoreProductDemand(StoreProductDemand storeProductDemand);
/**
*
*
* @param storeProdDemandIds
* @param deleteDTO
* @return
*/
public int deleteStoreProductDemandByStoreProdDemandIds(Long[] storeProdDemandIds);
/**
*
*
* @param storeProdDemandId
* @return
*/
public int deleteStoreProductDemandByStoreProdDemandId(Long storeProdDemandId);
public int deleteByStoreProdDemandIds(StoreProdDemandDeleteDTO deleteDTO);
/**
*
@ -71,7 +31,6 @@ public interface IStoreProductDemandService {
*/
List<StoreProdDemandQuantityDTO> getStockAndProduceQuantity(Long storeId, Long storeProdId);
/**
*
*
@ -100,4 +59,14 @@ public interface IStoreProductDemandService {
*/
Integer updateWorkingStatus(StoreProdDemandWorkingDTO workingDTO);
/**
*
*
*
*
* @param demandVerifyDTO DTO
* @return DTO
*/
StoreProdDemandVerifyResDTO verifyDemandExist(StoreProdDemandVerifyDTO demandVerifyDTO);
}

View File

@ -44,8 +44,8 @@ public class ExpressServiceImpl implements IExpressService {
Assert.notEmpty(cityCode);
Assert.notEmpty(countyCode);
Map<String, ExpressFeeConfig> map = expressFeeConfigMapper.selectList(Wrappers.lambdaQuery(ExpressFeeConfig.class)
.eq(ExpressFeeConfig::getExpressId, expressId)
.in(ExpressFeeConfig::getRegionCode, Arrays.asList(provinceCode, cityCode, countyCode)))
.eq(ExpressFeeConfig::getExpressId, expressId)
.in(ExpressFeeConfig::getRegionCode, Arrays.asList(provinceCode, cityCode, countyCode)))
.stream()
//过滤掉已被删除的配置
.filter(BeanValidators::exists)

View File

@ -85,7 +85,6 @@ public class StoreCustomerProductDiscountServiceImpl implements IStoreCustomerPr
}
/**
*
*
@ -149,6 +148,7 @@ public class StoreCustomerProductDiscountServiceImpl implements IStoreCustomerPr
/**
*
*
* @param cusProdDisDTO
* @return StoreCustomer
*/

View File

@ -14,7 +14,6 @@ import com.ruoyi.xkt.dto.storeCustomer.StoreCusDTO;
import com.ruoyi.xkt.dto.storeCustomer.StoreCusFuzzyResDTO;
import com.ruoyi.xkt.dto.storeCustomer.StoreCusPageDTO;
import com.ruoyi.xkt.dto.storeCustomer.StoreCusPageResDTO;
import com.ruoyi.xkt.dto.storeProduct.StoreProdPageDTO;
import com.ruoyi.xkt.mapper.StoreCustomerMapper;
import com.ruoyi.xkt.service.IStoreCustomerService;
import lombok.RequiredArgsConstructor;

View File

@ -101,18 +101,12 @@ public class StoreFactoryServiceImpl implements IStoreFactoryService {
@Transactional(readOnly = true)
public StoreFactoryResDTO selectByStoreFacId(Long storeId, Long storeFacId) {
StoreFactory storeFactory = Optional.ofNullable(this.storeFactoryMapper.selectOne(new LambdaQueryWrapper<StoreFactory>()
.eq(StoreFactory::getId, storeFacId).eq(StoreFactory::getDelFlag, Constants.UNDELETED).eq(StoreFactory::getStoreId, storeId)))
.eq(StoreFactory::getId, storeFacId).eq(StoreFactory::getDelFlag, Constants.UNDELETED).eq(StoreFactory::getStoreId, storeId)))
.orElseThrow(() -> new ServiceException("档口合作工厂不存在!", HttpStatus.ERROR));
return BeanUtil.toBean(storeFactory, StoreFactoryResDTO.class);
}
/**
*
*
@ -126,8 +120,6 @@ public class StoreFactoryServiceImpl implements IStoreFactoryService {
}
/**
*
*

View File

@ -19,6 +19,7 @@ import com.ruoyi.xkt.service.IStoreProductDemandService;
import com.ruoyi.xkt.service.IVoucherSequenceService;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.ibatis.executor.BatchResult;
import org.springframework.stereotype.Service;
@ -27,6 +28,8 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
import static com.ruoyi.common.constant.Constants.*;
/**
* Service
*
@ -56,7 +59,7 @@ public class StoreProductDemandServiceImpl implements IStoreProductDemandService
*/
@Override
@Transactional(readOnly = true)
public List<StoreProdDemandQuantityDTO> getStockAndProduceQuantity(Long storeId, Long storeProdId) {
public List<StoreProdDemandQuantityDTO> getStockAndProduceQuantity(Long storeId, Long storeProdId) {
List<StoreProductColor> prodColorList = Optional.ofNullable(this.storeProdColorMapper.selectList(new LambdaQueryWrapper<StoreProductColor>()
.eq(StoreProductColor::getStoreId, storeId).eq(StoreProductColor::getDelFlag, Constants.UNDELETED).eq(StoreProductColor::getStoreProdId, storeProdId)))
.orElseThrow(() -> new RuntimeException("该档口下没有商品及颜色"));
@ -96,7 +99,6 @@ public class StoreProductDemandServiceImpl implements IStoreProductDemandService
Integer size41Demand = Optional.ofNullable(demandDetailList).map(x -> x.stream().map(StoreProductDemandDetail::getSize41).reduce(0, Integer::sum)).orElse(0);
Integer size42Demand = Optional.ofNullable(demandDetailList).map(x -> x.stream().map(StoreProductDemandDetail::getSize42).reduce(0, Integer::sum)).orElse(0);
Integer size43Demand = Optional.ofNullable(demandDetailList).map(x -> x.stream().map(StoreProductDemandDetail::getSize43).reduce(0, Integer::sum)).orElse(0);
// 尺码为30的数组
List<String> size30List = Arrays.asList(ObjectUtils.isNotEmpty(stock) && ObjectUtils.isNotEmpty(stock.getSize30()) ? stock.getSize30().toString() : Constants.UNDELETED, size30Demand.toString());
List<String> size31List = Arrays.asList(ObjectUtils.isNotEmpty(stock) && ObjectUtils.isNotEmpty(stock.getSize31()) ? stock.getSize31().toString() : Constants.UNDELETED, size31Demand.toString());
List<String> size32List = Arrays.asList(ObjectUtils.isNotEmpty(stock) && ObjectUtils.isNotEmpty(stock.getSize32()) ? stock.getSize32().toString() : Constants.UNDELETED, size32Demand.toString());
@ -205,79 +207,370 @@ public class StoreProductDemandServiceImpl implements IStoreProductDemandService
return list.size();
}
/**
*
*
*
*
*
* @param storeProdDemandId
* @return
* @param demandVerifyDTO DTO
* @return DTO
*/
@Override
@Transactional(readOnly = true)
public StoreProductDemand selectStoreProductDemandByStoreProdDemandId(Long storeProdDemandId) {
return storeProdDemandMapper.selectStoreProductDemandByStoreProdDemandId(storeProdDemandId);
}
/**
*
*
* @param storeProductDemand
* @return
*/
@Override
@Transactional(readOnly = true)
public List<StoreProductDemand> selectStoreProductDemandList(StoreProductDemand storeProductDemand) {
return storeProdDemandMapper.selectStoreProductDemandList(storeProductDemand);
}
/**
*
*
* @param storeProductDemand
* @return
*/
@Override
@Transactional
public int insertStoreProductDemand(StoreProductDemand storeProductDemand) {
storeProductDemand.setCreateTime(DateUtils.getNowDate());
return storeProdDemandMapper.insertStoreProductDemand(storeProductDemand);
}
/**
*
*
* @param storeProductDemand
* @return
*/
@Override
@Transactional
public int updateStoreProductDemand(StoreProductDemand storeProductDemand) {
storeProductDemand.setUpdateTime(DateUtils.getNowDate());
return storeProdDemandMapper.updateStoreProductDemand(storeProductDemand);
public StoreProdDemandVerifyResDTO verifyDemandExist(StoreProdDemandVerifyDTO demandVerifyDTO) {
// 所有的档口颜色ID列表
List<Long> prodColorIdList = demandVerifyDTO.getDetailList().stream().map(StoreProdDemandVerifyDTO.DetailDTO::getStoreProdColorId).distinct().collect(Collectors.toList());
List<StoreProductDemandDetail> demandDetailList = this.storeProdDemandDetailMapper.selectList(new LambdaQueryWrapper<StoreProductDemandDetail>()
.eq(StoreProductDemandDetail::getStoreId, demandVerifyDTO.getStoreId()).eq(StoreProductDemandDetail::getDelFlag, Constants.UNDELETED)
.in(StoreProductDemandDetail::getDetailStatus, Arrays.asList(DemandStatus.PENDING_PRODUCTION.getValue(), DemandStatus.IN_PRODUCTION.getValue()))
.in(StoreProductDemandDetail::getStoreProdColorId, prodColorIdList));
List<String> errorsMsgList = new ArrayList<>();
if (CollectionUtils.isEmpty(demandDetailList)) {
demandVerifyDTO.getDetailList().forEach(x -> {
List<String> errors = this.addErrorMsg(x);
if (CollectionUtils.isNotEmpty(errors)) {
errorsMsgList.addAll(errors);
}
});
} else {
Map<Long, List<StoreProductDemandDetail>> demandDetailMap = demandDetailList.stream().collect(Collectors.groupingBy(StoreProductDemandDetail::getStoreProdColorId));
Map<Long, Map<Integer, Integer>> colorSizeQuantityMap = new LinkedHashMap<>();
demandDetailMap.forEach((prodColorId, tempDemandDetailList) -> {
Map<Integer, Integer> sizeQuantityMap = new LinkedHashMap<>();
tempDemandDetailList.forEach(x -> {
if (ObjectUtils.isNotEmpty(x.getSize30())) {
sizeQuantityMap.put(SIZE_30, sizeQuantityMap.getOrDefault(SIZE_30, 0) + x.getSize30());
}
if (ObjectUtils.isNotEmpty(x.getSize31())) {
sizeQuantityMap.put(SIZE_31, sizeQuantityMap.getOrDefault(SIZE_31, 0) + x.getSize31());
}
if (ObjectUtils.isNotEmpty(x.getSize32())) {
sizeQuantityMap.put(SIZE_32, sizeQuantityMap.getOrDefault(SIZE_32, 0) + x.getSize32());
}
if (ObjectUtils.isNotEmpty(x.getSize33())) {
sizeQuantityMap.put(SIZE_33, sizeQuantityMap.getOrDefault(SIZE_33, 0) + x.getSize33());
}
if (ObjectUtils.isNotEmpty(x.getSize34())) {
sizeQuantityMap.put(SIZE_34, sizeQuantityMap.getOrDefault(SIZE_34, 0) + x.getSize34());
}
if (ObjectUtils.isNotEmpty(x.getSize35())) {
sizeQuantityMap.put(SIZE_35, sizeQuantityMap.getOrDefault(SIZE_35, 0) + x.getSize35());
}
if (ObjectUtils.isNotEmpty(x.getSize36())) {
sizeQuantityMap.put(SIZE_36, sizeQuantityMap.getOrDefault(SIZE_36, 0) + x.getSize36());
}
if (ObjectUtils.isNotEmpty(x.getSize37())) {
sizeQuantityMap.put(SIZE_37, sizeQuantityMap.getOrDefault(SIZE_37, 0) + x.getSize37());
}
if (ObjectUtils.isNotEmpty(x.getSize38())) {
sizeQuantityMap.put(SIZE_38, sizeQuantityMap.getOrDefault(SIZE_38, 0) + x.getSize38());
}
if (ObjectUtils.isNotEmpty(x.getSize39())) {
sizeQuantityMap.put(SIZE_39, sizeQuantityMap.getOrDefault(SIZE_39, 0) + x.getSize39());
}
if (ObjectUtils.isNotEmpty(x.getSize40())) {
sizeQuantityMap.put(SIZE_40, sizeQuantityMap.getOrDefault(SIZE_40, 0) + x.getSize40());
}
if (ObjectUtils.isNotEmpty(x.getSize41())) {
sizeQuantityMap.put(SIZE_41, sizeQuantityMap.getOrDefault(SIZE_41, 0) + x.getSize41());
}
if (ObjectUtils.isNotEmpty(x.getSize42())) {
sizeQuantityMap.put(SIZE_42, sizeQuantityMap.getOrDefault(SIZE_42, 0) + x.getSize42());
}
if (ObjectUtils.isNotEmpty(x.getSize43())) {
sizeQuantityMap.put(SIZE_43, sizeQuantityMap.getOrDefault(SIZE_43, 0) + x.getSize43());
}
});
if (MapUtils.isNotEmpty(sizeQuantityMap)) {
colorSizeQuantityMap.put(prodColorId, sizeQuantityMap);
}
});
// 按照入库的数量依次进行对比,若需求单中不存在匹配信息,则直接返回错误信息
demandVerifyDTO.getDetailList().forEach(x -> {
Map<Integer, Integer> sizeQuantityMap = colorSizeQuantityMap.get(x.getStoreProdColorId());
final String prefix = x.getProdArtNum() + x.getColorName();
final String suffix = "码";
// 如果没有对应的需求单则直接返回错误信息
if (MapUtils.isEmpty(sizeQuantityMap)) {
List<String> errors = this.addErrorMsg(x);
if (CollectionUtils.isNotEmpty(errors)) {
errorsMsgList.addAll(errors);
}
} else {
if (ObjectUtils.isNotEmpty(x.getSize30()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_30))) {
errorsMsgList.add(prefix + SIZE_30 + suffix);
}
if (ObjectUtils.isNotEmpty(x.getSize31()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_31))) {
errorsMsgList.add(prefix + SIZE_31 + suffix);
}
if (ObjectUtils.isNotEmpty(x.getSize32()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_32))) {
errorsMsgList.add(prefix + SIZE_32 + suffix);
}
if (ObjectUtils.isNotEmpty(x.getSize33()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_33))) {
errorsMsgList.add(prefix + SIZE_33 + suffix);
}
if (ObjectUtils.isNotEmpty(x.getSize34()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_34))) {
errorsMsgList.add(prefix + SIZE_34 + suffix);
}
if (ObjectUtils.isNotEmpty(x.getSize35()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_35))) {
errorsMsgList.add(prefix + SIZE_35 + suffix);
}
if (ObjectUtils.isNotEmpty(x.getSize36()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_36))) {
errorsMsgList.add(prefix + SIZE_36 + suffix);
}
if (ObjectUtils.isNotEmpty(x.getSize37()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_37))) {
errorsMsgList.add(prefix + SIZE_37 + suffix);
}
if (ObjectUtils.isNotEmpty(x.getSize38()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_38))) {
errorsMsgList.add(prefix + SIZE_38 + suffix);
}
if (ObjectUtils.isNotEmpty(x.getSize39()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_39))) {
errorsMsgList.add(prefix + SIZE_39 + suffix);
}
if (ObjectUtils.isNotEmpty(x.getSize40()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_40))) {
errorsMsgList.add(prefix + SIZE_40 + suffix);
}
if (ObjectUtils.isNotEmpty(x.getSize41()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_41))) {
errorsMsgList.add(prefix + SIZE_41 + suffix);
}
if (ObjectUtils.isNotEmpty(x.getSize42()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_42))) {
errorsMsgList.add(prefix + SIZE_42 + suffix);
}
if (ObjectUtils.isNotEmpty(x.getSize43()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_43))) {
errorsMsgList.add(prefix + SIZE_43 + suffix);
}
}
});
}
return new StoreProdDemandVerifyResDTO() {{
setErrorMsgList(errorsMsgList);
}};
}
/**
*
*
* @param storeProdDemandIds
* @param deleteDTO
* @return
*/
@Override
@Transactional
public int deleteStoreProductDemandByStoreProdDemandIds(Long[] storeProdDemandIds) {
return storeProdDemandMapper.deleteStoreProductDemandByStoreProdDemandIds(storeProdDemandIds);
public int deleteByStoreProdDemandIds(StoreProdDemandDeleteDTO deleteDTO) {
List<StoreProductDemandDetail> demandDetailList = Optional.ofNullable(this.storeProdDemandDetailMapper.selectList(new LambdaQueryWrapper<StoreProductDemandDetail>()
.eq(StoreProductDemandDetail::getStoreId, deleteDTO.getStoreId()).eq(StoreProductDemandDetail::getDelFlag, Constants.UNDELETED)
.in(StoreProductDemandDetail::getId, deleteDTO.getStoreProdDemandDetailIdList())))
.orElseThrow(() -> new ServiceException("需求单明细不存在!", HttpStatus.ERROR));
// 根据需求明细ID能否找到对应的入库与需求抵扣关系数据
List<StoreProductStorageDemandDeduct> deductList = this.storageDemandDeductMapper.selectList(new LambdaQueryWrapper<StoreProductStorageDemandDeduct>()
.in(StoreProductStorageDemandDeduct::getStoreProdDemandDetailId, deleteDTO.getStoreProdDemandDetailIdList())
.eq(StoreProductStorageDemandDeduct::getDelFlag, Constants.UNDELETED));
if (CollectionUtils.isEmpty(deductList)) {
// 标记需求详情列表中的所有记录为已删除
demandDetailList.forEach(x -> x.setDelFlag(Constants.DELETED));
// 批量更新需求详情列表中的所有记录
List<BatchResult> list = this.storeProdDemandDetailMapper.updateById(demandDetailList);
// 查询所有未删除的需求详情记录
List<StoreProductDemandDetail> allDemandDetailList = this.storeProdDemandDetailMapper.selectList(new LambdaQueryWrapper<StoreProductDemandDetail>()
.eq(StoreProductDemandDetail::getStoreId, deleteDTO.getStoreId())
.in(StoreProductDemandDetail::getStoreProdDemandId, demandDetailList.stream()
.map(StoreProductDemandDetail::getStoreProdDemandId).distinct().collect(Collectors.toList())));
// 将查询结果按需求ID分组
Map<Long, List<StoreProductDemandDetail>> demandGroupMap = allDemandDetailList.stream().collect(Collectors.groupingBy(StoreProductDemandDetail::getStoreProdDemandId));
// 遍历分组后的结果找出所有记录都被删除的需求ID
List<Long> deleteDemandIdList = new ArrayList<>();
demandGroupMap.forEach((demandId, tempDetailList) -> {
if (tempDetailList.stream().allMatch(x -> Objects.equals(x.getDelFlag(), Constants.DELETED))) {
deleteDemandIdList.add(demandId);
}
});
// 如果存在所有记录都被删除的需求ID则删除这些需求
if (CollectionUtils.isNotEmpty(deleteDemandIdList)) {
this.storeProdDemandMapper.deleteDemandList(deleteDemandIdList);
}
// 返回更新的需求详情记录数
return list.size();
} else {
// 按照入库单明细ID进行分组获取每个入库单明细对应的抵扣数量
Map<Long, List<StoreProductStorageDemandDeduct>> deductQuantityMap = deductList.stream().collect(Collectors
.groupingBy(StoreProductStorageDemandDeduct::getStoreProdDemandDetailId, Collectors.toList()));
// key 为入库单明细IDvalue 为该入库单明细对应的尺码与数量
Map<Long, Map<Integer, Integer>> deductSizeQuantityMap = new HashMap<>();
deductQuantityMap.forEach((demandDetailId, sizeDeductList) -> {
Map<Integer, Integer> sizeQuantityMap = new HashMap<>();
Integer size30Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_30)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_30, size30Quantity);
Integer size31Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_31)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_31, size31Quantity);
Integer size32Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_32)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_32, size32Quantity);
Integer size33Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_33)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_33, size33Quantity);
Integer size34Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_34)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_34, size34Quantity);
Integer size35Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_35)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_35, size35Quantity);
Integer size36Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_36)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_36, size36Quantity);
Integer size37Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_37)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_37, size37Quantity);
Integer size38Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_38)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_38, size38Quantity);
Integer size39Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_39)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_39, size39Quantity);
Integer size40Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_40)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_40, size40Quantity);
Integer size41Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_41)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_41, size41Quantity);
Integer size42Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_42)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_42, size42Quantity);
Integer size43Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_43)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_43, size43Quantity);
deductSizeQuantityMap.put(demandDetailId, sizeQuantityMap);
});
// 依次更新每个明细、每个尺码的数量
demandDetailList.forEach(demandDetail -> {
Integer quantity = 0;
Map<Integer, Integer> sizeQuantityMap = deductSizeQuantityMap.get(demandDetail.getId());
if (MapUtils.isEmpty(sizeQuantityMap)) {
return;
}
if (ObjectUtils.isNotEmpty(demandDetail.getSize30())) {
demandDetail.setSize30(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_30), 0));
quantity += demandDetail.getSize30();
}
if (ObjectUtils.isNotEmpty(demandDetail.getSize31())) {
demandDetail.setSize31(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_31), 0));
quantity += demandDetail.getSize31();
}
if (ObjectUtils.isNotEmpty(demandDetail.getSize32())) {
demandDetail.setSize32(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_32), 0));
quantity += demandDetail.getSize32();
}
if (ObjectUtils.isNotEmpty(demandDetail.getSize33())) {
demandDetail.setSize33(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_33), 0));
quantity += demandDetail.getSize33();
}
if (ObjectUtils.isNotEmpty(demandDetail.getSize34())) {
demandDetail.setSize34(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_34), 0));
quantity += demandDetail.getSize34();
}
if (ObjectUtils.isNotEmpty(demandDetail.getSize35())) {
demandDetail.setSize35(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_35), 0));
quantity += demandDetail.getSize35();
}
if (ObjectUtils.isNotEmpty(demandDetail.getSize36())) {
demandDetail.setSize36(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_36), 0));
quantity += demandDetail.getSize36();
}
if (ObjectUtils.isNotEmpty(demandDetail.getSize37())) {
demandDetail.setSize37(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_37), 0));
quantity += demandDetail.getSize37();
}
if (ObjectUtils.isNotEmpty(demandDetail.getSize38())) {
demandDetail.setSize38(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_38), 0));
quantity += demandDetail.getSize38();
}
if (ObjectUtils.isNotEmpty(demandDetail.getSize39())) {
demandDetail.setSize39(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_39), 0));
quantity += demandDetail.getSize39();
}
if (ObjectUtils.isNotEmpty(demandDetail.getSize40())) {
demandDetail.setSize40(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_40), 0));
quantity += demandDetail.getSize40();
}
if (ObjectUtils.isNotEmpty(demandDetail.getSize41())) {
demandDetail.setSize41(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_41), 0));
quantity += demandDetail.getSize41();
}
if (ObjectUtils.isNotEmpty(demandDetail.getSize42())) {
demandDetail.setSize42(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_42), 0));
quantity += demandDetail.getSize42();
}
if (ObjectUtils.isNotEmpty(demandDetail.getSize43())) {
demandDetail.setSize43(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_43), 0));
quantity += demandDetail.getSize43();
}
demandDetail
// 更新状态为已完成
.setDetailStatus(DemandStatus.PRODUCTION_COMPLETE.getValue())
// 更新数量为最新数量
.setQuantity(quantity);
});
this.storeProdDemandDetailMapper.updateById(demandDetailList);
// 有需求明细的抵扣关系,则将已完成的入库单数量变更为当前需求单数量 并将需求明细状态置为已完成
List<StoreProductDemandDetail> listAfterUpdate = this.storeProdDemandDetailMapper.selectList(new LambdaQueryWrapper<StoreProductDemandDetail>()
.in(StoreProductDemandDetail::getStoreProdDemandId, demandDetailList.stream().map(StoreProductDemandDetail::getStoreProdDemandId).collect(Collectors.toList()))
.eq(StoreProductDemandDetail::getDelFlag, Constants.UNDELETED));
Map<Long, List<StoreProductDemandDetail>> demandMap = listAfterUpdate.stream().collect(Collectors.groupingBy(StoreProductDemandDetail::getStoreProdDemandId));
List<Long> completeDemandIdList = new ArrayList<>();
demandMap.forEach((demandId, detailListAfterUpdate) -> {
if (detailListAfterUpdate.stream().allMatch(x -> Objects.equals(x.getDetailStatus(), DemandStatus.PRODUCTION_COMPLETE.getValue()))) {
completeDemandIdList.add(demandId);
}
});
if (CollectionUtils.isNotEmpty(completeDemandIdList)) {
this.storeProdDemandMapper.updateStatusByIds(completeDemandIdList);
}
return demandDetailList.size();
}
}
/**
*
*
*
* + + "码"
*
* @param storeProdDemandId
* @return
* @param detailDTO
* @return
*/
@Override
@Transactional
public int deleteStoreProductDemandByStoreProdDemandId(Long storeProdDemandId) {
return storeProdDemandMapper.deleteStoreProductDemandByStoreProdDemandId(storeProdDemandId);
private List<String> addErrorMsg(StoreProdDemandVerifyDTO.DetailDTO detailDTO) {
List<String> errorMsgList = new ArrayList<>();
final String prefix = detailDTO.getProdArtNum() + detailDTO.getColorName();
final String suffix = "码";
if (ObjectUtils.isNotEmpty(detailDTO.getSize30())) {
errorMsgList.add(prefix + SIZE_30 + suffix);
}
if (ObjectUtils.isNotEmpty(detailDTO.getSize31())) {
errorMsgList.add(prefix + SIZE_31 + suffix);
}
if (ObjectUtils.isNotEmpty(detailDTO.getSize32())) {
errorMsgList.add(prefix + SIZE_32 + suffix);
}
if (ObjectUtils.isNotEmpty(detailDTO.getSize33())) {
errorMsgList.add(prefix + SIZE_33 + suffix);
}
if (ObjectUtils.isNotEmpty(detailDTO.getSize34())) {
errorMsgList.add(prefix + SIZE_34 + suffix);
}
if (ObjectUtils.isNotEmpty(detailDTO.getSize35())) {
errorMsgList.add(prefix + SIZE_35 + suffix);
}
if (ObjectUtils.isNotEmpty(detailDTO.getSize36())) {
errorMsgList.add(prefix + SIZE_36 + suffix);
}
if (ObjectUtils.isNotEmpty(detailDTO.getSize37())) {
errorMsgList.add(prefix + SIZE_37 + suffix);
}
if (ObjectUtils.isNotEmpty(detailDTO.getSize38())) {
errorMsgList.add(prefix + SIZE_38 + suffix);
}
if (ObjectUtils.isNotEmpty(detailDTO.getSize39())) {
errorMsgList.add(prefix + SIZE_39 + suffix);
}
if (ObjectUtils.isNotEmpty(detailDTO.getSize40())) {
errorMsgList.add(prefix + SIZE_40 + suffix);
}
if (ObjectUtils.isNotEmpty(detailDTO.getSize41())) {
errorMsgList.add(prefix + SIZE_41 + suffix);
}
if (ObjectUtils.isNotEmpty(detailDTO.getSize42())) {
errorMsgList.add(prefix + SIZE_42 + suffix);
}
if (ObjectUtils.isNotEmpty(detailDTO.getSize43())) {
errorMsgList.add(prefix + SIZE_43 + suffix);
}
return errorMsgList;
}

View File

@ -13,10 +13,10 @@ import com.ruoyi.xkt.domain.StoreProductFile;
import com.ruoyi.xkt.domain.StoreProductStock;
import com.ruoyi.xkt.domain.SysFile;
import com.ruoyi.xkt.dto.storeProductFile.StoreProdMainPicDTO;
import com.ruoyi.xkt.dto.storeProductStock.StoreProdStockDTO;
import com.ruoyi.xkt.dto.storeProductStock.StoreProdStockPageDTO;
import com.ruoyi.xkt.dto.storeProductStock.StoreProdStockPageResDTO;
import com.ruoyi.xkt.dto.storeProductStock.StoreProdStockResDTO;
import com.ruoyi.xkt.dto.storeProductStock.StoreProdStockDTO;
import com.ruoyi.xkt.enums.FileType;
import com.ruoyi.xkt.mapper.StoreProductFileMapper;
import com.ruoyi.xkt.mapper.StoreProductStockMapper;
@ -136,7 +136,7 @@ public class StoreProductStockServiceImpl implements IStoreProductStockService {
/**
*
*
* @param storeId ID
* @param storeId ID
* @param storeProdStockId
* @return int
*/
@ -155,8 +155,8 @@ public class StoreProductStockServiceImpl implements IStoreProductStockService {
/**
*
*
* @param storeId ID
* @param updateStockList diff list
* @param storeId ID
* @param updateStockList diff list
* @param multiplierFactor 0 1
* @return int
*/
@ -319,8 +319,9 @@ public class StoreProductStockServiceImpl implements IStoreProductStockService {
/**
* diff
* @param stock
* @param adjustDTO diff
*
* @param stock
* @param adjustDTO diff
* @param isInCrease true false
* @return StoreProductStock
*/

View File

@ -35,6 +35,8 @@ import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
import static com.ruoyi.common.constant.Constants.*;
/**
* Service
*
@ -244,34 +246,34 @@ public class StoreProductStorageServiceImpl implements IStoreProductStorageServi
Map<Long, Map<Integer, Integer>> latestDeductSizeQuantityMap = new LinkedHashMap<>();
latestDeductMap.forEach((storeProdDemandDetailId, latestDeductList) -> {
Map<Integer, Integer> sizeQuantityMap = new LinkedHashMap<>();
Integer size30Quantity = latestDeductList.stream().filter(x -> x.getSize() == 30).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(30, size30Quantity);
Integer size31Quantity = latestDeductList.stream().filter(x -> x.getSize() == 31).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(31, size31Quantity);
Integer size32Quantity = latestDeductList.stream().filter(x -> x.getSize() == 32).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(32, size32Quantity);
Integer size33Quantity = latestDeductList.stream().filter(x -> x.getSize() == 33).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(33, size33Quantity);
Integer size34Quantity = latestDeductList.stream().filter(x -> x.getSize() == 34).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(34, size34Quantity);
Integer size35Quantity = latestDeductList.stream().filter(x -> x.getSize() == 35).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(35, size35Quantity);
Integer size36Quantity = latestDeductList.stream().filter(x -> x.getSize() == 36).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(36, size36Quantity);
Integer size37Quantity = latestDeductList.stream().filter(x -> x.getSize() == 37).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(37, size37Quantity);
Integer size38Quantity = latestDeductList.stream().filter(x -> x.getSize() == 38).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(38, size38Quantity);
Integer size39Quantity = latestDeductList.stream().filter(x -> x.getSize() == 39).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(39, size39Quantity);
Integer size40Quantity = latestDeductList.stream().filter(x -> x.getSize() == 40).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(40, size40Quantity);
Integer size41Quantity = latestDeductList.stream().filter(x -> x.getSize() == 41).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(41, size41Quantity);
Integer size42Quantity = latestDeductList.stream().filter(x -> x.getSize() == 42).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(42, size42Quantity);
Integer size43Quantity = latestDeductList.stream().filter(x -> x.getSize() == 43).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(43, size43Quantity);
Integer size30Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_30)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_30, size30Quantity);
Integer size31Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_31)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_31, size31Quantity);
Integer size32Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_32)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_32, size32Quantity);
Integer size33Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_33)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_33, size33Quantity);
Integer size34Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_34)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_34, size34Quantity);
Integer size35Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_35)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_35, size35Quantity);
Integer size36Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_36)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_36, size36Quantity);
Integer size37Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_37)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_37, size37Quantity);
Integer size38Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_38)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_38, size38Quantity);
Integer size39Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_39)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_39, size39Quantity);
Integer size40Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_40)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_40, size40Quantity);
Integer size41Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_41)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_41, size41Quantity);
Integer size42Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_42)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_42, size42Quantity);
Integer size43Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_43)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum);
sizeQuantityMap.put(SIZE_43, size43Quantity);
latestDeductSizeQuantityMap.put(storeProdDemandDetailId, sizeQuantityMap);
});
// 筛选出所有和本次需求单抵扣有关的需求单列表
@ -407,46 +409,46 @@ public class StoreProductStorageServiceImpl implements IStoreProductStorageServi
for (StoreProductStorageDetail storageDetail : detailList) {
Map<Integer, Integer> sizeStorageMap = new LinkedHashMap<>();
if (ObjectUtils.isNotEmpty(storageDetail.getSize30())) {
sizeStorageMap.put(30, storageDetail.getSize30());
sizeStorageMap.put(SIZE_30, storageDetail.getSize30());
}
if (ObjectUtils.isNotEmpty(storageDetail.getSize31())) {
sizeStorageMap.put(31, storageDetail.getSize31());
sizeStorageMap.put(SIZE_31, storageDetail.getSize31());
}
if (ObjectUtils.isNotEmpty(storageDetail.getSize32())) {
sizeStorageMap.put(32, storageDetail.getSize32());
sizeStorageMap.put(SIZE_32, storageDetail.getSize32());
}
if (ObjectUtils.isNotEmpty(storageDetail.getSize33())) {
sizeStorageMap.put(33, storageDetail.getSize33());
sizeStorageMap.put(SIZE_33, storageDetail.getSize33());
}
if (ObjectUtils.isNotEmpty(storageDetail.getSize34())) {
sizeStorageMap.put(34, storageDetail.getSize34());
sizeStorageMap.put(SIZE_34, storageDetail.getSize34());
}
if (ObjectUtils.isNotEmpty(storageDetail.getSize35())) {
sizeStorageMap.put(35, storageDetail.getSize35());
sizeStorageMap.put(SIZE_35, storageDetail.getSize35());
}
if (ObjectUtils.isNotEmpty(storageDetail.getSize36())) {
sizeStorageMap.put(36, storageDetail.getSize36());
sizeStorageMap.put(SIZE_36, storageDetail.getSize36());
}
if (ObjectUtils.isNotEmpty(storageDetail.getSize37())) {
sizeStorageMap.put(37, storageDetail.getSize37());
sizeStorageMap.put(SIZE_37, storageDetail.getSize37());
}
if (ObjectUtils.isNotEmpty(storageDetail.getSize38())) {
sizeStorageMap.put(38, storageDetail.getSize38());
sizeStorageMap.put(SIZE_38, storageDetail.getSize38());
}
if (ObjectUtils.isNotEmpty(storageDetail.getSize39())) {
sizeStorageMap.put(39, storageDetail.getSize39());
sizeStorageMap.put(SIZE_39, storageDetail.getSize39());
}
if (ObjectUtils.isNotEmpty(storageDetail.getSize40())) {
sizeStorageMap.put(40, storageDetail.getSize40());
sizeStorageMap.put(SIZE_40, storageDetail.getSize40());
}
if (ObjectUtils.isNotEmpty(storageDetail.getSize41())) {
sizeStorageMap.put(41, storageDetail.getSize41());
sizeStorageMap.put(SIZE_41, storageDetail.getSize41());
}
if (ObjectUtils.isNotEmpty(storageDetail.getSize42())) {
sizeStorageMap.put(42, storageDetail.getSize42());
sizeStorageMap.put(SIZE_42, storageDetail.getSize42());
}
if (ObjectUtils.isNotEmpty(storageDetail.getSize43())) {
sizeStorageMap.put(43, storageDetail.getSize43());
sizeStorageMap.put(SIZE_43, storageDetail.getSize43());
}
if (MapUtils.isNotEmpty(sizeStorageMap)) {
storageQuantityMap.put(storageDetail.getStoreProdColorId(), new LinkedHashMap<Long, Map<Integer, Integer>>() {{
@ -524,46 +526,46 @@ public class StoreProductStorageServiceImpl implements IStoreProductStorageServi
size43Deduct = this.handleSize43RequireQuantity(size43Deduct, size43DemandMap, demandDetail);
}
if (MapUtils.isNotEmpty(size30DemandMap)) {
sizeRequireMap.put(30, size30DemandMap);
sizeRequireMap.put(SIZE_30, size30DemandMap);
}
if (MapUtils.isNotEmpty(size31DemandMap)) {
sizeRequireMap.put(31, size31DemandMap);
sizeRequireMap.put(SIZE_31, size31DemandMap);
}
if (MapUtils.isNotEmpty(size32DemandMap)) {
sizeRequireMap.put(32, size32DemandMap);
sizeRequireMap.put(SIZE_32, size32DemandMap);
}
if (MapUtils.isNotEmpty(size33DemandMap)) {
sizeRequireMap.put(33, size33DemandMap);
sizeRequireMap.put(SIZE_33, size33DemandMap);
}
if (MapUtils.isNotEmpty(size34DemandMap)) {
sizeRequireMap.put(34, size34DemandMap);
sizeRequireMap.put(SIZE_34, size34DemandMap);
}
if (MapUtils.isNotEmpty(size35DemandMap)) {
sizeRequireMap.put(35, size35DemandMap);
sizeRequireMap.put(SIZE_35, size35DemandMap);
}
if (MapUtils.isNotEmpty(size36DemandMap)) {
sizeRequireMap.put(36, size36DemandMap);
sizeRequireMap.put(SIZE_36, size36DemandMap);
}
if (MapUtils.isNotEmpty(size37DemandMap)) {
sizeRequireMap.put(37, size37DemandMap);
sizeRequireMap.put(SIZE_37, size37DemandMap);
}
if (MapUtils.isNotEmpty(size38DemandMap)) {
sizeRequireMap.put(38, size38DemandMap);
sizeRequireMap.put(SIZE_38, size38DemandMap);
}
if (MapUtils.isNotEmpty(size39DemandMap)) {
sizeRequireMap.put(39, size39DemandMap);
sizeRequireMap.put(SIZE_39, size39DemandMap);
}
if (MapUtils.isNotEmpty(size40DemandMap)) {
sizeRequireMap.put(40, size40DemandMap);
sizeRequireMap.put(SIZE_40, size40DemandMap);
}
if (MapUtils.isNotEmpty(size41DemandMap)) {
sizeRequireMap.put(41, size41DemandMap);
sizeRequireMap.put(SIZE_41, size41DemandMap);
}
if (MapUtils.isNotEmpty(size42DemandMap)) {
sizeRequireMap.put(42, size42DemandMap);
sizeRequireMap.put(SIZE_42, size42DemandMap);
}
if (MapUtils.isNotEmpty(size43DemandMap)) {
sizeRequireMap.put(43, size43DemandMap);
sizeRequireMap.put(SIZE_43, size43DemandMap);
}
if (MapUtils.isNotEmpty(sizeRequireMap)) {
unDeductMap.put(storeProdColorId, sizeRequireMap);

View File

@ -97,5 +97,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</update>
<delete id="deleteDemandList" >
UPDATE store_product_demand SET del_flag = 2 WHERE id in
<foreach item="id" collection="deleteDemandIdList" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>