master:扫描条码功能完善;
parent
f1afb2334d
commit
b738f2cd78
|
|
@ -5,13 +5,12 @@ import com.ruoyi.common.annotation.Log;
|
|||
import com.ruoyi.common.core.controller.XktBaseController;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.web.controller.xkt.vo.storeProdColorSize.StoreSaleSnResVO;
|
||||
import com.ruoyi.web.controller.xkt.vo.storeProdColorSize.StoreProdSnVO;
|
||||
import com.ruoyi.web.controller.xkt.vo.storeProdColorSize.StoreSaleSnVO;
|
||||
import com.ruoyi.web.controller.xkt.vo.storeProdColorSize.*;
|
||||
import com.ruoyi.xkt.dto.storeProdColorSize.StoreProdSnDTO;
|
||||
import com.ruoyi.xkt.dto.storeProdColorSize.StoreSaleSnDTO;
|
||||
import com.ruoyi.xkt.dto.storeProdColorSize.StoreStockTakingSnDTO;
|
||||
import com.ruoyi.xkt.service.IStoreProductColorSizeService;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
|
@ -27,7 +26,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
* @author ruoyi
|
||||
* @date 2025-03-26
|
||||
*/
|
||||
@ApiModel(value = "商品条码处理")
|
||||
@Api(tags = "商品条码处理")
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/rest/v1/prod-color-sizes")
|
||||
|
|
@ -44,19 +43,20 @@ public class StoreProductColorSizeController extends XktBaseController {
|
|||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,store')||@ss.hasSupplierSubRole()")
|
||||
@Log(title = "[商品入库、库存盘点]根据条码查询商品信息", businessType = BusinessType.INSERT)
|
||||
@ApiOperation(value = "[商品入库、库存盘点]根据条码查询商品信息", httpMethod = "POST", response = R.class)
|
||||
@PostMapping("/sn")
|
||||
public R<StoreSaleSnResVO> sn(@Validated @RequestBody StoreProdSnVO snVO) {
|
||||
return R.ok(BeanUtil.toBean(prodColorSizeService.sn(BeanUtil.toBean(snVO, StoreProdSnDTO.class)), StoreSaleSnResVO.class));
|
||||
@Log(title = "[商品入库]根据条码查询商品信息", businessType = BusinessType.INSERT)
|
||||
@ApiOperation(value = "[商品入库]根据条码查询商品信息", httpMethod = "POST", response = R.class)
|
||||
@PostMapping("/sn/storage")
|
||||
public R<StoreStorageSnResVO> storageSnList(@Validated @RequestBody StoreStorageSnVO snVO) {
|
||||
return R.ok(BeanUtil.toBean(prodColorSizeService.storageSnList(BeanUtil.toBean(snVO, StoreProdSnDTO.class)), StoreStorageSnResVO.class));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// TODO 档口扫描货号,获取商品信息
|
||||
// TODO 档口扫描货号,获取商品信息
|
||||
// TODO 档口扫描货号,获取商品信息
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,store')||@ss.hasSupplierSubRole()")
|
||||
@Log(title = "[库存盘点]根据条码查询商品信息", businessType = BusinessType.INSERT)
|
||||
@ApiOperation(value = "[库存盘点]根据条码查询商品信息", httpMethod = "POST", response = R.class)
|
||||
@PostMapping("/sn/stock")
|
||||
public R<StoreStockTakingSnResVO> stockTakingSnList(@Validated @RequestBody StoreStockTakingSnVO snVO) {
|
||||
return R.ok(BeanUtil.toBean(prodColorSizeService.stockTakingSnList(BeanUtil.toBean(snVO, StoreStockTakingSnDTO.class)), StoreStockTakingSnResVO.class));
|
||||
}
|
||||
|
||||
|
||||
// TODO 打印条码
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.ruoyi.web.controller.xkt.vo.storeProdColorSize;
|
|||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
|
@ -16,23 +17,30 @@ import java.util.List;
|
|||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class StoreSaleSnResVO {
|
||||
|
||||
@ApiModelProperty(value = "是否成功")
|
||||
private Boolean success;
|
||||
@ApiModelProperty(value = "档口商品ID")
|
||||
private Long storeProdId;
|
||||
@ApiModelProperty(value = "档口商品颜色尺码ID")
|
||||
private Long storeProdColorId;
|
||||
@ApiModelProperty(value = "颜色")
|
||||
private String colorName;
|
||||
@ApiModelProperty(value = "尺码")
|
||||
private Integer size;
|
||||
@ApiModelProperty(value = "商品货号")
|
||||
private String prodArtNum;
|
||||
@ApiModelProperty(value = "销售条码")
|
||||
private String sn;
|
||||
@ApiModelProperty(value = "销售单价")
|
||||
private BigDecimal price;
|
||||
@ApiModelProperty(value = "档口客户优惠金额")
|
||||
private BigDecimal discount;
|
||||
@ApiModelProperty(value = "错误列表")
|
||||
List<String> failList;
|
||||
@ApiModelProperty(value = "成功列表")
|
||||
List<SPSDetailVO> successList;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class SPSDetailVO {
|
||||
@ApiModelProperty(value = "档口商品ID")
|
||||
private Long storeProdId;
|
||||
@ApiModelProperty(value = "档口商品颜色尺码ID")
|
||||
private Long storeProdColorId;
|
||||
@ApiModelProperty(value = "档口颜色ID")
|
||||
private Long storeColorId;
|
||||
@ApiModelProperty(value = "颜色")
|
||||
private String colorName;
|
||||
@ApiModelProperty(value = "商品货号")
|
||||
private String prodArtNum;
|
||||
@ApiModelProperty(value = "生产价格")
|
||||
private BigDecimal producePrice;
|
||||
@ApiModelProperty(value = "尺码")
|
||||
private Integer size;
|
||||
@ApiModelProperty(value = "销售条码")
|
||||
private String sn;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.web.controller.xkt.vo.storeProdColorSize;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
@ -13,6 +14,7 @@ import javax.validation.constraints.NotNull;
|
|||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "档口销售条码查询model")
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class StoreSaleSnVO {
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
package com.ruoyi.web.controller.xkt.vo.storeProdColorSize;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class StoreStockTakingSnResVO {
|
||||
|
||||
@ApiModelProperty(value = "错误列表")
|
||||
List<String> failList;
|
||||
@ApiModelProperty(value = "成功列表")
|
||||
List<SSTSDetailVO> successList;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class SSTSDetailVO {
|
||||
@ApiModelProperty(value = "档口商品颜色尺码ID")
|
||||
private Long storeProdColorId;
|
||||
@ApiModelProperty(value = "颜色")
|
||||
private String colorName;
|
||||
@ApiModelProperty(value = "商品货号")
|
||||
private String prodArtNum;
|
||||
@ApiModelProperty(value = "尺码")
|
||||
private Integer size;
|
||||
@ApiModelProperty(value = "盘点库存")
|
||||
private Long stock;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.ruoyi.web.controller.xkt.vo.storeProdColorSize;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
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
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "库存条码查询model")
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class StoreStockTakingSnVO {
|
||||
|
||||
@NotNull(message = "档口ID不能为空!")
|
||||
@ApiModelProperty(value = "档口ID", required = true)
|
||||
private String storeId;
|
||||
@NotNull(message = "条码列表不能为空!")
|
||||
@ApiModelProperty(value = "条码列表", required = true)
|
||||
private List<String> snList;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package com.ruoyi.web.controller.xkt.vo.storeProdColorSize;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class StoreStorageSnResVO {
|
||||
|
||||
@ApiModelProperty(value = "错误列表")
|
||||
List<String> failList;
|
||||
@ApiModelProperty(value = "成功列表")
|
||||
List<SSSDetailVO> successList;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class SSSDetailVO {
|
||||
@ApiModelProperty(value = "档口商品颜色尺码ID")
|
||||
private Long storeProdColorId;
|
||||
@ApiModelProperty(value = "档口商品ID")
|
||||
private Long storeProdId;
|
||||
@ApiModelProperty(value = "档口颜色ID")
|
||||
private Long storeColorId;
|
||||
@ApiModelProperty(value = "颜色")
|
||||
private String colorName;
|
||||
@ApiModelProperty(value = "商品货号")
|
||||
private String prodArtNum;
|
||||
@ApiModelProperty(value = "生产价格")
|
||||
private BigDecimal producePrice;
|
||||
@ApiModelProperty(value = "尺码数量列表列表")
|
||||
List<SSSSizeCountVO> sizeCountList;
|
||||
}
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class SSSSizeCountVO {
|
||||
@ApiModelProperty(value = "尺码")
|
||||
private Integer size;
|
||||
@ApiModelProperty(value = "数量")
|
||||
private Long count;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.web.controller.xkt.vo.storeProdColorSize;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
@ -13,8 +14,9 @@ import java.util.List;
|
|||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "入库条码查询model")
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class StoreProdSnVO {
|
||||
public class StoreStorageSnVO {
|
||||
|
||||
@NotNull(message = "档口ID不能为空!")
|
||||
@ApiModelProperty(value = "档口ID", required = true)
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.ruoyi.xkt.dto.storeProdColorSize;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
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
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "库存条码查询model")
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class StoreStockTakingSnDTO {
|
||||
|
||||
@ApiModelProperty(value = "档口ID")
|
||||
private String storeId;
|
||||
@ApiModelProperty(value = "条码列表")
|
||||
private List<String> snList;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.ruoyi.xkt.dto.storeProdColorSize;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class StoreStockTakingSnResDTO {
|
||||
|
||||
@ApiModelProperty(value = "错误列表")
|
||||
List<String> failList;
|
||||
@ApiModelProperty(value = "成功列表")
|
||||
List<SSTSDetailDTO> successList;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class SSTSDetailDTO {
|
||||
@ApiModelProperty(value = "档口商品颜色尺码ID")
|
||||
private Long storeProdColorId;
|
||||
@ApiModelProperty(value = "颜色")
|
||||
private String colorName;
|
||||
@ApiModelProperty(value = "商品货号")
|
||||
private String prodArtNum;
|
||||
@ApiModelProperty(value = "尺码")
|
||||
private Integer size;
|
||||
@ApiModelProperty(value = "盘点库存")
|
||||
private Long stock;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.ruoyi.xkt.dto.storeProdColorSize;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class StoreStockTakingSnTempDTO {
|
||||
|
||||
@ApiModelProperty(value = "错误列表")
|
||||
List<String> failList;
|
||||
@ApiModelProperty(value = "成功列表")
|
||||
List<SSTSTDetailDTO> successList;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class SSTSTDetailDTO {
|
||||
@ApiModelProperty(value = "档口商品颜色尺码ID")
|
||||
private Long storeProdColorId;
|
||||
@ApiModelProperty(value = "颜色")
|
||||
private String colorName;
|
||||
@ApiModelProperty(value = "商品货号")
|
||||
private String prodArtNum;
|
||||
@ApiModelProperty(value = "条码前缀")
|
||||
private String prefixPart;
|
||||
@ApiModelProperty(value = "尺码")
|
||||
private Integer size;
|
||||
@ApiModelProperty(value = "盘点库存")
|
||||
private Long stock;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -14,35 +14,38 @@ import java.util.List;
|
|||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class StoreProdSnResDTO {
|
||||
public class StoreStorageSnDTO {
|
||||
|
||||
@ApiModelProperty(value = "错误列表")
|
||||
List<String> failList;
|
||||
@ApiModelProperty(value = "成功列表")
|
||||
List<SPSDetailDTO> successList;
|
||||
List<SSSDetailDTO> successList;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class SPSDetailDTO {
|
||||
@ApiModelProperty(value = "档口商品ID")
|
||||
private Long storeProdId;
|
||||
public static class SSSDetailDTO {
|
||||
|
||||
@ApiModelProperty(value = "档口商品颜色尺码ID")
|
||||
private Long storeProdColorId;
|
||||
@ApiModelProperty(value = "档口商品ID")
|
||||
private Long storeProdId;
|
||||
@ApiModelProperty(value = "档口颜色ID")
|
||||
private Long storeColorId;
|
||||
@ApiModelProperty(value = "颜色")
|
||||
private String colorName;
|
||||
@ApiModelProperty(value = "尺码")
|
||||
private Integer size;
|
||||
@ApiModelProperty(value = "商品货号")
|
||||
private String prodArtNum;
|
||||
@ApiModelProperty(value = "生产价格")
|
||||
private BigDecimal producePrice;
|
||||
@ApiModelProperty(value = "尺码")
|
||||
private Integer size;
|
||||
@ApiModelProperty(value = "条码前缀")
|
||||
private String snPrefix;
|
||||
private String prefixPart;
|
||||
@ApiModelProperty(value = "销售条码")
|
||||
private String sn;
|
||||
@ApiModelProperty(value = "销售单价")
|
||||
private BigDecimal price;
|
||||
@ApiModelProperty(value = "档口客户优惠金额")
|
||||
private BigDecimal discount;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
package com.ruoyi.xkt.dto.storeProdColorSize;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class StoreStorageSnResDTO {
|
||||
|
||||
@ApiModelProperty(value = "错误列表")
|
||||
List<String> failList;
|
||||
@ApiModelProperty(value = "成功列表")
|
||||
List<SSSDetailDTO> successList;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class SSSDetailDTO {
|
||||
|
||||
@ApiModelProperty(value = "档口商品颜色尺码ID")
|
||||
private Long storeProdColorId;
|
||||
@ApiModelProperty(value = "档口商品ID")
|
||||
private Long storeProdId;
|
||||
@ApiModelProperty(value = "档口颜色ID")
|
||||
private Long storeColorId;
|
||||
@ApiModelProperty(value = "颜色")
|
||||
private String colorName;
|
||||
@ApiModelProperty(value = "商品货号")
|
||||
private String prodArtNum;
|
||||
@ApiModelProperty(value = "生产价格")
|
||||
private BigDecimal producePrice;
|
||||
@ApiModelProperty(value = "尺码数量列表列表")
|
||||
List<SSSSizeCountDTO> sizeCountList;
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class SSSSizeCountDTO {
|
||||
@ApiModelProperty(value = "尺码")
|
||||
private Integer size;
|
||||
@ApiModelProperty(value = "数量")
|
||||
private Long count;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -3,8 +3,9 @@ package com.ruoyi.xkt.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.xkt.domain.StoreProductColorSize;
|
||||
import com.ruoyi.xkt.dto.storeProdColorSize.StoreProdSizeDTO;
|
||||
import com.ruoyi.xkt.dto.storeProdColorSize.StoreProdSnResDTO;
|
||||
import com.ruoyi.xkt.dto.storeProdColorSize.StoreSaleSnResDTO;
|
||||
import com.ruoyi.xkt.dto.storeProdColorSize.StoreStockTakingSnTempDTO;
|
||||
import com.ruoyi.xkt.dto.storeProdColorSize.StoreStorageSnDTO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
|
|
@ -55,10 +56,27 @@ public interface StoreProductColorSizeMapper extends BaseMapper<StoreProductColo
|
|||
StoreSaleSnResDTO selectOtherSn(@Param("snPrefix") String snPrefix, @Param("storeId") String storeId, @Param("storeCusId") Long storeCusId);
|
||||
|
||||
/**
|
||||
* 查询普通商品的条码信息
|
||||
* 获取档口商品入库的条码信息
|
||||
*
|
||||
* @param snList 条码列表
|
||||
* @return List<StoreProdSnsResDTO.SPSDetailDTO>
|
||||
* @param storeId 档口ID
|
||||
* @param buJuPrefixSnList 步橘网条码列表
|
||||
* @param otherPrefixSnList 其他系统条码列表
|
||||
* @return
|
||||
*/
|
||||
List<StoreProdSnResDTO.SPSDetailDTO> selectSnList(@Param("snList") List<String> snList, @Param("storeId") String storeId);
|
||||
List<StoreStorageSnDTO.SSSDetailDTO> selectStorageTotalSnList(@Param("storeId") String storeId,
|
||||
@Param("buJuPrefixSnList") List<String> buJuPrefixSnList,
|
||||
@Param("otherPrefixSnList") List<String> otherPrefixSnList);
|
||||
|
||||
/**
|
||||
* 获取档口商品盘点的条码信息
|
||||
*
|
||||
* @param storeId 档口ID
|
||||
* @param buJuPrefixSnList 步橘网条码列表
|
||||
* @param otherPrefixSnList 其他系统条码列表
|
||||
* @return
|
||||
*/
|
||||
List<StoreStockTakingSnTempDTO.SSTSTDetailDTO> selectStockSnList(@Param("storeId") String storeId,
|
||||
@Param("buJuPrefixSnList") List<String> buJuPrefixSnList,
|
||||
@Param("otherPrefixSnList") List<String> otherPrefixSnList);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
package com.ruoyi.xkt.service;
|
||||
|
||||
import com.ruoyi.xkt.dto.storeProdColorSize.StoreProdSnDTO;
|
||||
import com.ruoyi.xkt.dto.storeProdColorSize.StoreProdSnResDTO;
|
||||
import com.ruoyi.xkt.dto.storeProdColorSize.StoreSaleSnDTO;
|
||||
import com.ruoyi.xkt.dto.storeProdColorSize.StoreSaleSnResDTO;
|
||||
import com.ruoyi.xkt.dto.storeProdColorSize.*;
|
||||
|
||||
/**
|
||||
* 档口商品颜色的尺码Service接口
|
||||
|
|
@ -16,16 +13,24 @@ public interface IStoreProductColorSizeService {
|
|||
/**
|
||||
* 查询条码 对应的商品信息
|
||||
*
|
||||
* @param barcodeDTO 查询入参
|
||||
* @param snDTO 查询入参
|
||||
* @return StoreProdColorSizeBarcodeResDTO
|
||||
*/
|
||||
StoreSaleSnResDTO storeSaleSn(StoreSaleSnDTO barcodeDTO);
|
||||
StoreSaleSnResDTO storeSaleSn(StoreSaleSnDTO snDTO);
|
||||
|
||||
/**
|
||||
* 商品入库、库存盘点查询库存
|
||||
* 商品入库查询库存
|
||||
*
|
||||
* @param snsDTO 条码入参
|
||||
* @param snDTO 条码入参
|
||||
* @return StoreProdSnsResDTO
|
||||
*/
|
||||
StoreProdSnResDTO sn(StoreProdSnDTO snsDTO);
|
||||
StoreStorageSnResDTO storageSnList(StoreProdSnDTO snDTO);
|
||||
|
||||
/**
|
||||
* 库存盘点查询库存
|
||||
*
|
||||
* @param snDTO 条码入参
|
||||
* @return StoreStorageSnResDTO
|
||||
*/
|
||||
StoreStockTakingSnResDTO stockTakingSnList(StoreStockTakingSnDTO snDTO);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,22 +1,18 @@
|
|||
package com.ruoyi.xkt.service.impl;
|
||||
|
||||
import com.ruoyi.xkt.dto.storeProdColorSize.StoreProdSnDTO;
|
||||
import com.ruoyi.xkt.dto.storeProdColorSize.StoreProdSnResDTO;
|
||||
import com.ruoyi.xkt.dto.storeProdColorSize.StoreSaleSnDTO;
|
||||
import com.ruoyi.xkt.dto.storeProdColorSize.StoreSaleSnResDTO;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.ruoyi.xkt.dto.storeProdColorSize.*;
|
||||
import com.ruoyi.xkt.mapper.StoreProductColorSizeMapper;
|
||||
import com.ruoyi.xkt.mapper.StoreSaleDetailMapper;
|
||||
import com.ruoyi.xkt.service.IStoreProductColorSizeService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -35,6 +31,10 @@ public class StoreProductColorSizeServiceImpl implements IStoreProductColorSizeS
|
|||
|
||||
// 纯数字
|
||||
private static final Pattern POSITIVE_PATTERN = Pattern.compile("^\\d+$");
|
||||
// 步橘系统条码截止索引
|
||||
private static final Integer buJuEndIndex = 13;
|
||||
// 其它系统的条码截止索引
|
||||
private static final Integer otherSysEndIndex = 10;
|
||||
|
||||
/**
|
||||
* 查询条码 对应的商品信息
|
||||
|
|
@ -66,55 +66,100 @@ public class StoreProductColorSizeServiceImpl implements IStoreProductColorSizeS
|
|||
}
|
||||
|
||||
/**
|
||||
* 商品入库、库存盘点查询库存
|
||||
* 商品入库查询库存
|
||||
*
|
||||
* @param snDTO 条码入参
|
||||
* @return StoreProdSnsResDTO
|
||||
*/
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public StoreProdSnResDTO sn(StoreProdSnDTO snDTO) {
|
||||
public StoreStorageSnResDTO storageSnList(StoreProdSnDTO snDTO) {
|
||||
List<String> snList = snDTO.getSnList().stream().filter(s -> POSITIVE_PATTERN.matcher(s).matches()).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(snList)) {
|
||||
return new StoreStorageSnResDTO().setFailList(snDTO.getSnList());
|
||||
}
|
||||
// 非纯数字的条码
|
||||
List<String> failList = snDTO.getSnList().stream().filter(s -> !POSITIVE_PATTERN.matcher(s).matches()).collect(Collectors.toList());
|
||||
// 步橘网条码
|
||||
Set<String> buJuPrefixSnSet = snList.stream().filter(x -> x.startsWith(snDTO.getStoreId())).map(x -> x.substring(0, buJuEndIndex)).collect(Collectors.toSet());
|
||||
// 其它系统条码
|
||||
Set<String> otherPrefixSnSet = snList.stream().filter(x -> !x.startsWith(snDTO.getStoreId())).map(x -> x.substring(0, otherSysEndIndex)).collect(Collectors.toSet());
|
||||
// 根据条码查询数据库数据
|
||||
List<StoreStorageSnDTO.SSSDetailDTO> existList = this.prodColorSizeMapper
|
||||
.selectStorageTotalSnList(snDTO.getStoreId(), new ArrayList<>(buJuPrefixSnSet), new ArrayList<>(otherPrefixSnSet));
|
||||
// 数据库前缀对应的商品数量
|
||||
Map<String, StoreStorageSnDTO.SSSDetailDTO> existMap = existList.stream().collect(Collectors.toMap(StoreStorageSnDTO.SSSDetailDTO::getPrefixPart, x -> x));
|
||||
Set<StoreStorageSnResDTO.SSSDetailDTO> successSet = new HashSet<>();
|
||||
// 临时用来计数的list
|
||||
List<StoreStorageSnDTO.SSSDetailDTO> tempList = new ArrayList<>();
|
||||
snList.forEach(sn -> {
|
||||
String prefixPart = sn.startsWith(snDTO.getStoreId()) ? sn.substring(0, buJuEndIndex) : sn.substring(0, otherSysEndIndex);
|
||||
StoreStorageSnDTO.SSSDetailDTO exist = existMap.get(prefixPart);
|
||||
if (ObjectUtils.isNotEmpty(exist)) {
|
||||
tempList.add(exist);
|
||||
successSet.add(BeanUtil.toBean(exist, StoreStorageSnResDTO.SSSDetailDTO.class));
|
||||
} else {
|
||||
failList.add(sn);
|
||||
}
|
||||
});
|
||||
// 货号颜色对应的尺码数量map
|
||||
Map<Long, Map<Integer, Long>> prodSizeQuantityMap = tempList.stream().collect(Collectors.groupingBy(StoreStorageSnDTO.SSSDetailDTO::getStoreProdColorId, Collectors
|
||||
.groupingBy(StoreStorageSnDTO.SSSDetailDTO::getSize, Collectors.counting())));
|
||||
List<StoreStorageSnResDTO.SSSDetailDTO> successList = successSet.stream().map(x -> {
|
||||
// 商品颜色对应的尺码数量
|
||||
Map<Integer, Long> sizeQuantityMap = prodSizeQuantityMap.get(x.getStoreProdColorId());
|
||||
return MapUtils.isEmpty(sizeQuantityMap) ? x : x.setSizeCountList(sizeQuantityMap.entrySet().stream()
|
||||
.map(entry -> new StoreStorageSnResDTO.SSSSizeCountDTO().setSize(entry.getKey()).setCount(entry.getValue())).collect(Collectors.toList()));
|
||||
}).collect(Collectors.toList());
|
||||
return new StoreStorageSnResDTO().setSuccessList(successList).setFailList(failList);
|
||||
}
|
||||
|
||||
List<StoreProdSnResDTO.SPSDetailDTO> successList = new ArrayList<>();
|
||||
// 步橘网系统的条码
|
||||
List<String> snList = snDTO.getSnList().stream().filter(s -> POSITIVE_PATTERN.matcher(s).matches())
|
||||
.filter(x -> x.startsWith(snDTO.getStoreId())).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(snList)) {
|
||||
// 截取前13位 作为条码查询条件
|
||||
Set<String> pre13SnSet = snList.stream().map(x -> x.substring(0, 13)).collect(Collectors.toSet());
|
||||
List<StoreProdSnResDTO.SPSDetailDTO> existList = prodColorSizeMapper.selectSnList(new ArrayList<>(pre13SnSet), snDTO.getStoreId());
|
||||
Map<String, StoreProdSnResDTO.SPSDetailDTO> existMap = existList.stream().collect(Collectors.toMap(StoreProdSnResDTO.SPSDetailDTO::getSn, x -> x));
|
||||
snList.forEach(sn -> {
|
||||
String snPrefix = sn.substring(0, 13);
|
||||
StoreProdSnResDTO.SPSDetailDTO exist = existMap.get(snPrefix);
|
||||
if (ObjectUtils.isNotEmpty(exist)) {
|
||||
successList.add( exist.setSn(sn));
|
||||
} else {
|
||||
failList.add( sn);
|
||||
}
|
||||
});
|
||||
/**
|
||||
* 库存盘点查询库存
|
||||
*
|
||||
* @param snDTO 条码入参
|
||||
* @return StoreStorageSnResDTO
|
||||
*/
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public StoreStockTakingSnResDTO stockTakingSnList(StoreStockTakingSnDTO snDTO) {
|
||||
List<String> snList = snDTO.getSnList().stream().filter(s -> POSITIVE_PATTERN.matcher(s).matches()).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(snList)) {
|
||||
return new StoreStockTakingSnResDTO().setFailList(snDTO.getSnList());
|
||||
}
|
||||
// 其它系统的条码
|
||||
List<String> otherSnList = snDTO.getSnList().stream().filter(s -> POSITIVE_PATTERN.matcher(s).matches())
|
||||
.filter(x -> !x.startsWith(snDTO.getStoreId())).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(otherSnList)) {
|
||||
|
||||
// 从系统设置中获取,根据系统迁移时的配置
|
||||
final Integer otherSysEndIndex = 9;
|
||||
|
||||
// 截取前 xxx 位 作为条码查询条件
|
||||
Set<String> preIndexSnSet = snList.stream().map(x -> x.substring(0, otherSysEndIndex)).collect(Collectors.toSet());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return null;
|
||||
// 非纯数字的条码
|
||||
List<String> failList = snDTO.getSnList().stream().filter(s -> !POSITIVE_PATTERN.matcher(s).matches()).collect(Collectors.toList());
|
||||
// 步橘网条码
|
||||
Set<String> buJuPrefixSnSet = snList.stream().filter(x -> x.startsWith(snDTO.getStoreId())).map(x -> x.substring(0, buJuEndIndex)).collect(Collectors.toSet());
|
||||
// 其它系统条码
|
||||
Set<String> otherPrefixSnSet = snList.stream().filter(x -> !x.startsWith(snDTO.getStoreId())).map(x -> x.substring(0, otherSysEndIndex)).collect(Collectors.toSet());
|
||||
// 查询出的所有条码
|
||||
List<StoreStockTakingSnTempDTO.SSTSTDetailDTO> existList = this.prodColorSizeMapper.selectStockSnList(snDTO.getStoreId(),
|
||||
new ArrayList<>(buJuPrefixSnSet), new ArrayList<>(otherPrefixSnSet));
|
||||
Map<String, StoreStockTakingSnTempDTO.SSTSTDetailDTO> existMap = existList.stream().collect(Collectors.toMap(StoreStockTakingSnTempDTO.SSTSTDetailDTO::getPrefixPart, x -> x));
|
||||
// 唯一的 storeProdColorId + size
|
||||
Set<StoreStockTakingSnResDTO.SSTSDetailDTO> stockSet = new HashSet<>();
|
||||
// 获取数量的列表
|
||||
List<StoreStockTakingSnTempDTO.SSTSTDetailDTO> tempList = new ArrayList<>();
|
||||
snList.forEach(sn -> {
|
||||
String prefixPart = sn.startsWith(snDTO.getStoreId()) ? sn.substring(0, buJuEndIndex) : sn.substring(0, otherSysEndIndex);
|
||||
StoreStockTakingSnTempDTO.SSTSTDetailDTO exist = existMap.get(prefixPart);
|
||||
if (ObjectUtils.isNotEmpty(exist)) {
|
||||
tempList.add(exist);
|
||||
stockSet.add(BeanUtil.toBean(exist, StoreStockTakingSnResDTO.SSTSDetailDTO.class));
|
||||
} else {
|
||||
failList.add(sn);
|
||||
}
|
||||
});
|
||||
// 每个颜色对应的尺码数量map
|
||||
Map<Long, Map<Integer, Long>> prodSizeQuantityMap = tempList.stream().collect(Collectors.groupingBy(StoreStockTakingSnTempDTO.SSTSTDetailDTO::getStoreProdColorId,
|
||||
Collectors.groupingBy(StoreStockTakingSnTempDTO.SSTSTDetailDTO::getSize, Collectors.counting())));
|
||||
List<StoreStockTakingSnResDTO.SSTSDetailDTO> successList = stockSet.stream().map(stock -> {
|
||||
// 商品颜色对应的尺码数量
|
||||
Map<Integer, Long> sizeQuantityMap = prodSizeQuantityMap.get(stock.getStoreProdColorId());
|
||||
return MapUtils.isEmpty(sizeQuantityMap) ? stock : stock.setStock(sizeQuantityMap.get(stock.getSize()));
|
||||
}).collect(Collectors.toList());
|
||||
return new StoreStockTakingSnResDTO().setFailList(failList).setSuccessList(successList);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -127,17 +172,15 @@ public class StoreProductColorSizeServiceImpl implements IStoreProductColorSizeS
|
|||
StoreSaleSnResDTO barcodeResDTO;
|
||||
// 步橘网生成的条码
|
||||
if (snDTO.getSn().startsWith(snDTO.getStoreId())) {
|
||||
final String snsPrefix = snDTO.getSn().substring(0, 13);
|
||||
final String prefixPart = snDTO.getSn().substring(0, buJuEndIndex);
|
||||
// 查询数据库 获取条码对应的商品信息
|
||||
barcodeResDTO = prodColorSizeMapper.selectSn(snsPrefix, snDTO.getStoreId(), snDTO.getStoreCusId());
|
||||
barcodeResDTO = prodColorSizeMapper.selectSn(prefixPart, snDTO.getStoreId(), snDTO.getStoreCusId());
|
||||
} else {
|
||||
|
||||
// 从系统设置中获取,根据系统迁移时的配置
|
||||
final Integer otherSysEndIndex = 9;
|
||||
|
||||
final String snsPrefix = snDTO.getSn().substring(0, otherSysEndIndex);
|
||||
final String prefixPart = snDTO.getSn().substring(0, otherSysEndIndex);
|
||||
// 查询数据库 获取条码对应的商品信息
|
||||
barcodeResDTO = prodColorSizeMapper.selectOtherSn(snsPrefix, snDTO.getStoreId(), snDTO.getStoreCusId());
|
||||
barcodeResDTO = prodColorSizeMapper.selectOtherSn(prefixPart, snDTO.getStoreId(), snDTO.getStoreCusId());
|
||||
}
|
||||
return ObjectUtils.isEmpty(barcodeResDTO) ? new StoreSaleSnResDTO().setSuccess(Boolean.FALSE).setSn(snDTO.getSn())
|
||||
: barcodeResDTO.setSuccess(Boolean.TRUE).setSn(snDTO.getSn());
|
||||
|
|
|
|||
|
|
@ -61,29 +61,96 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND sp.store_id = #{storeId}
|
||||
</select>
|
||||
|
||||
<select id="selectSnList">
|
||||
<select id="selectStorageTotalSnList">
|
||||
SELECT
|
||||
spcs.store_prod_id,
|
||||
spc.id AS storeProdColorId,
|
||||
spcs.store_color_id,
|
||||
sp.produce_price,
|
||||
spc.color_name,
|
||||
spcs.size,
|
||||
sp.prod_art_num,
|
||||
spcs.sn_prefix AS prefixPart
|
||||
FROM
|
||||
store_product_color_size spcs
|
||||
JOIN store_product sp ON spcs.store_prod_id = sp.id
|
||||
JOIN store_product_color spc ON spcs.store_color_id = spc.store_color_id AND spcs.store_prod_id = spc.store_prod_id AND spc.del_flag = 0
|
||||
WHERE
|
||||
spcs.del_flag = 0
|
||||
AND sp.store_id = #{storeId}
|
||||
<if test="buJuPrefixSnList != null and buJuPrefixSnList.size() > 0">
|
||||
AND spcs.sn_prefix IN
|
||||
<foreach item="item" index="index" collection="buJuPrefixSnList" separator="," open="(" close=")" >
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
spcs.store_prod_id,
|
||||
spc.id AS storeProdColorId,
|
||||
spcs.store_color_id,
|
||||
sp.produce_price,
|
||||
spc.color_name,
|
||||
spcs.size,
|
||||
sp.prod_art_num,
|
||||
spcs.other_sn_prefix AS prefixPart
|
||||
FROM
|
||||
store_product_color_size spcs
|
||||
JOIN store_product sp ON spcs.store_prod_id = sp.id
|
||||
JOIN store_product_color spc ON spcs.store_color_id = spc.store_color_id AND spcs.store_prod_id = spc.store_prod_id AND spc.del_flag = 0
|
||||
WHERE
|
||||
spcs.del_flag = 0
|
||||
AND sp.store_id = #{storeId}
|
||||
<if test="otherPrefixSnList != null and otherPrefixSnList.size() > 0">
|
||||
AND spcs.other_sn_prefix IN
|
||||
<foreach item="item" index="index" collection="otherPrefixSnList" separator="," open="(" close=")" >
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectStockSnList">
|
||||
SELECT
|
||||
spc.id AS storeProdColorId,
|
||||
spc.color_name,
|
||||
spcs.size,
|
||||
sp.prod_art_num,
|
||||
spcp.price,
|
||||
spcs.sn_prefix,
|
||||
( SELECT discount FROM store_customer_product_discount WHERE store_cus_id = #{storeCusId} AND store_prod_color_id = spc.id AND del_flag = 0 ) AS discount
|
||||
spcs.sn_prefix AS prefixPart
|
||||
FROM
|
||||
store_product_color_size spcs
|
||||
LEFT JOIN store_product_color_price spcp ON spcs.store_prod_id = spcp.store_prod_id AND spcs.store_color_id = spcp.store_color_id AND spcp.del_flag = 0
|
||||
LEFT JOIN store_product sp ON spcs.store_prod_id = sp.id
|
||||
LEFT JOIN store_product_color spc ON spcs.store_color_id = spc.store_color_id AND spcs.store_prod_id = spc.store_prod_id AND spc.del_flag = 0
|
||||
JOIN store_product sp ON spcs.store_prod_id = sp.id
|
||||
JOIN store_product_color spc ON spcs.store_color_id = spc.store_color_id AND spcs.store_prod_id = spc.store_prod_id AND spc.del_flag = 0
|
||||
WHERE
|
||||
spcs.del_flag = 0
|
||||
AND sp.store_id = #{storeId}
|
||||
AND spcs.sn_prefix IN
|
||||
<foreach item="item" index="index" collection="snList" separator="," open="(" close=")" >
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="buJuPrefixSnList != null and buJuPrefixSnList.size() > 0">
|
||||
AND spcs.sn_prefix IN
|
||||
<foreach item="item" index="index" collection="buJuPrefixSnList" separator="," open="(" close=")" >
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
spc.id AS storeProdColorId,
|
||||
spc.color_name,
|
||||
spcs.size,
|
||||
sp.prod_art_num,
|
||||
spcs.other_sn_prefix AS prefixPart
|
||||
FROM
|
||||
store_product_color_size spcs
|
||||
JOIN store_product sp ON spcs.store_prod_id = sp.id
|
||||
JOIN store_product_color spc ON spcs.store_color_id = spc.store_color_id AND spcs.store_prod_id = spc.store_prod_id AND spc.del_flag = 0
|
||||
WHERE
|
||||
spcs.del_flag = 0
|
||||
<if test="otherPrefixSnList != null and otherPrefixSnList.size() > 0">
|
||||
AND spcs.other_sn_prefix IN
|
||||
<foreach item="item" index="index" collection="otherPrefixSnList" separator="," open="(" close=")" >
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue