数据仓库实践:使用 SQL 计算材料BOM成本单价

背景

在制造业财务数据分析建设过程中,有时需要通过BOM汇总计算材料的单价,一般会有采购核价,库存成本,还有下阶材料单价按用量汇总得到的单价参与。

这些单价来源一般会根据优先级获取并在计算后作为最终的BOM 单价结果。参与财务三大报表中的损益表计算。

获取数据:采购核价、币种和汇率

采购核价

核价一般会包括成品和底层材料,而且优先级一般会比较高,所以这里直接使用核价的方式设置一个成品的单价,以用于测试。

采购核价

库存成本

除了采购核价外,库存成本一般是覆盖范围比较广的单价,能够覆盖到最底层的大量材料料号。

这里我们在初始化时设置最底层材料成本时,将使用库存成本金额。

库存成本

币种

为了兼容多个货币和地区,价格会有一个字段表示币种。金额则是此币种的单价金额。

同时需要带上一个汇率明细。以满足各个币种单价金额的汇算。

币种汇率

获取数据:BOM汇总结构

初始化时使用核价和成本单间仍然不能完全覆盖企业内使用的所有的材料,尤其是BOM结构复杂、材料料号过多的情况下。

所以一般情况下,企业会使用BOM关系,将材料的单价汇总计算到上阶材料。

本文将使用 bom 结构重新汇总后的BOM数据分析维度,具体可见:

数据仓库实践:使用SQL汇总BOM数据分析维度 http://t.csdnimg.cn/gZ1pS

部分 dim_bom 结构

部分BOM

初始化

使用BOM关联并计算核价和成本单价

insert into dw_mt_bom_unit_price_mview(material_code_prod,material_code,currency_cost,price_cost_ori,price_cost,currency_verify,price_verify_ori,price_verify,price_calculate)
select *
from (with tmp_prod as (select material_code                                  material_code_prod,material_code,null                                           currency_cost,null                                        as price_cost_ori,null                                        as price_cost,c.currency_verify,c.price_verify                              as price_verify_ori,d.exchange_rate * IFNULL(c.price_verify, 0) as price_verify,null                                           price_calculatefrom (select distinct bom_subordinate.product_code as material_code# BOM 中只在 product_code 字段存在 不在 material_code 存在代表 该物料没有上阶物料 推断出本身是成品from (select product_codefrom dim_bom) bom_subordinateleft join (select material_codefrom dim_bom) bom_superioron bom_subordinate.product_code = bom_superior.material_codewhere bom_superior.material_code is null) a# 采购核价left join(SELECT material_code mat_code,currency      currency_verify,amount_price  price_verifyFROM clip_ods.price_verify) con a.material_code = c.mat_code# 汇率left join (select currency_transaction,exchange_ratefrom clip_ods.currency_exchangewhere currency_base = 'CNY') don c.currency_verify = d.currency_transaction),tmp_mat as (select product_code                                                                 material_code_prod,material_code,currency_cost,price_cost                                                                as price_cost_ori,case when price_cost is null then 0 else price_cost * e.exchange_rate end as price_cost,currency_verify,price_verify                                                              as price_verify_ori,casewhen price_verify is null then 0else price_verify * d.exchange_rate end                               as price_verify,casewhen price_cost is not null then price_cost * e.exchange_ratewhen price_verify is not null then price_verify * d.exchange_rateelse 0 end                                                               price_calculatefrom (select a.product_code,a.material_codefrom (select distinct bom_superior.product_code,bom_superior.material_codefrom (select product_code,material_codefrom dim_bom) bom_superiorleft join (select product_codefrom dim_bom) bom_subordinateon bom_superior.material_code = bom_subordinate.product_codewhere bom_subordinate.product_code is null) ainner join(select distinct bom_subordinate.product_code prod_codefrom (select product_codefrom dim_bom) bom_subordinateleft join (select material_codefrom dim_bom) bom_superioron bom_subordinate.product_code = bom_superior.material_codewhere bom_superior.material_code is null) bon a.product_code = b.prod_code) aleft join(SELECT material_code mat_code,currency      currency_cost,# 库存成本amount_price  price_costfrom clip_ods.price_cost) bon a.material_code = b.mat_codeleft join(SELECT material_code mat_code,currency      currency_verify,# 核价amount_price  price_verifyFROM clip_ods.price_verify) con a.material_code = c.mat_codeleft join (select currency_transaction,exchange_ratefrom clip_ods.currency_exchangewhere currency_base = 'CNY') don c.currency_verify = d.currency_transactionleft join (select currency_transaction,exchange_ratefrom clip_ods.currency_exchangewhere currency_base = 'CNY') eon b.currency_cost = e.currency_transaction),tmp_semi as (select productid                                                                    material_code_prod,material_code,currency_cost,price_cost                                                                as price_cost_ori,case when price_cost is null then 0 else price_cost * e.exchange_rate end as price_cost,currency_verify,price_verify                                                              as price_verify_ori,casewhen price_verify is null then 0else price_verify * d.exchange_rate end                               as price_verify,price_cost * e.exchange_rate                                                 price_calculatefrom (select a.productid,a.material_codefrom (select b.productid,b.material_codefrom (select distinct a.productidfrom (select product_code productidfrom dim_bom) aleft join (select material_code subprodidfrom dim_bom) bon a.productid = b.subprodidwhere b.subprodid is null) ainner join (select distinct product_code productid,material_codefrom dim_bom) bon a.productid = b.productid) aleft join (select material_code_prod,material_codefrom tmp_matwhere price_calculate is not null) bon a.material_code = b.material_codeand a.productid = b.material_code_prodwhere b.material_code is null) aleft join(SELECT material_code mat_code,currency      currency_cost,# 库存成本amount_price  price_costfrom clip_ods.price_cost) bon a.material_code = b.mat_codeleft join(SELECT material_code mat_code,currency      currency_verify,# 核价amount_price  price_verifyFROM clip_ods.price_verify) con a.material_code = c.mat_codeleft join (select currency_transaction,exchange_ratefrom clip_ods.currency_exchangewhere currency_base = 'CNY') don c.currency_verify = d.currency_transactionleft join (select currency_transaction,exchange_ratefrom clip_ods.currency_exchangewhere currency_base = 'CNY') eon b.currency_cost = e.currency_transaction)select material_code_prod,material_code,currency_cost,price_cost_ori,price_cost,currency_verify,price_verify_ori,price_verify,price_calculatefrom tmp_produnionselect material_code_prod,material_code,currency_cost,price_cost_ori,price_cost,currency_verify,price_verify_ori,price_verify,price_calculatefrom tmp_matunionselect material_code_prod,material_code,currency_cost,price_cost_ori,price_cost,currency_verify,price_verify_ori,price_verify,price_calculatefrom tmp_semi) initial_tmp

按BOM结构汇总

从最底层材料向上汇总,这里需要保证所有的最底层材料都有初始化后的单价,即使单价值为0;

因为如果下阶材料单价为空(Null), 系统将无法判断此空值(Null)是否有意义,

而且,系统和开发人员所处的角色自身没有权限决定【单价为空时设置为0】,因为有可能这个单价另有其他来源。

如果财务相关对接人员有确定为空时单价设置为0,则应该在初始化时设置为0;

同时【下阶材料单价为空时不汇总】这一操作会在递归汇总中作为判断【该材料的下阶材料是否在之前的递归过程中计算完成】的标准;

最底层材料为空则会导致此材料所有的上阶材料【等待此材料计算出单价值后参与上阶材料的计算】;

insert into dw_mt_bom_unit_price_mview(material_code_prod,material_code,currency_cost,price_cost_ori,price_cost,currency_verify,price_verify_ori,price_verify,price_calculate)
select material_code_prod,material_code,currency_cost,price_cost_ori,price_cost,currency_verify,price_verify_ori,price_verify,price_calculate
from (select material_code_prod,a.material_code,currency_cost,price_cost_ori,price_cost,currency_verify,price_verify_ori,price_verify,a.price_calculatefrom (select material_code,sum(bom_cost) price_calculatefrom (select material_code,bom_cost,avg(symbol_contrains) over (partition by material_code) a2from (select b.material_code,amount_base,PRICE_CALCULATE,amount_base * PRICE_CALCULATE         bom_cost,IF(PRICE_CALCULATE is not null, 1, 0) symbol_contrainsfrom (select product_code  material_code,material_code subprodid,qpa           amount_basefrom dim_bomwhere lvl = 1) ainner join (select distinct material_codefrom dw_mt_bom_unit_price_mviewwhere PRICE_CALCULATE is null) bon a.material_code = b.material_codeleft join (select distinct material_code,price_calculatefrom dw_mt_bom_unit_price_mview) con a.subprodid = c.material_code) a) awhere a2 = 1group by material_code) ainner join (select material_code_prod,material_code,currency_cost,price_cost_ori,price_cost,currency_verify,price_verify_ori,price_verifyfrom dw_mt_bom_unit_price_mview) bon a.material_code = b.material_code) iter_result
on duplicate key update currency_cost   = values(currency_cost),price_cost_ori=values(price_cost_ori),currency_verify= values(currency_verify),price_verify_ori= values(price_verify_ori),price_verify= values(price_verify),price_calculate= values(price_calculate);

汇总部分结果

使用存储过程运行的结果

计算结果

参与计算的表结构

create table currency_exchange
(currency_transaction varchar(100)   not null comment '交易币种',currency_base        varchar(100)   not null comment '基础币种',exchange_rate        decimal(24, 8) null comment '汇率',primary key (currency_transaction, currency_base)
)comment '汇率明细';create table price_cost
(material_code varchar(100)   not null comment '料号',currency      varchar(100)   not null comment '交易币种',amount_price  decimal(24, 8) null comment '价格',primary key (material_code, currency)
)comment '成本单价明细';create table price_verify
(material_code varchar(100)   not null comment '料号',currency      varchar(100)   not null comment '交易币种',amount_price  decimal(24, 8) null comment '价格',primary key (material_code, currency)
)comment '核价单价明细';create table clip_dwh.dim_bom
(product_code  varchar(100) not null comment '上阶料',material_code varchar(100) not null comment '下阶料',bom_hierarchy varchar(260) not null comment 'BOM 分层',lvl           int          null comment '分层等级',qpa           double       null comment '组成用量',main          varchar(100) null comment '主料',enable        varchar(100) null comment '启用',primary key (product_code, material_code, bom_hierarchy)
)    comment 'BOM 明细';

完整存储过程代码

createdefiner = root@localhost procedure recursion_bom_unit_price()
BEGINDECLARE iter integer default 1;truncate table clip_dwh.dw_mt_bom_unit_price_mview;commit;insert into dw_mt_bom_unit_price_mview(material_code_prod,material_code,currency_cost,price_cost_ori,price_cost,currency_verify,price_verify_ori,price_verify,price_calculate)select *from (with tmp_prod as (select material_code                                  material_code_prod,material_code,null                                           currency_cost,null                                        as price_cost_ori,null                                        as price_cost,c.currency_verify,c.price_verify                              as price_verify_ori,d.exchange_rate * IFNULL(c.price_verify, 0) as price_verify,null                                           price_calculatefrom (select distinct bom_subordinate.product_code as material_code# BOM 中只在 product_code 字段存在 不在 material_code 存在代表 该物料没有上阶物料 推断出本身是成品from (select product_codefrom dim_bom) bom_subordinateleft join (select material_codefrom dim_bom) bom_superioron bom_subordinate.product_code = bom_superior.material_codewhere bom_superior.material_code is null) a# 采购核价left join(SELECT material_code mat_code,currency      currency_verify,amount_price  price_verifyFROM clip_ods.price_verify) con a.material_code = c.mat_code# 汇率left join (select currency_transaction,exchange_ratefrom clip_ods.currency_exchangewhere currency_base = 'CNY') don c.currency_verify = d.currency_transaction),tmp_mat as (select product_code                                                                 material_code_prod,material_code,currency_cost,price_cost                                                                as price_cost_ori,case when price_cost is null then 0 else price_cost * e.exchange_rate end as price_cost,currency_verify,price_verify                                                              as price_verify_ori,casewhen price_verify is null then 0else price_verify * d.exchange_rate end                               as price_verify,casewhen price_cost is not null then price_cost * e.exchange_ratewhen price_verify is not null then price_verify * d.exchange_rateelse 0 end                                                               price_calculatefrom (select a.product_code,a.material_codefrom (select distinct bom_superior.product_code,bom_superior.material_codefrom (select product_code,material_codefrom dim_bom) bom_superiorleft join (select product_codefrom dim_bom) bom_subordinateon bom_superior.material_code = bom_subordinate.product_code# BOM 中只在 material_code 字段存在 不在 product_code 存在代表 该物料没有下阶物料 推断出本身是最底层材料where bom_subordinate.product_code is null) ainner join(select distinct bom_subordinate.product_code prod_codefrom (select product_codefrom dim_bom) bom_subordinateleft join (select material_codefrom dim_bom) bom_superioron bom_subordinate.product_code = bom_superior.material_code# 与 BOM中的最上层成品 join 保证不会有多余的材料料号参与where bom_superior.material_code is null) bon a.product_code = b.prod_code) aleft join(SELECT material_code mat_code,currency      currency_cost,# 库存成本amount_price  price_costfrom clip_ods.price_cost) bon a.material_code = b.mat_codeleft join(SELECT material_code mat_code,currency      currency_verify,# 核价amount_price  price_verifyFROM clip_ods.price_verify) con a.material_code = c.mat_codeleft join (select currency_transaction,exchange_ratefrom clip_ods.currency_exchangewhere currency_base = 'CNY') don c.currency_verify = d.currency_transactionleft join (select currency_transaction,exchange_ratefrom clip_ods.currency_exchangewhere currency_base = 'CNY') eon b.currency_cost = e.currency_transaction),tmp_semi as (select productid                                                                    material_code_prod,material_code,currency_cost,price_cost                                                                as price_cost_ori,case when price_cost is null then 0 else price_cost * e.exchange_rate end as price_cost,currency_verify,price_verify                                                              as price_verify_ori,casewhen price_verify is null then 0else price_verify * d.exchange_rate end                               as price_verify,price_cost * e.exchange_rate                                                 price_calculatefrom (select a.productid,a.material_code# 然后是 成品 和 材料 之间 的 半成品料号,使用join保证不会有多余料号参与from (select b.productid,b.material_codefrom (select distinct a.productidfrom (select product_code productidfrom dim_bom) aleft join (select material_code subprodidfrom dim_bom) bon a.productid = b.subprodidwhere b.subprodid is null) ainner join (select distinct product_code productid,material_codefrom dim_bom) bon a.productid = b.productid) aleft join (select material_code_prod,material_codefrom tmp_matwhere price_calculate is not null) bon a.material_code = b.material_codeand a.productid = b.material_code_prodwhere b.material_code is null) aleft join(SELECT material_code mat_code,currency      currency_cost,# 库存成本amount_price  price_costfrom clip_ods.price_cost) bon a.material_code = b.mat_codeleft join(SELECT material_code mat_code,currency      currency_verify,# 核价amount_price  price_verifyFROM clip_ods.price_verify) con a.material_code = c.mat_codeleft join (select currency_transaction,exchange_ratefrom clip_ods.currency_exchangewhere currency_base = 'CNY') don c.currency_verify = d.currency_transactionleft join (select currency_transaction,exchange_ratefrom clip_ods.currency_exchangewhere currency_base = 'CNY') eon b.currency_cost = e.currency_transaction)# 成品、材料、半成品 结构相同,使用union拼接再插入select material_code_prod,material_code,currency_cost,price_cost_ori,price_cost,currency_verify,price_verify_ori,price_verify,price_calculatefrom tmp_produnionselect material_code_prod,material_code,currency_cost,price_cost_ori,price_cost,currency_verify,price_verify_ori,price_verify,price_calculatefrom tmp_matunionselect material_code_prod,material_code,currency_cost,price_cost_ori,price_cost,currency_verify,price_verify_ori,price_verify,price_calculatefrom tmp_semi) initial_tmp;commit;WHILE iter <= 10DOset iter = iter + 1;insert into dw_mt_bom_unit_price_mview(material_code_prod,material_code,currency_cost,price_cost_ori,price_cost,currency_verify,price_verify_ori,price_verify,price_calculate)select material_code_prod,material_code,currency_cost,price_cost_ori,price_cost,currency_verify,price_verify_ori,price_verify,price_calculatefrom (select material_code_prod,a.material_code,currency_cost,price_cost_ori,price_cost,currency_verify,price_verify_ori,price_verify,a.price_calculatefrom (select material_code,sum(bom_cost) price_calculatefrom (select material_code,bom_cost,avg(symbol_contrains) over (partition by material_code) a2# 使用 平均数 保证 此 材料 的所有下阶材料都存在,如果不存在计算出来的材料单价会有问题from (select b.material_code,amount_base,PRICE_CALCULATE,amount_base * PRICE_CALCULATE         bom_cost,IF(PRICE_CALCULATE is not null, 1, 0) symbol_contrainsfrom (select product_code  material_code,material_code subprodid,qpa           amount_basefrom dim_bomwhere lvl = 1) ainner join (select distinct material_codefrom dw_mt_bom_unit_price_mviewwhere PRICE_CALCULATE is null) bon a.material_code = b.material_codeleft join (select distinct material_code,price_calculatefrom dw_mt_bom_unit_price_mview) con a.subprodid = c.material_code) a) awhere a2 = 1group by material_code) ainner join (select material_code_prod,material_code,currency_cost,price_cost_ori,price_cost,currency_verify,price_verify_ori,price_verifyfrom dw_mt_bom_unit_price_mview) bon a.material_code = b.material_code) iter_result# 出现重复键时覆盖,因为我们一般在初始化时已写入此主键,覆盖重复键则是为了更新on duplicate key update currency_cost   = values(currency_cost),price_cost_ori=values(price_cost_ori),currency_verify= values(currency_verify),price_verify_ori= values(price_verify_ori),price_verify= values(price_verify),price_calculate= values(price_calculate);END WHILE;commit;
END;

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/pingmian/47661.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

iOS ------ 编译链接

编译流程分析 编译可以分为四步&#xff1a; 预处理&#xff08;Prepressing)编译&#xff08;Compilation&#xff09;汇编 &#xff08;Assembly)链接&#xff08;Linking&#xff09; 预编译&#xff08;Prepressing&#xff09; 过程是源文件main.c和相关头文件被&#…

window11 部署llama.cpp并运行Qwen2-0.5B-Instruct-GGUF

吾名爱妃&#xff0c;性好静亦好动。好编程&#xff0c;常沉浸于代码之世界&#xff0c;思维纵横&#xff0c;力求逻辑之严密&#xff0c;算法之精妙。亦爱篮球&#xff0c;驰骋球场&#xff0c;尽享挥洒汗水之乐。且喜跑步&#xff0c;尤钟马拉松&#xff0c;长途奔袭&#xf…

FastAPI 学习之路(五十九)封装统一的json返回处理工具

在本篇文章之前的接口&#xff0c;我们每个接口异常返回的数据格式都不一样&#xff0c;处理起来也没有那么方便&#xff0c;因此我们可以封装一个统一的json。 from fastapi import status from fastapi.responses import JSONResponse, Response from typing import Unionde…

= null 和 is null;SQL中关于NULL处理的4个陷阱;三值逻辑

一、概述 1、NULL参与的所有的比较和算术运算符(>,,<,<>,<,>,,-,*,/) 结果为unknown&#xff1b; 2、unknown的逻辑运算(AND、OR、NOT&#xff09;遵循三值运算的真值表&#xff1b; 3、如果运算结果直接返回用户&#xff0c;使用NULL来标识unknown 4、如…

Go语言并发编程-Channel通信_2

Channel通信 Channel概述 不要通过共享内存的方式进行通信&#xff0c;而是应该通过通信的方式共享内存 这是Go语言最核心的设计模式之一。 在很多主流的编程语言中&#xff0c;多个线程传递数据的方式一般都是共享内存&#xff0c;而Go语言中多Goroutine通信的主要方案是Cha…

JavaEE:Lombok工具包的使用以及EditStarter插件的安装

Lombok是一个Java工具库&#xff0c;通过添加注解的方式&#xff0c;简化Java的开发。 目录 1、引入依赖 2、使用 3、原理解释 4、更多使用 5、更快捷的引入依赖 1、引入依赖 <dependency><groupId>org.projectlombok</groupId><artifactId>lomb…

pdf提取其中一页怎么操作?提取PDF其中一页的方法

pdf提取其中一页怎么操作&#xff1f;需要从一个PDF文件中提取特定页码的操作通常是在处理文档时常见的需求。这种操作允许用户选择性地获取所需的信息&#xff0c;而不必操作整个文档。通过选择性提取页面&#xff0c;你可以更高效地管理和利用PDF文件的内容&#xff0c;无论是…

Linux编辑器——vim的使用

目录 vim的基本概念 命令模式 底行模式 插入模式 注释和取消注释 普通用户进行sudo提权 vim配置问题 vim的基本概念 一般使用的vim有三种模式&#xff1a; 命令模式 底行模式和插入模式&#xff0c;可以进行转换&#xff1b; vim filename 打开vim&#xff0c;进入的…

ffmpeg ffplay.c 源码分析

1 ffplay.c的意义 ffplay.c是FFmpeg源码⾃带的播放器&#xff0c;调⽤FFmpeg和SDL API实现⼀个⾮常有⽤的播放器。 例如哔哩哔哩著名开源项⽬ijkplayer也是基于ffplay.c进⾏⼆次开发。 ffplay实现了播放器的主体功能&#xff0c;掌握其原理对于我们独⽴开发播放器⾮常有帮助…

npm install时报错 reason: certificate has expired

在VS code中导入新项目&#xff0c;执行npm install时报错&#xff1a; npm warn old lockfile Could not fetch metadata for antv/g3.4.10 FetchError: request to https://registry.npm.taobao.org/antv%2fg failed, reason: certificate has expirednpm warn old lockfile …

UI设计中的响应式布局策略:让您的界面在各种设备上都表现出色

UI界面设计它是人与机器之间交互的媒介&#xff0c;也是客户体验的媒介&#xff08;UX&#xff09;一个组成部分。操作界面由两个主要部分组成&#xff1a;视觉设计&#xff08;即传达产品的外观和感觉&#xff09;和交互设计&#xff08;即元素功能和逻辑组织&#xff09;。用…

kubernetes Dashboard搭建 (六)

DashBoard 之前在kubernetes中完成的所有操作都是通过命令行工具kubectl完成的。其实&#xff0c;为了提供更丰富的用户体验&#xff0c;kubernetes还开发了一个基于web的用户界面&#xff08;Dashboard&#xff09; 用户可以使用Dashboard部署容器化的应用&#xff0c;还可以监…

<数据集>木材缺陷检测数据集<目标检测>

数据集格式&#xff1a;VOCYOLO格式 图片数量&#xff1a;4000张 标注数量(xml文件个数)&#xff1a;4000 标注数量(txt文件个数)&#xff1a;4000 标注类别数&#xff1a;8 标注类别名称&#xff1a;[Quartzity,Live_Knot,Marrow,resin,Dead_Knot,knot_with_crack,Knot_m…

Prometheus 监控 Java 应用 JMX Exporter

操作场景 Prometheus 社区开发了 JMX Exporter 用于导出 JVM 的监控指标&#xff0c;以便使用 Prometheus 来采集监控数据。当您的 Java 业务容器化至 Kubernetes 后&#xff0c;可通过本文了解如何使用 Prometheus 与 JMX Exporter 来监控 Java 应用。 JMX Exporter 简介 Ja…

如何在 Puppeteer 中运行无头浏览器?

什么是无头浏览器&#xff1f; 我们都知道&#xff0c;用户界面&#xff08;UI&#xff09;是任何软件中最重要的部分。因此&#xff0c;“无头浏览器”的“无头”部分意味着它们确实缺少一个关键元素&#xff0c;即图形用户界面&#xff08;GUI&#xff09;。 这意味着浏览器…

webrtc QOS方法十三(视频渲染平滑)

一、背景介绍 视频渲染时间的确定需要考虑三方面的因素&#xff1a;网络抖动、网络延时、音视频同步 网络抖动&#xff1a;视频帧在网络上传输&#xff0c;会受到网络抖动的影响&#xff0c;不能收到立刻播放&#xff0c;需要进行适当的平滑 网络延时&#xff1a;一些报文在…

docker 安装并测试(Ubuntu下)

1. 确认安装环境&#xff08;操作系统版本和 CPU 架构&#xff09; 2. 如果有旧版本的 docker 需要进行卸载 使用 docker 命令检查是否已经安装了 docker 如果 docker 已经安装&#xff0c;使用以下命令卸载&#xff1a; apt-get purge docker-ce docker-ce-cli containerd…

力扣3202:找出有效子序列的最大长度||

class Solution { public:int maximumLength(vector<int>& nums, int k) {int res0;for(int m0;m<k;m){//假设子序列两数%k之后的结果为m 相当于枚举vector<int> v(k,0);for(auto num:nums){v[num%k]v[(m-num%kk)%k]1; //知道m之后可以知道需要的子序列当前…

maven内网依赖包编译报错问题的一种解决方法

背景 外网开发时可以连接互联网&#xff0c;所以编译没有什么问题&#xff0c;但是将数据库、代码、maven仓库全部拷贝到内网&#xff0c;搭建内网环境之后&#xff0c;编译失败。 此依赖包的依赖层级图 maven镜像库配置使用拷贝到内网的本地库&#xff0c;配置如下&#xff…

【Linux】Linux环境设置环境变量操作步骤

Linux环境设置环境变量操作步骤 在一些开发过程中本地调试经常需要依赖环境变量的参数&#xff0c;但是怎么设置对小白来说有点困难&#xff0c;今天就介绍下具体的操作步骤&#xff0c;跟着实战去学习&#xff0c;更好的检验自己的技术水平&#xff0c;做技术还是那句话&…