fix:1.仓储物流区分原材料/成品
2.生产订单/报工领料优化
| | |
| | | } |
| | | // 如果有数据先加库存 |
| | | ProductOrder productOrder = productOrderMapper.selectById(productOrderDto.getId()); |
| | | if (productOrder != null) { |
| | | if (productOrder.getDrawMaterials() != null) { |
| | | List<DrawMaterialDto> materialDtoList = JSON.parseArray(productOrder.getDrawMaterials(), DrawMaterialDto.class); |
| | | for (DrawMaterialDto drawMaterialDto : materialDtoList) { |
| | | stockUtils.addStock(drawMaterialDto.getProductModelId(), drawMaterialDto.getRequisitionQty(), null, productOrderDto.getId(), |
| | |
| | | throw new RuntimeException("生产订单不存在"); |
| | | } |
| | | |
| | | |
| | | Product product = productMapper.selectById(productModel.getProductId()); |
| | | QualityInspect qualityInspect = new QualityInspect(); |
| | | qualityInspect.setProductId(product.getId()); |
| | |
| | | if(!"已发货".equals(byId.getStatus())){ |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(byId.getSalesLedgerProductId()); |
| | | stockUtils.substractStock(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), |
| | | StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), req.getId(),null,null |
| | | StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), req.getId(),salesLedgerProduct.getBatchNo(),salesLedgerProduct.getCustomer() |
| | | ); |
| | | } |
| | | byId.setExpressNumber(req.getExpressNumber()); |
| | |
| | | private Long productId; // 产品ID |
| | | private Long parentId; // 父级产品ID |
| | | private Long productModelId; // 产品型号ID |
| | | private String productScope; //产品类型 |
| | | } |
| | |
| | | T1.supplier_name, |
| | | SUM(contract_amount) AS invoiceAmount, |
| | | IFNULL( SUM(T2.current_payment_amount) , 0 ) AS paymentAmount, |
| | | IFNULL((IFNULL(SUM(contract_amount),0) - IFNULL(SUM(T2.current_payment_amount),0)),0) AS payableAmount, |
| | | IFNULL((IFNULL(SUM(contract_amount),0) - IFNULL(SUM(T2.current_payment_amount),0)),0) AS payableAmount, |
| | | T1.purchase_contract_number, |
| | | T2.payment_date |
| | | FROM purchase_ledger T1 |
| | |
| | | T1.supplier_name LIKE CONCAT ('%',#{req.supplierName},'%') |
| | | </if> |
| | | </where> |
| | | GROUP BY T1.purchase_contract_number,T2.payment_date |
| | | GROUP BY |
| | | T1.supplier_id, |
| | | T1.supplier_name, |
| | | T1.purchase_contract_number, |
| | | T2.payment_date |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | T1.customer_name, |
| | | SUM(contract_amount) AS invoice_total, |
| | | IFNULL( SUM(T2.receipt_payment_amount) , 0 ) AS receipt_payment_amount, |
| | | IFNULL((IFNULL(SUM(contract_amount),0) - IFNULL(SUM(T2.receipt_payment_amount),0)),0) AS unReceipt_payment_amount |
| | | IFNULL((IFNULL(SUM(contract_amount),0) - IFNULL(SUM(T2.receipt_payment_amount),0)),0) AS unReceipt_payment_amount |
| | | FROM sales_ledger T1 |
| | | LEFT JOIN receipt_payment T2 ON T1.id = T2.sales_ledger_id |
| | | <where> |
| | |
| | | T1.customer_name LIKE CONCAT ('%',#{invoiceLedgerDto.searchText},'%') |
| | | </if> |
| | | </where> |
| | | GROUP BY T1.customer_name |
| | | GROUP BY T1.customer_id, T1.customer_name |
| | | </select> |
| | | |
| | | <select id="invoiceLedgerProductInfo" resultType="com.ruoyi.sales.dto.InvoiceRegistrationProductDto"> |
| | |
| | | <if test="req.productCategory != null and req.productCategory != ''"> |
| | | AND slp.product_category = #{req.productCategory} |
| | | </if> |
| | | <!-- 按产品大类分组聚合 --> |
| | | GROUP BY slp.product_category |
| | | GROUP BY |
| | | slp.product_category, |
| | | slp.specification_model, |
| | | sl.supplier_name |
| | | <!-- 按产品大类排序 --> |
| | | ORDER BY slp.product_category |
| | | </select> |
| | |
| | | where product_model_id = #{ew.productModelId} and qualitity >= #{ew.qualitity} |
| | | </update> |
| | | <select id="pagestockInventory" resultType="com.ruoyi.stock.dto.StockInventoryDto"> |
| | | select si.id, |
| | | SELECT |
| | | si.id, |
| | | si.qualitity, |
| | | COALESCE(si.locked_quantity, 0) as locked_quantity, |
| | | COALESCE(si.locked_quantity, 0) AS locked_quantity, |
| | | si.product_model_id, |
| | | si.create_time, |
| | | si.update_time, |
| | | COALESCE(si.warn_num, 0) as warn_num, |
| | | COALESCE(si.warn_num, 0) AS warn_num, |
| | | si.version, |
| | | (si.qualitity - COALESCE(si.locked_quantity, 0)) as un_locked_quantity, |
| | | (si.qualitity - COALESCE(si.locked_quantity, 0)) AS un_locked_quantity, |
| | | pm.model, |
| | | si.remark, |
| | | pm.unit, |
| | | pm.uid_no as uidNo, |
| | | pm.uid_no AS uidNo, |
| | | p.product_name, |
| | | si.batch_no, |
| | | si.customer |
| | | from stock_inventory si |
| | | left join product_model pm on si.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | where 1 = 1 |
| | | <if test="ew.productName != null and ew.productName !=''"> |
| | | and p.product_name like concat('%',#{ew.productName},'%') |
| | | </if> |
| | | FROM |
| | | stock_inventory si |
| | | LEFT JOIN product_model pm ON si.product_model_id = pm.id |
| | | LEFT JOIN product p ON pm.product_id = p.id |
| | | LEFT JOIN product p1 ON p.parent_id = p1.id |
| | | <where> |
| | | <if test="ew.productName != null and ew.productName != ''"> |
| | | AND p.product_name LIKE CONCAT('%', #{ew.productName}, '%') |
| | | </if> |
| | | <if test="ew.model != null and ew.model != ''"> |
| | | AND pm.model LIKE CONCAT('%', #{ew.model}, '%') |
| | | </if> |
| | | <if test="ew.uidNo != null and ew.uidNo != ''"> |
| | | AND pm.uid_no LIKE CONCAT('%', #{ew.uidNo}, '%') |
| | | </if> |
| | | <if test="ew.batchNo != null and ew.batchNo != ''"> |
| | | AND si.batch_no LIKE CONCAT('%', #{ew.batchNo}, '%') |
| | | </if> |
| | | <if test="ew.productScope != null and ew.productScope != ''"> |
| | | <choose> |
| | | <when test="ew.productScope == '成品'"> |
| | | AND p1.product_name = #{ew.productScope} |
| | | </when> |
| | | <otherwise> |
| | | AND p1.product_name != '成品' |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="listStockInventoryExportData" resultType="com.ruoyi.stock.execl.StockInventoryExportData"> |
| | | select si.qualitity, |
| | |
| | | LEFT JOIN product_model pm ON si.product_model_id = pm.id |
| | | LEFT JOIN product p ON pm.product_id = p.id |
| | | LEFT JOIN product p1 ON p1.id = p.parent_id |
| | | WHERE |
| | | p1.product_name = '原材料'; |
| | | <if test="ew.batchNo != null and ew.batchNo !=''"> |
| | | and si.batch_no like concat('%',#{ew.batchNo},'%') |
| | | </if> |
| | | <if test="ew.customer != null and ew.customer !=''"> |
| | | and si.customer like concat('%',#{ew.customer},'%') |
| | | </if> |
| | | <where> |
| | | <if test="ew.batchNo != null and ew.batchNo !=''"> |
| | | and si.batch_no like concat('%',#{ew.batchNo},'%') |
| | | </if> |
| | | <if test="ew.customer != null and ew.customer !=''"> |
| | | and si.customer like concat('%',#{ew.customer},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="getStockInventoryAll" resultType="com.ruoyi.stock.dto.StockInventoryDto"> |