feat(inventory): 添加发货明细管理功能

- 新增发货明细实体类 OmsInventoryDeliveryDetail 及其相关 Mapper、Service 实现
- 在 InventoryDeliveryController 中增加获取发货明细并传递至前端的功能
- 扩展 InventoryInfoMapper.xml 支持通过产品序列号列表查询库存信息
- 在 InventoryDeliveryServiceImpl 中实现保存发货明细逻辑,并在删除发货单时同步删除明细
- 增加应付单生成功能,初始化应付单基本信息
- 前端页面 view.html 更新以支持发货明细查询参数传递及显示逻辑调整
dev_1.0.0
chenhao 2025-10-28 15:34:22 +08:00
parent 8b2372db42
commit b0c8ac235c
11 changed files with 455 additions and 2 deletions

View File

@ -74,6 +74,7 @@
</form>
<form id="query-product-sn">
<input type="hidden" name="inventoryStatus" value="1">
<input type="hidden" name="deliveryId" th:value="${inventoryDelivery.id}">
<input type="hidden" id="outCode" name="outerCode" th:value="${inventoryDelivery.outerCode}">
<input type="hidden" name="warehouseId" th:value="${inventoryDelivery.warehouseId}">
</form>
@ -106,7 +107,21 @@
id: 'bootstrap-table',
url: productPrefix + "/list",
modalName: "出库单",
queryParams: function (params) {
table.set(id);
var curParams = {
// 传递参数查询参数
pageSize: params.limit,
pageNum: params.offset / params.limit + 1,
searchValue: params.search,
orderByColumn: params.sort,
isAsc: params.order,
productSnList:[[${productSnList}]]
};
var currentId = $.common.isEmpty(table.options.formId) ? $('form').attr('id') : table.options.formId;
return $.extend(curParams, $.common.formToJSON(currentId));
},
onCheck: (row, $ele) => {
updateTotal()
},

View File

@ -2,9 +2,12 @@ package com.ruoyi.sip.controller;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollUtil;
import com.ruoyi.sip.domain.OmsInventoryDeliveryDetail;
import com.ruoyi.sip.service.IInventoryAuthService;
import com.ruoyi.sip.service.IOmsInventoryDeliveryDetailService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -34,6 +37,8 @@ public class InventoryDeliveryController extends BaseController
@Autowired
private IInventoryDeliveryService inventoryDeliveryService;
@Autowired
private IOmsInventoryDeliveryDetailService deliveryDetailServiceService;
@Autowired
private IInventoryAuthService inventoryAuthService;
@RequiresPermissions("inventory:delivery:view")
@ -124,6 +129,7 @@ public class InventoryDeliveryController extends BaseController
{
InventoryDelivery inventoryDelivery = inventoryDeliveryService.selectInventoryDeliveryById(id);
mmap.put("inventoryDelivery", inventoryDelivery);
mmap.put("productSnList", deliveryDetailServiceService.selectOmsInventoryDeliveryDetailByDeliveryId(id).stream().map(OmsInventoryDeliveryDetail::getProductSn).collect(Collectors.toList()));
return prefix + "/view";
}

View File

@ -36,6 +36,7 @@ public class InventoryInfo extends BaseEntity
/** 产品序列号 */
@Excel(name = "产品序列号")
private String productSn;
private List<String> productSnList;
/** 库存状态(0 入库 1出库) */
@Excel(name = "库存状态(0 入库 1出库)")

View File

@ -0,0 +1,67 @@
package com.ruoyi.sip.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* oms_inventory_delivery_detail
*
* @author ruoyi
* @date 2025-10-24
*/
public class OmsInventoryDeliveryDetail extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** */
private Long id;
/** 发货id */
@Excel(name = "发货id")
private Long deliveryId;
/** 产品序列号 */
@Excel(name = "产品序列号")
private String productSn;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setDeliveryId(Long deliveryId)
{
this.deliveryId = deliveryId;
}
public Long getDeliveryId()
{
return deliveryId;
}
public void setProductSn(String productSn)
{
this.productSn = productSn;
}
public String getProductSn()
{
return productSn;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("deliveryId", getDeliveryId())
.append("productSn", getProductSn())
.toString();
}
}

View File

@ -0,0 +1,67 @@
package com.ruoyi.sip.mapper;
import java.util.List;
import com.ruoyi.sip.domain.OmsInventoryDeliveryDetail;
/**
* Mapper
*
* @author ruoyi
* @date 2025-10-24
*/
public interface OmsInventoryDeliveryDetailMapper
{
/**
*
*
* @param id
* @return
*/
public OmsInventoryDeliveryDetail selectOmsInventoryDeliveryDetailById(Long id);
/**
*
*
* @param omsInventoryDeliveryDetail
* @return
*/
public List<OmsInventoryDeliveryDetail> selectOmsInventoryDeliveryDetailList(OmsInventoryDeliveryDetail omsInventoryDeliveryDetail);
/**
*
*
* @param omsInventoryDeliveryDetail
* @return
*/
public int insertOmsInventoryDeliveryDetail(OmsInventoryDeliveryDetail omsInventoryDeliveryDetail);
/**
*
*
* @param omsInventoryDeliveryDetail
* @return
*/
public int updateOmsInventoryDeliveryDetail(OmsInventoryDeliveryDetail omsInventoryDeliveryDetail);
/**
*
*
* @param id
* @return
*/
public int deleteOmsInventoryDeliveryDetailById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteOmsInventoryDeliveryDetailByIds(String[] ids);
void saveBatch(List<OmsInventoryDeliveryDetail> detailList);
void deleteOmsInventoryDeliveryDetailByDeliveryId(Long id);
List<OmsInventoryDeliveryDetail> selectOmsInventoryDeliveryDetailByDeliveryId(Long id);
}

View File

@ -0,0 +1,72 @@
package com.ruoyi.sip.service;
import java.util.List;
import com.ruoyi.sip.domain.OmsInventoryDeliveryDetail;
/**
* Service
*
* @author ruoyi
* @date 2025-10-24
*/
public interface IOmsInventoryDeliveryDetailService
{
/**
*
*
* @param id
* @return
*/
public OmsInventoryDeliveryDetail selectOmsInventoryDeliveryDetailById(Long id);
/**
*
*
* @param omsInventoryDeliveryDetail
* @return
*/
public List<OmsInventoryDeliveryDetail> selectOmsInventoryDeliveryDetailList(OmsInventoryDeliveryDetail omsInventoryDeliveryDetail);
/**
*
*
* @param omsInventoryDeliveryDetail
* @return
*/
public int insertOmsInventoryDeliveryDetail(OmsInventoryDeliveryDetail omsInventoryDeliveryDetail);
/**
*
*
* @param omsInventoryDeliveryDetail
* @return
*/
public int updateOmsInventoryDeliveryDetail(OmsInventoryDeliveryDetail omsInventoryDeliveryDetail);
/**
*
*
* @param ids
* @return
*/
public int deleteOmsInventoryDeliveryDetailByIds(String ids);
/**
*
*
* @param id
* @return
*/
public int deleteOmsInventoryDeliveryDetailById(Long id);
void saveBatch(List<OmsInventoryDeliveryDetail> detailList);
void deleteOmsInventoryDeliveryDetailByDeliveryId(Long id);
/**
*
*
* @param id
* @return
*/
public List<OmsInventoryDeliveryDetail> selectOmsInventoryDeliveryDetailByDeliveryId(Long id);
}

View File

@ -15,6 +15,7 @@ import com.ruoyi.sip.mapper.InventoryOuterMapper;
import com.ruoyi.sip.service.*;
import com.ruoyi.sip.vo.DeliveryInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import com.ruoyi.sip.mapper.InventoryDeliveryMapper;
import com.ruoyi.common.core.text.Convert;
@ -45,6 +46,14 @@ public class InventoryDeliveryServiceImpl implements IInventoryDeliveryService {
private IProjectOrderInfoService projectOrderInfoService;
@Autowired
private IProductInfoService productInfoService;
@Autowired
@Lazy
private IVendorInfoService vendorInfoService;
@Autowired
private IOmsInventoryDeliveryDetailService deliveryDetailService;
@Autowired
private IOmsPayableBillService payableBillService;
/**
*
@ -91,7 +100,7 @@ public class InventoryDeliveryServiceImpl implements IInventoryDeliveryService {
if (CollUtil.isEmpty(productSnList) && CollUtil.isEmpty(productSnDataList)) {
throw new ServiceException("发货清单为空,保存失败");
}
List<OmsInventoryDeliveryDetail> detailList=new ArrayList<>();
if (CollUtil.isEmpty(productSnDataList)) {
List<InventoryInfo> inventoryInfoList = productSnList.stream().map(item -> {
InventoryInfo info = new InventoryInfo();
@ -100,6 +109,10 @@ public class InventoryDeliveryServiceImpl implements IInventoryDeliveryService {
info.setInventoryStatus(InventoryInfo.InventoryStatusEnum.OUTER.getCode());
info.setUpdateBy(currentUserId);
info.setUpdateTime(nowDate);
OmsInventoryDeliveryDetail detail = new OmsInventoryDeliveryDetail();
detail.setProductSn(item);
detailList.add(detail);
return info;
}).collect(Collectors.toList());
inventoryInfoService.saveBatch(inventoryInfoList);
@ -109,10 +122,20 @@ public class InventoryDeliveryServiceImpl implements IInventoryDeliveryService {
inventoryInfo.setOuterCode(inventoryDelivery.getOuterCode());
inventoryInfo.setUpdateBy(currentUserId);
inventoryInfo.setUpdateTime(nowDate);
OmsInventoryDeliveryDetail detail = new OmsInventoryDeliveryDetail();
detail.setProductSn(inventoryInfo.getProductSn());
detailList.add(detail);
}
omsInventoryInnerService.importByOuter(productSnDataList,inventoryDelivery.getProductCode());
}
return inventoryDeliveryMapper.insertInventoryDelivery(inventoryDelivery);
int i = inventoryDeliveryMapper.insertInventoryDelivery(inventoryDelivery);
if (CollUtil.isNotEmpty(detailList)){
for (OmsInventoryDeliveryDetail detail : detailList) {
detail.setDeliveryId(inventoryDelivery.getId());
}
deliveryDetailService.saveBatch(detailList);
}
return i;
}
/**
@ -202,6 +225,7 @@ public class InventoryDeliveryServiceImpl implements IInventoryDeliveryService {
if (CollUtil.isNotEmpty(inventoryInfos)) {
inventoryInfoService.clearOutInfo(inventoryInfos.stream().map(InventoryInfo::getId).collect(Collectors.toList()));
}
deliveryDetailService.deleteOmsInventoryDeliveryDetailByDeliveryId(id);
return inventoryDeliveryMapper.deleteInventoryDeliveryById(id);
}

View File

@ -69,6 +69,11 @@ public class InventoryInfoServiceImpl implements IInventoryInfoService {
return inventoryInfoMapper.selectInventoryInfoList(inventoryInfo);
}
@Override
public List<InventoryInfo> listByProductSnList(List<String> productSnList) {
return Collections.emptyList();
}
/**
*
*

View File

@ -0,0 +1,110 @@
package com.ruoyi.sip.service.impl;
import java.util.Collections;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.sip.mapper.OmsInventoryDeliveryDetailMapper;
import com.ruoyi.sip.domain.OmsInventoryDeliveryDetail;
import com.ruoyi.sip.service.IOmsInventoryDeliveryDetailService;
import com.ruoyi.common.core.text.Convert;
/**
* Service
*
* @author ruoyi
* @date 2025-10-24
*/
@Service
public class OmsInventoryDeliveryDetailServiceImpl implements IOmsInventoryDeliveryDetailService
{
@Autowired
private OmsInventoryDeliveryDetailMapper omsInventoryDeliveryDetailMapper;
/**
*
*
* @param id
* @return
*/
@Override
public OmsInventoryDeliveryDetail selectOmsInventoryDeliveryDetailById(Long id)
{
return omsInventoryDeliveryDetailMapper.selectOmsInventoryDeliveryDetailById(id);
}
/**
*
*
* @param omsInventoryDeliveryDetail
* @return
*/
@Override
public List<OmsInventoryDeliveryDetail> selectOmsInventoryDeliveryDetailList(OmsInventoryDeliveryDetail omsInventoryDeliveryDetail)
{
return omsInventoryDeliveryDetailMapper.selectOmsInventoryDeliveryDetailList(omsInventoryDeliveryDetail);
}
/**
*
*
* @param omsInventoryDeliveryDetail
* @return
*/
@Override
public int insertOmsInventoryDeliveryDetail(OmsInventoryDeliveryDetail omsInventoryDeliveryDetail)
{
return omsInventoryDeliveryDetailMapper.insertOmsInventoryDeliveryDetail(omsInventoryDeliveryDetail);
}
/**
*
*
* @param omsInventoryDeliveryDetail
* @return
*/
@Override
public int updateOmsInventoryDeliveryDetail(OmsInventoryDeliveryDetail omsInventoryDeliveryDetail)
{
return omsInventoryDeliveryDetailMapper.updateOmsInventoryDeliveryDetail(omsInventoryDeliveryDetail);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteOmsInventoryDeliveryDetailByIds(String ids)
{
return omsInventoryDeliveryDetailMapper.deleteOmsInventoryDeliveryDetailByIds(Convert.toStrArray(ids));
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteOmsInventoryDeliveryDetailById(Long id)
{
return omsInventoryDeliveryDetailMapper.deleteOmsInventoryDeliveryDetailById(id);
}
@Override
public void saveBatch(List<OmsInventoryDeliveryDetail> detailList) {
omsInventoryDeliveryDetailMapper.saveBatch(detailList);
}
@Override
public void deleteOmsInventoryDeliveryDetailByDeliveryId(Long id) {
omsInventoryDeliveryDetailMapper.deleteOmsInventoryDeliveryDetailByDeliveryId(id);
}
@Override
public List<OmsInventoryDeliveryDetail> selectOmsInventoryDeliveryDetailByDeliveryId(Long id) {
return omsInventoryDeliveryDetailMapper.selectOmsInventoryDeliveryDetailByDeliveryId(id);
}
}

View File

@ -39,6 +39,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</if>
<if test="productSn != null and productSn != ''">and t1.product_sn = #{productSn}</if>
<if test="productSnList != null and productSnList != ''">and t1.product_sn in
<foreach item="item" index="index" collection="productSnList" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="inventoryStatus != null and inventoryStatus != ''">and t1.inventory_status = #{inventoryStatus}
</if>
<if test="innerCode != null and innerCode != ''">and t1.inner_code = #{innerCode}</if>
@ -46,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="warehouseId != null ">and t1.warehouse_id = #{warehouseId}</if>
<if test="innerPrice != null ">and t1.inner_price = #{innerPrice}</if>
<if test="outerPrice != null ">and t1.outer_price = #{outerPrice}</if>
</where>
</select>

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.sip.mapper.OmsInventoryDeliveryDetailMapper">
<resultMap type="OmsInventoryDeliveryDetail" id="OmsInventoryDeliveryDetailResult">
<result property="id" column="id" />
<result property="deliveryId" column="delivery_id" />
<result property="productSn" column="product_sn" />
</resultMap>
<sql id="selectOmsInventoryDeliveryDetailVo">
select id, delivery_id, product_sn from oms_inventory_delivery_detail
</sql>
<select id="selectOmsInventoryDeliveryDetailList" parameterType="OmsInventoryDeliveryDetail" resultMap="OmsInventoryDeliveryDetailResult">
<include refid="selectOmsInventoryDeliveryDetailVo"/>
<where>
<if test="deliveryId != null "> and delivery_id = #{deliveryId}</if>
<if test="productSn != null and productSn != ''"> and product_sn = #{productSn}</if>
</where>
</select>
<select id="selectOmsInventoryDeliveryDetailById" parameterType="Long" resultMap="OmsInventoryDeliveryDetailResult">
<include refid="selectOmsInventoryDeliveryDetailVo"/>
where id = #{id}
</select>
<select id="selectOmsInventoryDeliveryDetailByDeliveryId"
resultType="com.ruoyi.sip.domain.OmsInventoryDeliveryDetail">
<include refid="selectOmsInventoryDeliveryDetailVo"/>
where delivery_id = #{id}
</select>
<insert id="insertOmsInventoryDeliveryDetail" parameterType="OmsInventoryDeliveryDetail" useGeneratedKeys="true" keyProperty="id">
insert into oms_inventory_delivery_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deliveryId != null">delivery_id,</if>
<if test="productSn != null and productSn != ''">product_sn,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deliveryId != null">#{deliveryId},</if>
<if test="productSn != null and productSn != ''">#{productSn},</if>
</trim>
</insert>
<insert id="saveBatch">
insert into oms_inventory_delivery_detail( delivery_id, product_sn)
values
<foreach item="item" index="index" collection="list" separator=",">
(
<if test="item.deliveryId != null">#{item.deliveryId},</if>
<if test="item.productSn != null and item.productSn != ''">#{item.productSn}</if>
)
</foreach>
</insert>
<update id="updateOmsInventoryDeliveryDetail" parameterType="OmsInventoryDeliveryDetail">
update oms_inventory_delivery_detail
<trim prefix="SET" suffixOverrides=",">
<if test="deliveryId != null">delivery_id = #{deliveryId},</if>
<if test="productSn != null and productSn != ''">product_sn = #{productSn},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteOmsInventoryDeliveryDetailById" parameterType="Long">
delete from oms_inventory_delivery_detail where id = #{id}
</delete>
<delete id="deleteOmsInventoryDeliveryDetailByIds" parameterType="String">
delete from oms_inventory_delivery_detail where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteOmsInventoryDeliveryDetailByDeliveryId">
delete from oms_inventory_delivery_detail where delivery_id =#{id}
</delete>
</mapper>