fix(sales&stock): 修复销售台账与库存查询的多处业务问题
- 修复销售台账产品过滤逻辑,新增"已发货"状态的匹配,
确保已发货订单也能在台账中展示,涉及 SalesLedgerServiceImpl
- 修复销售台账Mapper查询条件,将发货状态筛选从单值改为
支持"审核通过"和"已发货",同时新增客户名称模糊查询功能,
涉及 SalesLedgerMapper.xml
- 修复库存盘点查询的数值精度问题,对库存、出入库汇总字段
统一保留6位小数并处理空值为0,涉及 StockInventoryMapper.xml
- 补充 ShippingInfoServiceImpl 中缺失的 Collectors 导入
| | |
| | | product.setExpressNumber(shippingInfo.getExpressNumber()); |
| | | } |
| | | } |
| | | // 过滤只保留发货记录 |
| | | products = products.stream().filter(product -> "审核通过".equals(product.getShippingStatus())).collect(Collectors.toList()); |
| | | // 过滤只保留已发货记录 |
| | | products = products.stream().filter(product -> "审核通过".equals(product.getShippingStatus()) || "已发货".equals(product.getShippingStatus())).collect(Collectors.toList()); |
| | | if (!products.isEmpty()) { |
| | | salesLedger.setHasChildren(true); |
| | | salesLedger.setProductData(products); |
| | |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | sales_ledger sl |
| | | left join sales_ledger_product slp on sl.id = slp.sales_ledger_id |
| | | left join shipping_info si on slp.id = si.sales_ledger_product_id |
| | | where si.status = '审核通过' |
| | | where si.status in ('审核通过', '已发货') |
| | | <if test="ew.customerId != null and ew.customerId != '' "> |
| | | and sl.customer_id = #{ew.customerId} |
| | | </if> |
| | | <if test="ew.customerName != null and ew.customerName != '' "> |
| | | and sl.customer_name like concat('%', #{ew.customerName}, '%') |
| | | </if> |
| | | order by sl.execution_date desc |
| | | </select> |
| | | |
| | |
| | | group by batch_no, product_model_id, model, unit, product_name, product_id |
| | | </select> |
| | | <select id="stockInventoryPage" resultType="com.ruoyi.stock.dto.StockInRecordDto"> |
| | | select sir.*,si.qualitity as current_stock, |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name, |
| | | su.nick_name as create_by |
| | | select sir.*, |
| | | ROUND(COALESCE(si.qualitity, 0), 6) as current_stock, |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name, |
| | | su.nick_name as create_by |
| | | from |
| | | stock_in_record sir |
| | | left join stock_inventory si on sir.batch_no = si.batch_no |
| | |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name, |
| | | MAX(current_inventory) as current_stock, |
| | | SUM(CASE WHEN record_type = 'in' THEN amount ELSE 0 END) as total_stock_in, |
| | | SUM(CASE WHEN record_type = 'out' THEN amount ELSE 0 END) as total_stock_out |
| | | ROUND(MAX(current_inventory), 6) as current_stock, |
| | | ROUND(SUM(CASE WHEN record_type = 'in' THEN amount ELSE 0 END), 6) as total_stock_in, |
| | | ROUND(SUM(CASE WHEN record_type = 'out' THEN amount ELSE 0 END), 6) as total_stock_out |
| | | FROM ( |
| | | SELECT |
| | | product_model_id, |