master:档口入库调整;

pull/1121/head
liujiang 2025-09-15 00:01:12 +08:00
parent 5d349ff9c9
commit 94100d8f46
13 changed files with 76 additions and 152 deletions

View File

@ -41,8 +41,8 @@ public class StoreProductStorageDetailController extends XktBaseController {
final IStoreProductStorageDetailService storageDetailService;
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,store')||@ss.hasSupplierSubRole()")
@ApiOperation(value = "打印入库单", httpMethod = "POST", response = R.class)
@Log(title = "打印入库单", businessType = BusinessType.EXPORT)
@ApiOperation(value = "导出入库单", httpMethod = "POST", response = R.class)
@Log(title = "导出入库单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, @Validated @RequestBody StoreStorageExportVO exportVO) throws UnsupportedEncodingException {
List<StoreStorageDetailDownloadDTO> downloadList = storageDetailService.export(BeanUtil.toBean(exportVO, StoreStorageExportDTO.class));

View File

@ -25,6 +25,8 @@ public class StoreProdStoragePageVO extends BasePageVO {
private Long storeId;
@ApiModelProperty(value = "商品货号")
private String prodArtNum;
@ApiModelProperty(value = "档口工厂ID")
private Long storeFactoryId;
@ApiModelProperty(value = "入库类型")
private Integer storageType;
@ApiModelProperty(value = "销售开始时间")

View File

@ -21,6 +21,12 @@ public class StoreStorageExportVO {
@NotNull(message = "storeId不能为空!")
@ApiModelProperty(value = "storeId", required = true)
private Long storeId;
@ApiModelProperty(value = "货号")
private String prodArtNum;
@ApiModelProperty(value = "入库类型 1 PROD_STORAGE 其它入库 2 OTHER_STORAGE 维修入库 3 REPAIR_STORAGE")
private Integer storageType;
@ApiModelProperty(value = "工厂名称")
private String facName;
@ApiModelProperty(value = "storeProdStorageId")
private List<Long> storeProdStorageIdList;
@ApiModelProperty(value = "导出开始时间")

View File

@ -30,6 +30,8 @@ public class StoreProdStorageDemandDeductVO {
private Date createTime;
@ApiModelProperty(name = "入库总数量")
private Integer quantity;
@ApiModelProperty(value = "工厂名称")
private String facName;
@ApiModelProperty(name = "生产成本金额")
private BigDecimal produceAmount;
@ApiModelProperty(name = "抵扣明细列表")

View File

@ -23,6 +23,8 @@ public class StoreProdStoragePageDTO extends BasePageDTO {
private Long storeId;
@ApiModelProperty(value = "商品货号")
private String prodArtNum;
@ApiModelProperty(value = "档口工厂ID")
private Long storeFactoryId;
@ApiModelProperty(value = "入库类型")
private Integer storageType;
@ApiModelProperty(value = "销售开始时间")

View File

@ -27,6 +27,8 @@ public class StoreProdStoragePageResDTO {
private Integer storageType;
@ApiModelProperty(value = "数量")
private Integer quantity;
@ApiModelProperty(value = "档口工厂名称")
private String facName;
@ApiModelProperty(value = "生产成本金额")
private BigDecimal produceAmount;
@ApiModelProperty(value = "操作人名称")

View File

@ -21,12 +21,14 @@ public class StoreStorageDetailDownloadDTO {
private Integer orderNum;
@Excel(name = "单据编号", needMerge = true)
private String code;
@Excel(name = "工厂名称", needMerge = true)
private String facName;
@Excel(name = "入库类型", readConverterExp = "1=生产入库,2=其它入库,3=维修入库", needMerge = true)
private Integer storageType;
@Excel(name = "出库日期", width = 30, dateFormat = "yyyy-MM-dd", needMerge = true)
private Date createTime;
@Excel(name = "总生产成本", needMerge = true)
private BigDecimal produceAmount;
@Excel(name = "结款状态", readConverterExp = "1=生产入库,2=其它入库,3=维修入库", needMerge = true)
private Integer storageType;
@Excel(name = "货号", needMerge = true)
private String prodArtNum;
@Excel(name = "颜色", needMerge = true)

View File

@ -19,6 +19,12 @@ public class StoreStorageExportDTO {
@ApiModelProperty(value = "storeId")
private Long storeId;
@ApiModelProperty(value = "货号")
private String prodArtNum;
@ApiModelProperty(value = "入库类型 1 PROD_STORAGE 其它入库 2 OTHER_STORAGE 维修入库 3 REPAIR_STORAGE")
private Integer storageType;
@ApiModelProperty(value = "工厂名称")
private String facName;
@ApiModelProperty(value = "storeProdStorageId")
private List<Long> storeProdStorageIdList;
@ApiModelProperty(value = "导出开始时间")

View File

@ -26,6 +26,8 @@ public class StoreProdStorageDemandDeductDTO {
private String storageCode;
@ApiModelProperty(name = "入库类型 1 PROD_STORAGE 其它入库 2 OTHER_STORAGE 维修入库 3 REPAIR_STORAGE")
private Integer storageType;
@ApiModelProperty(value = "工厂名称")
private String facName;
@ApiModelProperty(value = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;

View File

@ -14,58 +14,12 @@ import java.util.List;
* @date 2025-03-26
*/
public interface StoreProductStorageMapper extends BaseMapper<StoreProductStorage> {
/**
*
*
* @param id
* @return
*/
public StoreProductStorage selectStoreProductStorageByStoreProdStorId(Long id);
/**
*
*
* @param storeProductStorage
* @return
*/
public List<StoreProductStorage> selectStoreProductStorageList(StoreProductStorage storeProductStorage);
/**
*
*
* @param storeProductStorage
* @return
*/
public int insertStoreProductStorage(StoreProductStorage storeProductStorage);
/**
*
*
* @param storeProductStorage
* @return
*/
public int updateStoreProductStorage(StoreProductStorage storeProductStorage);
/**
*
*
* @param id
* @return
*/
public int deleteStoreProductStorageByStoreProdStorId(Long id);
/**
*
*
* @param storeProdStorIds
* @return
*/
public int deleteStoreProductStorageByStoreProdStorIds(Long[] storeProdStorIds);
/**
*
*
* @param storagePageDTO
* @return List<StoreProdStoragePageResDTO>
* @return List<StoreProdStoragePageResDTO>
*/
List<StoreProdStoragePageResDTO> selectStoragePage(StoreProdStoragePageDTO storagePageDTO);

View File

@ -6,10 +6,12 @@ import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.xkt.domain.StoreFactory;
import com.ruoyi.xkt.domain.StoreProductStorage;
import com.ruoyi.xkt.domain.StoreProductStorageDemandDeduct;
import com.ruoyi.xkt.domain.StoreProductStorageDetail;
import com.ruoyi.xkt.dto.storeProductStorageDemandDeduct.StoreProdStorageDemandDeductDTO;
import com.ruoyi.xkt.mapper.StoreFactoryMapper;
import com.ruoyi.xkt.mapper.StoreProductStorageDemandDeductMapper;
import com.ruoyi.xkt.mapper.StoreProductStorageDetailMapper;
import com.ruoyi.xkt.mapper.StoreProductStorageMapper;
@ -38,6 +40,7 @@ public class StoreProductStorageDemandDeducteServiceImpl implements IStoreProduc
final StoreProductStorageMapper prodStorageMapper;
final StoreProductStorageDetailMapper productStorageDetailMapper;
final StoreProductStorageDemandDeductMapper prodStorageDemandDeductMapper;
final StoreFactoryMapper storeFacMapper;
/**
@ -59,11 +62,14 @@ public class StoreProductStorageDemandDeducteServiceImpl implements IStoreProduc
.eq(StoreProductStorage::getCode, storageCode).eq(StoreProductStorage::getStoreId, storeId)
.eq(StoreProductStorage::getDelFlag, Constants.UNDELETED)))
.orElseThrow(() -> new ServiceException("档口商品入库不存在!", HttpStatus.ERROR));
// 获取仓库
StoreFactory storeFac = this.storeFacMapper.selectById(storage.getStoreFactoryId());
List<StoreProductStorageDetail> storageDetailList = this.productStorageDetailMapper.selectList(new LambdaQueryWrapper<StoreProductStorageDetail>()
.eq(StoreProductStorageDetail::getStoreProdStorId, storage.getId()).eq(StoreProductStorageDetail::getDelFlag, Constants.UNDELETED));
List<StoreProductStorageDemandDeduct> demandDeductList = this.prodStorageDemandDeductMapper.selectList(new LambdaQueryWrapper<StoreProductStorageDemandDeduct>()
.eq(StoreProductStorageDemandDeduct::getStorageCode, storageCode).eq(StoreProductStorageDemandDeduct::getDelFlag, Constants.UNDELETED));
StoreProdStorageDemandDeductDTO dto = BeanUtil.toBean(storage, StoreProdStorageDemandDeductDTO.class).setStorageCode(storageCode);
StoreProdStorageDemandDeductDTO dto = BeanUtil.toBean(storage, StoreProdStorageDemandDeductDTO.class).setStorageCode(storageCode)
.setFacName(ObjectUtils.isNotEmpty(storeFac) ? storeFac.getFacName() : "");
if (CollectionUtils.isEmpty(demandDeductList)) {
return dto;
}

View File

@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT
DENSE_RANK() OVER (ORDER BY sps.code, sps.create_time DESC) AS orderNum,
sps.`code`,
sf.fac_name,
sps.create_time,
sps.quantity,
sps.produce_amount,
@ -37,19 +38,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
COALESCE(spsd.size_42, 0) + COALESCE(spsd.size_43, 0) AS totalQuantity,
sps.operator_name
FROM
store_product_storage_detail spsd JOIN store_product_storage sps ON spsd.store_prod_stor_id = sps.id
store_product_storage_detail spsd
JOIN store_product_storage sps ON spsd.store_prod_stor_id = sps.id
JOIN store_factory sf ON sps.store_factory_id = sf.id
WHERE
spsd.del_flag = 0
AND sps.id IN
<foreach collection="storeProdStorageIdList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
<if test="prodArtNum != null and prodArtNum != ''">
AND spsd.prod_art_num LIKE CONCAT('%', #{prodArtNum}, '%')
</if>
<if test="facName != null and facName != ''">
AND sf.fac_name LIKE CONCAT('%', #{facName}, '%')
</if>
<if test="storageType != null">
AND sps.storage_type = #{storageType}
</if>
</select>
<select id="selectExportListVoucherDateBetween" resultType="com.ruoyi.xkt.dto.storeProdStorage.StoreStorageDetailDownloadDTO">
SELECT
DENSE_RANK() OVER (ORDER BY sps.code, sps.create_time DESC) AS orderNum,
sps.`code`,
sf.fac_name,
sps.create_time,
sps.quantity,
sps.produce_amount,
@ -79,10 +92,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
COALESCE(spsd.size_42, 0) + COALESCE(spsd.size_43, 0) AS totalQuantity,
sps.operator_name
FROM
store_product_storage_detail spsd JOIN store_product_storage sps ON spsd.store_prod_stor_id = sps.id
store_product_storage_detail spsd
JOIN store_product_storage sps ON spsd.store_prod_stor_id = sps.id
JOIN store_factory sf ON sps.store_factory_id = sf.id
WHERE
spsd.del_flag = 0
AND sps.voucher_date BETWEEN #{voucherDateStart} AND #{voucherDateEnd}
<if test="prodArtNum != null and prodArtNum != ''">
AND spsd.prod_art_num LIKE CONCAT('%', #{prodArtNum}, '%')
</if>
<if test="facName != null and facName != ''">
AND sf.fac_name LIKE CONCAT('%', #{facName}, '%')
</if>
<if test="storageType != null">
AND sps.storage_type = #{storageType}
</if>
</select>
</mapper>

View File

@ -3,111 +3,27 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.xkt.mapper.StoreProductStorageMapper">
<resultMap type="StoreProductStorage" id="StoreProductStorageResult">
<result property="id" column="id" />
<result property="code" column="code" />
<result property="storageType" column="storage_type" />
<result property="totalNum" column="total_num" />
<result property="totalProducePrice" column="total_produce_price" />
<result property="storageStatus" column="storage_status" />
<result property="version" column="version" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectStoreProductStorageVo">
select id, code, storage_type, total_num, total_produce_price, storage_status, version, del_flag, create_by, create_time, update_by, update_time from store_product_storage
</sql>
<select id="selectStoreProductStorageList" parameterType="StoreProductStorage" resultMap="StoreProductStorageResult">
<include refid="selectStoreProductStorageVo"/>
<where>
<if test="code != null and code != ''"> and code = #{code}</if>
<if test="storageType != null "> and storage_type = #{storageType}</if>
<if test="totalNum != null "> and total_num = #{totalNum}</if>
<if test="totalProducePrice != null "> and total_produce_price = #{totalProducePrice}</if>
<if test="storageStatus != null "> and storage_status = #{storageStatus}</if>
<if test="version != null "> and version = #{version}</if>
</where>
</select>
<select id="selectStoreProductStorageByStoreProdStorId" parameterType="Long" resultMap="StoreProductStorageResult">
<include refid="selectStoreProductStorageVo"/>
where id = #{id}
</select>
<insert id="insertStoreProductStorage" parameterType="StoreProductStorage" useGeneratedKeys="true" keyProperty="storeProdStorId">
insert into store_product_storage
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null and code != ''">code,</if>
<if test="storageType != null">storage_type,</if>
<if test="totalNum != null">total_num,</if>
<if test="totalProducePrice != null">total_produce_price,</if>
<if test="storageStatus != null">storage_status,</if>
<if test="version != null">version,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null and code != ''">#{code},</if>
<if test="storageType != null">#{storageType},</if>
<if test="totalNum != null">#{totalNum},</if>
<if test="totalProducePrice != null">#{totalProducePrice},</if>
<if test="storageStatus != null">#{storageStatus},</if>
<if test="version != null">#{version},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateStoreProductStorage" parameterType="StoreProductStorage">
update store_product_storage
<trim prefix="SET" suffixOverrides=",">
<if test="code != null and code != ''">code = #{code},</if>
<if test="storageType != null">storage_type = #{storageType},</if>
<if test="totalNum != null">total_num = #{totalNum},</if>
<if test="totalProducePrice != null">total_produce_price = #{totalProducePrice},</if>
<if test="storageStatus != null">storage_status = #{storageStatus},</if>
<if test="version != null">version = #{version},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteStoreProductStorageByStoreProdStorId" parameterType="Long">
delete from store_product_storage where id = #{id}
</delete>
<delete id="deleteStoreProductStorageByStoreProdStorIds" parameterType="String">
delete from store_product_storage where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectStoragePage" parameterType="com.ruoyi.xkt.dto.storeProdStorage.StoreProdStoragePageDTO" resultType="com.ruoyi.xkt.dto.storeProdStorage.StoreProdStoragePageResDTO">
<select id="selectStoragePage" parameterType="com.ruoyi.xkt.dto.storeProdStorage.StoreProdStoragePageDTO"
resultType="com.ruoyi.xkt.dto.storeProdStorage.StoreProdStoragePageResDTO">
SELECT
sps.id AS storeProdStorageId, sps.store_id, sps.`code`, sps.storage_type, sps.produce_amount, sps.quantity, sps.create_time, sps.operator_name
sps.id AS storeProdStorageId,
sps.store_id,
sps.`code`,
sps.storage_type,
sps.produce_amount,
sps.quantity,
sps.create_time,
sps.operator_name,
sf.fac_name
FROM
store_product_storage sps
join store_factory sf on sf.id = sps.store_factory_id
<if test="prodArtNum != null and prodArtNum != ''"> join store_product_storage_detail spsd on sps.id = spsd.store_prod_stor_id </if>
WHERE
sps.del_flag = 0 AND sps.store_id = #{storeId}
<if test="prodArtNum != null and prodArtNum != ''"> and spsd.prod_art_num like concat('%', #{prodArtNum}, '%')</if>
<if test="storeFactoryId != null"> and sf.id = #{storeFactoryId}</if>
<if test="storageType != null and storageType != ''"> and sps.storage_type = #{storageType} </if>
<if test="createTimeStart != null"> and sps.voucher_date &gt;= #{createTimeStart}</if>
<if test="createTimeEnd != null"> and sps.voucher_date &lt;= #{createTimeEnd}</if>