From b0c8ac235ca42b9b8145c1a59949969ee3300785 Mon Sep 17 00:00:00 2001 From: chenhao Date: Tue, 28 Oct 2025 15:34:22 +0800 Subject: [PATCH] =?UTF-8?q?feat(inventory):=20=E6=B7=BB=E5=8A=A0=E5=8F=91?= =?UTF-8?q?=E8=B4=A7=E6=98=8E=E7=BB=86=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增发货明细实体类 OmsInventoryDeliveryDetail 及其相关 Mapper、Service 实现 - 在 InventoryDeliveryController 中增加获取发货明细并传递至前端的功能 - 扩展 InventoryInfoMapper.xml 支持通过产品序列号列表查询库存信息 - 在 InventoryDeliveryServiceImpl 中实现保存发货明细逻辑,并在删除发货单时同步删除明细 - 增加应付单生成功能,初始化应付单基本信息 - 前端页面 view.html 更新以支持发货明细查询参数传递及显示逻辑调整 --- .../templates/inventory/delivery/view.html | 15 +++ .../InventoryDeliveryController.java | 6 + .../com/ruoyi/sip/domain/InventoryInfo.java | 1 + .../domain/OmsInventoryDeliveryDetail.java | 67 +++++++++++ .../OmsInventoryDeliveryDetailMapper.java | 67 +++++++++++ .../IOmsInventoryDeliveryDetailService.java | 72 ++++++++++++ .../impl/InventoryDeliveryServiceImpl.java | 28 ++++- .../impl/InventoryInfoServiceImpl.java | 5 + ...OmsInventoryDeliveryDetailServiceImpl.java | 110 ++++++++++++++++++ .../mapper/inventory/InventoryInfoMapper.xml | 6 + .../OmsInventoryDeliveryDetailMapper.xml | 80 +++++++++++++ 11 files changed, 455 insertions(+), 2 deletions(-) create mode 100644 ruoyi-sip/src/main/java/com/ruoyi/sip/domain/OmsInventoryDeliveryDetail.java create mode 100644 ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/OmsInventoryDeliveryDetailMapper.java create mode 100644 ruoyi-sip/src/main/java/com/ruoyi/sip/service/IOmsInventoryDeliveryDetailService.java create mode 100644 ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsInventoryDeliveryDetailServiceImpl.java create mode 100644 ruoyi-sip/src/main/resources/mapper/inventory/OmsInventoryDeliveryDetailMapper.xml diff --git a/ruoyi-admin/src/main/resources/templates/inventory/delivery/view.html b/ruoyi-admin/src/main/resources/templates/inventory/delivery/view.html index aa3896eb..ee662e91 100644 --- a/ruoyi-admin/src/main/resources/templates/inventory/delivery/view.html +++ b/ruoyi-admin/src/main/resources/templates/inventory/delivery/view.html @@ -74,6 +74,7 @@
+
@@ -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() }, diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/InventoryDeliveryController.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/InventoryDeliveryController.java index b0ba9577..d2f86611 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/InventoryDeliveryController.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/InventoryDeliveryController.java @@ -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"; } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/InventoryInfo.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/InventoryInfo.java index fd5f5793..7df373bd 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/InventoryInfo.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/InventoryInfo.java @@ -36,6 +36,7 @@ public class InventoryInfo extends BaseEntity /** 产品序列号 */ @Excel(name = "产品序列号") private String productSn; + private List productSnList; /** 库存状态(0 入库 1出库) */ @Excel(name = "库存状态(0 入库 1出库)") diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/OmsInventoryDeliveryDetail.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/OmsInventoryDeliveryDetail.java new file mode 100644 index 00000000..552a4259 --- /dev/null +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/OmsInventoryDeliveryDetail.java @@ -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(); + } +} diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/OmsInventoryDeliveryDetailMapper.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/OmsInventoryDeliveryDetailMapper.java new file mode 100644 index 00000000..56e991f3 --- /dev/null +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/OmsInventoryDeliveryDetailMapper.java @@ -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 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 detailList); + + void deleteOmsInventoryDeliveryDetailByDeliveryId(Long id); + + List selectOmsInventoryDeliveryDetailByDeliveryId(Long id); +} diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IOmsInventoryDeliveryDetailService.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IOmsInventoryDeliveryDetailService.java new file mode 100644 index 00000000..b34be959 --- /dev/null +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IOmsInventoryDeliveryDetailService.java @@ -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 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 detailList); + + void deleteOmsInventoryDeliveryDetailByDeliveryId(Long id); + /** + * 查询产品库存 + * + * @param id 产品库存主键 + * @return 产品库存 + */ + public List selectOmsInventoryDeliveryDetailByDeliveryId(Long id); +} diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/InventoryDeliveryServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/InventoryDeliveryServiceImpl.java index ee9484aa..2cdbd180 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/InventoryDeliveryServiceImpl.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/InventoryDeliveryServiceImpl.java @@ -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 detailList=new ArrayList<>(); if (CollUtil.isEmpty(productSnDataList)) { List 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); } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/InventoryInfoServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/InventoryInfoServiceImpl.java index d09b21e2..20f98ab3 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/InventoryInfoServiceImpl.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/InventoryInfoServiceImpl.java @@ -69,6 +69,11 @@ public class InventoryInfoServiceImpl implements IInventoryInfoService { return inventoryInfoMapper.selectInventoryInfoList(inventoryInfo); } + @Override + public List listByProductSnList(List productSnList) { + return Collections.emptyList(); + } + /** * 新增产品库存 * diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsInventoryDeliveryDetailServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsInventoryDeliveryDetailServiceImpl.java new file mode 100644 index 00000000..d2bc2d0e --- /dev/null +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsInventoryDeliveryDetailServiceImpl.java @@ -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 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 detailList) { + omsInventoryDeliveryDetailMapper.saveBatch(detailList); + } + + @Override + public void deleteOmsInventoryDeliveryDetailByDeliveryId(Long id) { + omsInventoryDeliveryDetailMapper.deleteOmsInventoryDeliveryDetailByDeliveryId(id); + } + + @Override + public List selectOmsInventoryDeliveryDetailByDeliveryId(Long id) { + return omsInventoryDeliveryDetailMapper.selectOmsInventoryDeliveryDetailByDeliveryId(id); + } +} diff --git a/ruoyi-sip/src/main/resources/mapper/inventory/InventoryInfoMapper.xml b/ruoyi-sip/src/main/resources/mapper/inventory/InventoryInfoMapper.xml index 2bb959d6..d4e8161e 100644 --- a/ruoyi-sip/src/main/resources/mapper/inventory/InventoryInfoMapper.xml +++ b/ruoyi-sip/src/main/resources/mapper/inventory/InventoryInfoMapper.xml @@ -39,6 +39,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and t1.product_sn = #{productSn} + and t1.product_sn in + + #{item} + + and t1.inventory_status = #{inventoryStatus} and t1.inner_code = #{innerCode} @@ -46,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and t1.warehouse_id = #{warehouseId} and t1.inner_price = #{innerPrice} and t1.outer_price = #{outerPrice} + diff --git a/ruoyi-sip/src/main/resources/mapper/inventory/OmsInventoryDeliveryDetailMapper.xml b/ruoyi-sip/src/main/resources/mapper/inventory/OmsInventoryDeliveryDetailMapper.xml new file mode 100644 index 00000000..ba225e9b --- /dev/null +++ b/ruoyi-sip/src/main/resources/mapper/inventory/OmsInventoryDeliveryDetailMapper.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + select id, delivery_id, product_sn from oms_inventory_delivery_detail + + + + + + + + + insert into oms_inventory_delivery_detail + + delivery_id, + product_sn, + + + #{deliveryId}, + #{productSn}, + + + + insert into oms_inventory_delivery_detail( delivery_id, product_sn) + values + + ( + #{item.deliveryId}, + #{item.productSn} + ) + + + + + update oms_inventory_delivery_detail + + delivery_id = #{deliveryId}, + product_sn = #{productSn}, + + where id = #{id} + + + + delete from oms_inventory_delivery_detail where id = #{id} + + + + delete from oms_inventory_delivery_detail where id in + + #{id} + + + + delete from oms_inventory_delivery_detail where delivery_id =#{id} + + + \ No newline at end of file