| | |
| | | |
| | | <select id="listPageCopyByCustom" resultType="com.ruoyi.procurementrecord.pojo.CustomStorage"> |
| | | select t1.*, |
| | | sum(t1.inbound_num) as inboundNum, |
| | | sum(t1.inbound_num) as inboundNum0, |
| | | sum(t1.tax_inclusive_total_price) as taxInclusiveTotalPrice, |
| | | SUM(t1.inbound_num) - COALESCE(SUM(t2.inbound_num), 0) AS availableStock |
| | | sum(t1.tax_inclusive_total_price) as totalPrice, |
| | | sum(t1.inbound_num) as inboundNum, |
| | | sum(t1.inbound_num) as inboundNum0, |
| | | SUM(t1.inbound_num) - COALESCE(SUM(t2.inbound_num), 0) AS availableStock |
| | | from custom_storage t1 |
| | | left join procurement_record_out t2 on t1.id = t2.procurement_record_storage_id and t2.type = 3 |
| | | <where> |
| | | t2.type = 3 |
| | | <if test="req.productCategory != null and req.productCategory != ''"> |
| | | and t1.product_category like concat('%',#{req.productCategory},'%') |
| | | </if> |
| | |
| | | sum(t1.inbound_num) as inboundNum, |
| | | sum(t1.inbound_num) as inboundNum0, |
| | | sum(t1.tax_inclusive_total_price) as taxInclusiveTotalPrice, |
| | | SUM(t1.inbound_num) - COALESCE(SUM(t2.inbound_num), 0) AS availableStock |
| | | (t1.inbound_num - COALESCE(SUM(t2.inbound_num), 0)) AS availableStock |
| | | from custom_storage t1 |
| | | left join procurement_record_out t2 on t1.id = t2.procurement_record_storage_id and t2.type = 3 |
| | | <where> |
| | | t2.type = 3 |
| | | <if test="req.productCategory != null and req.productCategory != ''"> |
| | | and t1.product_category like concat('%',#{req.productCategory},'%') |
| | | </if> |
| | |
| | | t1.update_time, |
| | | t1.create_by, |
| | | t2.warn_num, |
| | | SUM(t1.inbound_num) - COALESCE(SUM(t4.inbound_num), 0) AS availableStock |
| | | (t1.inbound_num - COALESCE(SUM(t4.inbound_num), 0)) / count(1) AS availableStock |
| | | from procurement_record_storage t1 |
| | | left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id and t2.type = 2 |
| | | left join purchase_ledger t3 on t3.id = t2.sales_ledger_id |
| | |
| | | t1.inbound_batches, |
| | | t1.unit_price as unitPrice, |
| | | sum(t1.total_price) as totalPrice, |
| | | sum(t1.inbound_num) as inboundNum, |
| | | sum(t1.inbound_num) as inboundNum0, |
| | | sum(t1.inbound_num) / COALESCE(count(1), 1) as inboundNum, |
| | | sum(t1.inbound_num) / COALESCE(count(1), 1) as inboundNum0, |
| | | t1.create_time, |
| | | t1.update_time, |
| | | t1.create_by, |
| | | t2.warn_num, |
| | | SUM(t1.inbound_num) - COALESCE(SUM(t4.inbound_num), 0) AS availableStock |
| | | (SUM(t1.inbound_num) - COALESCE(SUM(t4.inbound_num), 0)) / COALESCE(count(1), 1) AS availableStock |
| | | from procurement_record_storage t1 |
| | | left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id and t2.type = 2 |
| | | left join purchase_ledger t3 on t3.id = t2.sales_ledger_id |
| | | left join procurement_record_out t4 on t1.id = t4.procurement_record_storage_id and t4.type = 1 |
| | | <where> |
| | | t1.type = 1 |
| | | t1.type = 1 and t4.type = 1 |
| | | <if test="req.supplierName != null and req.supplierName != ''"> |
| | | and t3.supplier_name like concat('%',#{req.supplierName},'%') |
| | | </if> |
| | |
| | | t1.update_time, |
| | | t1.create_by, |
| | | t2.warn_num, |
| | | SUM(t1.inbound_num) - COALESCE(SUM(t4.inbound_num), 0) AS availableStock |
| | | (t1.inbound_num - COALESCE(SUM(t4.inbound_num), 0)) / count(1) AS availableStock |
| | | from procurement_record_storage t1 |
| | | left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id and t2.type = 1 |
| | | left join sales_ledger t3 on t3.id = t2.sales_ledger_id |
| | |
| | | t1.update_time, |
| | | t1.create_by, |
| | | t2.warn_num, |
| | | SUM(t1.inbound_num) - COALESCE(SUM(t4.inbound_num), 0) AS availableStock |
| | | SUM(t1.inbound_num) - COALESCE(SUM(t4.inbound_num), 0) / COALESCE(count(1), 1) AS availableStock |
| | | from procurement_record_storage t1 |
| | | left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id and t2.type = 1 |
| | | left join sales_ledger t3 on t3.id = t2.sales_ledger_id |
| | | left join procurement_record_out t4 on t1.id = t4.procurement_record_storage_id and t4.type = 2 |
| | | <where> |
| | | t1.type = 2 |
| | | t4.type = 2 and t1.type = 2 |
| | | <if test="req.customerName != null and req.customerName != ''"> |
| | | and t3.customer_name like concat('%',#{req.customerName},'%') |
| | | </if> |