| | |
| | | private Long createUser; |
| | | |
| | | /** |
| | | * true:去掉剩余库存为0 |
| | | */ |
| | | private Boolean flag; |
| | | |
| | | /** |
| | | * 入库类型 1-采购 2-生产 |
| | | */ |
| | | private Integer type; |
| | |
| | | */ |
| | | public interface CustomStorageMapper extends BaseMapper<CustomStorage> { |
| | | IPage<CustomStorage> listPageCopyByCustom(Page page,@Param("req") CustomStorage customStorageLambdaQueryWrapper); |
| | | |
| | | IPage<CustomStorage> listPageByCustom(Page page,@Param("req") CustomStorage customStorage); |
| | | } |
| | |
| | | @Data |
| | | public class CustomStorage { |
| | | |
| | | @TableField(exist = false) |
| | | private Boolean flag; |
| | | |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | |
| | | |
| | | @Override |
| | | public IPage<CustomStorage> listPageByCustom(Page page, CustomStorage customStorage) { |
| | | LambdaQueryWrapper<CustomStorage> customStorageLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | if(customStorage != null){ |
| | | if(!StringUtils.isEmpty(customStorage.getSupplierName())){ |
| | | customStorageLambdaQueryWrapper.like(CustomStorage::getSupplierName, customStorage.getSupplierName()); |
| | | } |
| | | // 筛选入库时间 |
| | | if(customStorage.getTimeStr() != null){ |
| | | customStorageLambdaQueryWrapper.eq(CustomStorage::getInboundDate, customStorage.getTimeStr()); |
| | | } |
| | | if(!StringUtils.isEmpty(customStorage.getProductCategory())){ |
| | | customStorageLambdaQueryWrapper.like(CustomStorage::getProductCategory, customStorage.getProductCategory()); |
| | | } |
| | | } |
| | | customStorageLambdaQueryWrapper.orderByDesc(CustomStorage::getInboundDate); |
| | | IPage<CustomStorage> procurementPageDtoIPage = customStorageMapper.selectPage(page, customStorageLambdaQueryWrapper); |
| | | // LambdaQueryWrapper<CustomStorage> customStorageLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | // if(customStorage != null){ |
| | | // if(!StringUtils.isEmpty(customStorage.getSupplierName())){ |
| | | // customStorageLambdaQueryWrapper.like(CustomStorage::getSupplierName, customStorage.getSupplierName()); |
| | | // } |
| | | // // 筛选入库时间 |
| | | // if(customStorage.getTimeStr() != null){ |
| | | // customStorageLambdaQueryWrapper.eq(CustomStorage::getInboundDate, customStorage.getTimeStr()); |
| | | // } |
| | | // if(!StringUtils.isEmpty(customStorage.getProductCategory())){ |
| | | // customStorageLambdaQueryWrapper.like(CustomStorage::getProductCategory, customStorage.getProductCategory()); |
| | | // } |
| | | // } |
| | | // customStorageLambdaQueryWrapper.orderByDesc(CustomStorage::getInboundDate); |
| | | IPage<CustomStorage> procurementPageDtoIPage = customStorageMapper.listPageByCustom(page, customStorage); |
| | | procurementPageDtoIPage.getRecords().forEach(item -> item.setInboundNum0(item.getInboundNum())); |
| | | List<CustomStorage> procurementPageDtos = procurementPageDtoIPage.getRecords(); |
| | | // 计算待入库数量 |
| | |
| | | } |
| | | |
| | | // 状态 = 数量和完工数量比较 |
| | | if(i.getSchedulingNum().compareTo(new BigDecimal(0)) == 0){ |
| | | if(i.getSuccessNum().compareTo(new BigDecimal(0)) == 0){ |
| | | i.setStatus("未开始"); |
| | | } else if(i.getQuantity().compareTo(i.getSchedulingNum()) <= 0){ |
| | | } else if(i.getQuantity().compareTo(i.getSuccessNum()) <= 0){ |
| | | i.setStatus("已完成"); |
| | | }else{ |
| | | i.setStatus("生产中"); |
| | |
| | | HAVING availableStock > 0 |
| | | order by t1.inbound_date desc |
| | | </select> |
| | | <select id="listPageByCustom" 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 |
| | | from custom_storage t1 |
| | | left join procurement_record_out t2 on t1.id = t2.procurement_record_storage_id and t2.type = 3 |
| | | <where> |
| | | <if test="req.productCategory != null and req.productCategory != ''"> |
| | | and t1.product_category like concat('%',#{req.productCategory},'%') |
| | | </if> |
| | | <if test="req.supplierName !=null and req.supplierName != ''"> |
| | | and t1.supplier_name like concat('%',#{req.supplierName},'%') |
| | | </if> |
| | | <if test="req.timeStr != null and req.timeStr != ''"> |
| | | and t1.inbound_date like concat('%',#{req.timeStr},'%') |
| | | </if> |
| | | </where> |
| | | group by t1.id |
| | | <if test="req.flag != null and req.flag"> |
| | | having availableStock > 0 |
| | | </if> |
| | | order by t1.inbound_date desc |
| | | </select> |
| | | </mapper> |
| | |
| | | t1.create_time, |
| | | t1.update_time, |
| | | t1.create_by, |
| | | t2.warn_num |
| | | t2.warn_num, |
| | | SUM(t1.inbound_num) - COALESCE(SUM(t4.inbound_num), 0) 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 |
| | | <if test="req.supplierName != null and req.supplierName != ''"> |
| | |
| | | and t1.create_time like concat('%',#{req.timeStr},'%') |
| | | </if> |
| | | </where> |
| | | group by t1.id |
| | | <if test="req.flag != null and req.flag"> |
| | | having availableStock > 0 |
| | | </if> |
| | | order by t1.create_time desc |
| | | </select> |
| | | <select id="list" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDto"> |
| | |
| | | t1.create_time, |
| | | t1.update_time, |
| | | t1.create_by, |
| | | t2.warn_num |
| | | t2.warn_num, |
| | | SUM(t1.inbound_num) - COALESCE(SUM(t4.inbound_num), 0) 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 t4.procurement_record_storage_id = t1.id and t1.type = 2 |
| | | <where> |
| | | t1.type = 2 |
| | | <if test="req.customerName != null and req.customerName != ''"> |
| | |
| | | and t1.create_time like concat('%',#{req.timeStr},'%') |
| | | </if> |
| | | </where> |
| | | group by t1.id |
| | | <if test="req.flag != null and req.flag"> |
| | | having availableStock > 0 |
| | | </if> |
| | | order by t1.create_time desc |
| | | </select> |
| | | <select id="listPageCopyByProduction" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDtoCopy"> |
| | |
| | | FORMAT(A.sales_tax_amount - A.purchase_tax_amount, 2) AS balance_amount |
| | | FROM ( |
| | | SELECT |
| | | sl.customer_contract_no, |
| | | sl.sales_contract_no as customerContractNo, |
| | | sl.id, |
| | | pl.id AS pl_id, |
| | | sl.customer_name, |
| | |
| | | LEFT JOIN |
| | | sales_ledger_product slp1 ON slp1.sales_ledger_id = pl.id AND slp1.type = 2 |
| | | GROUP BY |
| | | sl.customer_contract_no, sl.customer_name, sl.project_name, sl.id, pl.id |
| | | pl.id |
| | | HAVING |
| | | sl.customer_contract_no IS NOT NULL |
| | | customerContractNo IS NOT NULL |
| | | ) A |
| | | <where> |
| | | <if test="c.customerName != null and c.customerName != ''"> |