当前位置: 首页 > 编程日记 > 正文

一个6年的菜鸟,在4年之前做的一些功能(二)

前戏:针对上一篇列出来的功能点,今天和大家分享下这个自定义的公式是怎么设计的,由于我的第一篇博客在首页被管理员移走了,大家可以点击这里来跳转,看下第一篇的目录结构。本人作为老菜鸟,和大家分享的也是一些老菜鸟的想法,大神千万别喷我.

设计背景:当初为什么要设计这个自定义的计算公式呢,原因就是,这个价格是不确定的,计算方式也是不确定的,那如果在代码里面写死,那将来修改起来会比较麻烦,作为老菜鸟,我想偷懒了,也是为了省事。

如何设计:这对目前项目的情况,计算的过程应该是按照线性的方式来计算的,那么问题就简单了。

首先我们先要定义一个范围控件,这个控件的目的就是,在某个区间之内,设置固定的金额或者单价,

一下我列出了部分代码,供大家提供思路

  1 public partial class RolesUserControl :  UserControl
  2 
  3     {
  4 
  5         public delegate void DelLast(object o, DeleteEventArgs e);
  6 
  7  
  8 
  9         public event DelLast onLeftTextBox;
 10 
 11  
 12 
 13         public delegate void DeleteControl(object o, DeleteEventArgs e);
 14 
 15         public event DeleteControl onDelete;
 16 
 17  
 18 
 19         /// <summary>
 20 
 21         /// 控件索引
 22 
 23         /// </summary>
 24 
 25         public int Index { get; set; }
 26 
 27  
 28 
 29         /// <summary>
 30 
 31         /// 是否验证成功
 32 
 33         /// </summary>
 34 
 35         public bool isRegistOK { get; set; }
 36 
 37  
 38 
 39         /// <summary>
 40 
 41         /// 是否启用关闭
 42 
 43         /// </summary>
 44 
 45         public bool ShowClose
 46 
 47         {
 48 
 49             set
 50 
 51             {
 52 
 53                 this.pictureBox1.Enabled = value;
 54 
 55             }
 56 
 57         }
 58 
 59  
 60 
 61         /// <summary>
 62 
 63         /// 是否显示关闭
 64 
 65         /// </summary>
 66 
 67         public bool ShowCloseVisible
 68 
 69         {
 70 
 71             set
 72 
 73             {
 74 
 75                 this.pictureBox1.Visible = value;
 76 
 77             }
 78 
 79         }
 80 
 81  
 82 
 83         private int _dropDownListType = 2;
 84 
 85  
 86 
 87         /// <summary>
 88 
 89         /// 交易类型
 90 
 91         /// 1:金额
 92 
 93         /// 2:单价
 94 
 95         /// </summary>
 96 
 97         public int DropDownListType { get { return this._dropDownListType; } }
 98 
 99  
100 
101         public RolesUserControl()
102 
103         {
104 
105             InitializeComponent();
106 
107         }
108 
109  
110 
111         /// <summary>
112 
113         /// 构造
114 
115         /// </summary>
116 
117         /// <param name="strLast"></param>
118 
119         public RolesUserControl(string strLast)
120 
121         {
122 
123             InitializeComponent();
124 
125             this.tb_last1.Text = strLast;
126 
127         }
128 
129  
130 
131         /// <summary>
132 
133         /// 鼠标移开TextBox
134 
135         /// </summary>
136 
137         /// <param name="sender"></param>
138 
139         /// <param name="e"></param>
140 
141         private void tb_last2_Leave(object sender, EventArgs e)
142 
143         {
144 
145             decimal d = 0.00m;
146 
147             if (!decimal.TryParse(this.tb_last2.Text, out d))
148 
149             {
150 
151                 isRegistOK = false;
152 
153                 this.tb_last2.Text = "请在这里输入格式为24.5的数据";
154 
155                 return;
156 
157             }
158 
159  
160 
161             if (decimal.Parse(this.tb_last1.Text.Trim()) >= d)
162 
163             {
164 
165                 isRegistOK = false;
166 
167                 this.tb_last2.Text = "下限数据应该大于上限数据";
168 
169                 return;
170 
171             }
172 
173  
174 
175             if (onLeftTextBox != null)
176 
177             {
178 
179                 DeleteEventArgs dea = new DeleteEventArgs();
180 
181                 dea.ControlName = this.Name;
182 
183                 dea.Index = this.Index;
184 
185                 dea.StrText = this.tb_last2.Text.Trim();
186 
187                 this.onLeftTextBox(sender, dea);
188 
189             }
190 
191             this.isRegistOK = true;
192 
193  
194 
195         }
196 
197  
198 
199         /// <summary>
200 
201         /// 点击关闭
202 
203         /// </summary>
204 
205         /// <param name="sender"></param>
206 
207         /// <param name="e"></param>
208 
209         private void pictureBox1_Click(object sender, EventArgs e)
210 
211         {
212 
213             if (this.onDelete != null)
214 
215             {
216 
217                 DeleteEventArgs e1 = new DeleteEventArgs();
218 
219                 e1.ControlName = this.Name;
220 
221                 e1.Index = this.Index;
222 
223                 onDelete(sender, e1);
224 
225             }
226 
227         }
228 
229  
230 
231         /// <summary>
232 
233         /// 切换类型,是使用单价还是使用金额
234 
235         /// </summary>
236 
237         /// <param name="sender"></param>
238 
239         /// <param name="e"></param>
240 
241         private void ddl_type_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
242 
243         {
244 
245             if (this.ddl_type.Text == "金额")
246 
247             {
248 
249                 radLabel1.Text = "吨   金额:";
250 
251                 tb_amount.Visible = true;
252 
253                 tb_amount.Text = "";
254 
255                 this._dropDownListType = 1;
256 
257             }
258 
259             else
260 
261             {
262 
263                 radLabel1.Text = "吨   单价:";
264 
265                 tb_amount.Visible = false;
266 
267                 tb_amount.Text = "";
268 
269                 this._dropDownListType = 2;
270 
271             }
272 
273         }
274 
275  
276 
277         /// <summary>
278 
279         /// 判断是否满足条件
280 
281         /// </summary>
282 
283         /// <param name="sender"></param>
284 
285         /// <param name="e"></param>
286 
287         private void tb_amount_Leave(object sender, EventArgs e)
288 
289         {
290 
291             decimal d = 0.00m;
292 
293             if (!decimal.TryParse(this.tb_amount.Text, out d))
294 
295             {
296 
297                 isRegistOK = false;
298 
299                 this.tb_amount.Text = "请在这里输入格式为24.5的数据";
300 
301                 return;
302 
303             }
304 
305  
306 
307             if (onLeftTextBox != null)
308 
309             {
310 
311                 DeleteEventArgs dea = new DeleteEventArgs();
312 
313                 dea.ControlName = this.Name;
314 
315                 dea.Index = this.Index;
316 
317                 dea.StrText = this.tb_last2.Text.Trim();
318 
319                 this.onLeftTextBox(sender, dea);
320 
321             }
322 
323             this.isRegistOK = true;
324 
325         }
326 
327  
328 
329         private void tb_amount_KeyPress(object sender, KeyPressEventArgs e)
330 
331         {
332 
333             if ((e.KeyChar >= 48 && e.KeyChar <= 57) || e.KeyChar == 190 || e.KeyChar == 110 || e.KeyChar == 13 || e.KeyChar == 8 || e.KeyChar == 46)
334 
335             { }
336 
337             else
338 
339             {
340 
341                 tb_amount.Text = "";
342 
343                 MessageBox.Show("请输入数字");
344 
345                 return;
346 
347             }
348 
349         }
350 
351 }

那么对于上限,其实他也是个线性的,那么我们也来建立一个控件

这个控件用来计算最后临界值。

下面是重点代码,供大家解读

  1 /// <summary>
  2 
  3         /// 添加保存事件
  4 
  5         /// </summary>
  6 
  7         /// <param name="sender"></param>
  8 
  9         /// <param name="e"></param>
 10 
 11         private void radButton2_Click(object sender, EventArgs e)
 12 
 13         {
 14 
 15             if (this.tb_RoleName.Text.Trim() == "")
 16 
 17             {
 18 
 19                 this.MessageBoxShow("请输入角色名称");
 20 
 21                 return;
 22 
 23             }
 24 
 25  
 26 
 27             //解析界面数据
 28 
 29             Model.AutoWater_Sys_BaseRoles br = new Model.AutoWater_Sys_BaseRoles();
 30 
 31             br.RolesName = this.tb_RoleName.Text.Trim();
 32 
 33             br.CreateBy = this.CurrentUserName;
 34 
 35             br.CreateOn = DateTime.Now;
 36 
 37             br.IsUsing = true;
 38 
 39             br.IsDefault = false;
 40 
 41             br.RowState = 1;
 42 
 43             br.ID = Guid.NewGuid();
 44 
 45  
 46 
 47             List<Model.AutoWater_Sys_BaseRolesDetail> lbrd = new List<Model.AutoWater_Sys_BaseRolesDetail>();
 48 
 49  
 50 
 51             List<RolesUserControl> _List = new List<RolesUserControl>();
 52 
 53             //开始范围
 54 
 55             //rolesUserControl1 ,校验数据是否正确
 56 
 57             _List.Add(this.rolesUserControl1);
 58 
 59             string strMsg="";
 60 
 61             bool isVaild = this.VaildRolesUserControl(this.rolesUserControl1, ref strMsg);
 62 
 63             if (!isVaild)
 64 
 65             {
 66 
 67                 _List.Clear();
 68 
 69                 MessageBoxShow(strMsg);
 70 
 71                 return;
 72 
 73             }
 74 
 75             //遍历Panel
 76 
 77             foreach (Control c in this.radPanel1.Controls)
 78 
 79             {
 80 
 81                 isVaild = this.VaildRolesUserControl(c as RolesUserControl, ref strMsg);
 82 
 83                 if (!isVaild)
 84 
 85                 {
 86 
 87                     _List.Clear();
 88 
 89                     MessageBoxShow(strMsg);
 90 
 91                     return;
 92 
 93                 }
 94 
 95                 _List.Add(c as RolesUserControl);
 96 
 97             }
 98 
 99             string strValue1,strValue2,strValue3,strValues4;
100 
101             _List.ForEach(t => {
102 
103                 //Last1
104 
105                 strValue1 = (t.Controls.Find("tb_last1", true)[0] as RadTextBox).Text;
106 
107                 //Last2
108 
109                 strValue2 = (t.Controls.Find("tb_last2", true)[0] as RadTextBox).Text;
110 
111                 //Price
112 
113                 if (t.DropDownListType == 1)
114 
115                 {
116 
117                     strValue3 = (t.Controls.Find("tb_amount", true)[0] as RadTextBox).Text;
118 
119                 }
120 
121                 else
122 
123                 {
124 
125                     strValue3 = (t.Controls.Find("ddl_price", true)[0] as RadDropDownList).Text;
126 
127                 }
128 
129  
130 
131                 lbrd.Add(new Model.AutoWater_Sys_BaseRolesDetail() {
132 
133                  BaseTablesID=br.ID,
134 
135                   ID=Guid.NewGuid(),
136 
137                    BetweenValue=decimal.Parse(strValue2)-decimal.Parse(strValue1),
138 
139                     CountType=t.DropDownListType,
140 
141                      CountTypeValue=decimal.Parse(strValue3),
142 
143                       CreateBy=this.CurrentUserName,
144 
145                        CreateOn=DateTime.Now,
146 
147                         DownValue=decimal.Parse(strValue1),//下限不低于
148 
149                          UpValue = decimal.Parse(strValue2),//上限不超过
150 
151                           SortID=t.Index,
152 
153                 });
154 
155             });
156 
157  
158 
159             //检查范围N
160 
161             //单价
162 
163             strValues4 = (this.userLastRolesControl1.Controls.Find("ddl_price", true)[0] as RadDropDownList).Text;
164 
165             //吨数范围
166 
167             strValue3= (this.userLastRolesControl1.Controls.Find("tb_last2", true)[0] as RadTextBox).Text;
168 
169             if (strValues4 != "" && strValue3!="")
170 
171             {
172 
173                 lbrd.Add(new Model.AutoWater_Sys_BaseRolesDetail() {
174 
175                  BaseTablesID=br.ID,
176 
177                   SortID=9,
178 
179                    BetweenValue=decimal.Parse(strValue3),
180 
181                     UpValue=0.00m,
182 
183                       DownValue = decimal.Parse(strValue3),
184 
185                       CreateOn=DateTime.Now,
186 
187                        CreateBy=this.CurrentUserName,
188 
189                         ID=Guid.NewGuid(),
190 
191                          CountTypeValue=decimal.Parse(strValues4),
192 
193                           CountType=3,
194 
195                 });
196 
197             }
198 
199  
200 
201             Combin<Model.AutoWater_Sys_BaseRoles, List<Model.AutoWater_Sys_BaseRolesDetail>> combinList = new Combin<Model.AutoWater_Sys_BaseRoles, List<Model.AutoWater_Sys_BaseRolesDetail>>(br,lbrd);
202 
203             bool isAddOK=SettingHelper.Init.AddBaseRoles(combinList);
204 
205             if (isAddOK)
206 
207             {
208 
209                 this.MessageBoxShow("建立规则成功!");
210 
211                 combinList = null;
212 
213                 lbrd.Clear();
214 
215                 br = null;
216 
217                 lbrd = null;
218 
219                 this.Close();
220 
221             }
222 
223             else
224 
225             {
226 
227                 this.MessageBoxShow("建立规则失败!");
228 
229             }
230 
231         }

到此以上就是设置了定义计算规则的逻辑,是不是很简单,有了这些数据的规则之后,接下来就是解析这些数据了,有兴趣的朋友可以自己设计下,然后自己解析,因为这些在老菜鸟看来这些都是儿科的玩意,好了今天就和大家分享到这里,明天给大家分享下,我这个老菜鸟是如何开发发票设计器的,如何来动态设计发票模板,各位88

转载于:https://www.cnblogs.com/fourspace/p/5822918.html

相关文章:

Oracle11.2新特性之listagg函数 (行列转换)

SELECT regexp_substr(公司1,贵公司2, [^,], 1, LEVEL, i) FROM dualCONNECT BY LEVEL < length(公司1,贵公司2) - length(REPLACE(公司1,贵公司2, ,, )) 1 以上为字符串带分隔符的转换为列 Oracle11.2新增了LISTAGG函数&#xff0c;可以用于字符串聚集&#xff0c;测试如下…

Mac 安装Android Studio

一、下载 可以通过以下这些网站下载Mac版的Android Studio http://www.androiddevtools.cn http://www.android-studio.org 二、安装 双击下载好的dmg文件&#xff0c;拖曳安装。 拷贝完成之后&#xff0c;在应用程序中打开Android Studio。这时候会引导进行环境安装和设置…

iscsi网络磁盘共享

iscsi(Internet SCSI)支持从客户端&#xff08;发起端&#xff09;通过IP向远程服务器上的ISCSI存储设备&#xff08;目标&#xff09;发送scsi命令。ISCSI限定名称用于确定发起端和目标&#xff0c;并采用iqn.yyy-mm.{reverse domain}:label的格式。 默认情况下&#xff0c;网…

转: IO设计模式:Reactor和Proactor对比

转: https://segmentfault.com/a/1190000002715832 平时接触的开源产品如Redis、ACE&#xff0c;事件模型都使用的Reactor模式&#xff1b;而同样做事件处理的Proactor&#xff0c;由于操作系统的原因&#xff0c;相关的开源产品也少&#xff1b;这里学习下其模型结构&#xff…

程序员该怎样放松?8个好网站推荐

1&#xff09;看风景程序员每天在液晶屏幕下工作很长时间&#xff0c;应该让干涩的眼睛得到好好的放松&#xff0c;偶尔看看窗外的绿树或远处的风景可能是不错的方式&#xff0c;但是这在北京上海广州这样的大城市里不太现实&#xff0c;所以这里推荐一个纯粹的分享旅行照片的网…

【iOS】UIButton 图标在上文字在下

iOS默认的UIButton是图片在左文字在右&#xff0c;但是很多时候需求是图片在上文字在下&#xff08;如效果图1、效果图2&#xff09;&#xff0c;因此想到&#xff0c;通过写一个JXButton继承自UIButton&#xff0c;并重写相关方法即可&#xff0c;以后项目中需要用的话就直接使…

多线程和mysql

多线程 1、多线程的定义&#xff1a; 什么是线程&#xff1a; 线程是操作系统能够进行运算调度的最小单位&#xff08;程序执行流的最小单元&#xff09;。它被包含在进程之中&#xff0c; 是进程中的实际运作单位。一个进程中可以并发多个线程&#xff0c;每条线程并行执行不…

poj2154-color-polyan次二面体+欧拉函数优化

N<1e9,O(nlogn)的做法会超时。从枚举置换转变为枚举轮换长度&#xff0c;然后可以利用欧拉函数&#xff0c;把复杂度变为O(√n * logn) 1 /*--------------------------------------------------------------------------------------*/2 3 #include <algorithm>4 #in…

【iOS】通讯录分组方式展示数据

本例子是将后台返回的医生列表&#xff08;包含姓名和电话&#xff0c;demo从plist文件读取&#xff09;&#xff0c;按拼音进行分组显示(A-Z)&#xff0c;最终效果如下图&#xff1a; 一、创建Doctor医生类: Doctor类属性包括姓名、电话以及姓名第一个字的拼音首字母&#xff…

LVS_DR实现(负载均衡)及LVS_DR+keepalived实现(高可用+负载均衡)

client->VS->RS->client(VS只做调度,RS为虚拟服务器) LVS_DR原理图解&#xff1a; 优点&#xff1a;负载均衡器只负责将请求包分发给物理服务器&#xff0c;而物理服务器将应答包直接发给用户。所以&#xff0c;负载均衡器能处理 很巨大的请求量&#xff0c;这种方式…

【LeetCode】136. Single Number 解题小结

题目&#xff1a; Given an array of integers, every element appears twice except for one. Find that single one. Note:Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory? 这题目的要求不仅是要求是线性时间…

iOS小技巧积累

平时项目中用到的&#xff0c;记录下来&#xff08;持续更新&#xff09;。1.在导航栏右边添加多个UIBarButtonItemUIBarButtonItem *searchScheduleBtn [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:"search_small"] style:UIBarButtonItemStylePl…

(转)iPhone开发经典语录集锦

1&#xff1a;如果无法保证子类行为的一致性&#xff0c;那么就用委托 If the subClass cannt keep with superClass,use delegate rather than inheritance. 2:屏幕上看到的&#xff0c;都是UIVew Everything you see on Screen is UIView. 3:如果对性能要求高&#xff0c;慎…

varnish 实现 CDN 缓存系统构建

cdn 搭建 (server1:172.25.1.1 ) : [roottest1 ~]# ls varnish-3.0.5-1.el6.x86_64.rpm varnish-libs-3.0.5-1.el6.x86_64.rpm [roottest1 ~]# yum install * -y [roottest1 ~]# cd /etc/varnish/ [roottest1 varnish]# vim /etc/sysconfig/varnish [roottest1 varnish]# sysct…

创建第一个 local network(I) - 每天5分钟玩转 OpenStack(80)

在 ML2 配置文件中 enable local network 后&#xff0c;本节将开始创建第一个 local network。 我们将通过 Web GUI 创建第一个 local network。 首先确保各个节点上的 neutorn agent 状态正常。GUI 菜单 为 Admin -> System -> System Infomation -> Neutron Agents…

【Android】AsyncTask异步类

一、关于AysncTask AsyncTask使得多线程编程更加简单&#xff0c;AsyncTask能在后台线程执行异步任务&#xff0c;并且在UI线程更新界面&#xff0c;而不再需要用户去操作Thread和Handler。AysncTask是一个抽象类&#xff0c;类关系如下&#xff1a; public abstract class As…

高手速成android开源项目【blog篇】

主要介绍那些乐于分享并且有一些很不错的开源项目的个人和组织。Follow大神&#xff0c;深挖大神的项目和following&#xff0c;你会发现很多。 一、个人 JakeWharton 就职于SquareGithub地址&#xff1a;https://github.com/JakeWharton代表作&#xff1a;ActionBarSherlock&a…

3、LVS_TUN实现负载均衡

LVS_TUN实现负载均衡 LVS 介绍: LVS 是 Linux Virtual Server 的简称,在实际环境中经常作为 B/S 结构的网络应用中的负载均衡器来使用,工作在 7 层网络模型中的,网络层,也就是通常说的 IP 层,由于数据的处理是在 Linux 内核态完成的,所以相对反向代理服务器来说,性能一般会高一…

【Android】Fragment官方中文文档

以下内容来自Android官方文档。 Fragment 表示 Activity 中的行为或用户界面部分。您可以将多个片段组合在一个 Activity 中来构建多窗格 UI&#xff0c;以及在多个 Activity 中重复使用某个片段。您可以将片段视为 Activity 的模块化组成部分&#xff0c;它具有自己的生命周期…

关于MSSQL导入导出时主键与约束丢失的问题解决

导入数据时&#xff0c;使用默认选项&#xff0c;会丢失主键、约束、默认值等属性&#xff0c;按如下步骤操作&#xff1a;-->导出向导 -->选择数据源 -->选择目的 -->指定表复制或查询&#xff1a;不要使用默认选项&#xff0c;选择“在SQL Server数据库之间复制对…

Java5中的线程池实例讲解

Java5增加了新的类库并发集java.util.concurrent&#xff0c;该类库为并发程序提供了丰富的API多线程编程在Java 5中更加容易&#xff0c;灵活。本文通过一个网络服务器模型&#xff0c;来实践Java5的多线程编程&#xff0c;该模型中使用了Java5中的线程池&#xff0c;阻塞队列…

LNMP架构的搭建

LNMP 架构的搭建 基础架构图 环境&#xff1a; server5: nginx mysql php //需要的安装包 (蓝色为解压后的文件) [roottest5 ~]# /etc/init.d/iptables stop //关掉防火墙 MYSQL 源码安装 [roottest6 ~]#yum install -y gcc gcc-c make ncurses-devel bison opens…

NSString属性什么时候用copy,什么时候用strong?

我们在声明一个NSString属性时&#xff0c;对于其内存相关特性&#xff0c;通常有两种选择(基于ARC环境)&#xff1a;strong与copy。那这两者有什么区别呢&#xff1f;什么时候该用strong&#xff0c;什么时候该用copy呢&#xff1f;让我们先来看个例子。 示例 我们定义一个类…

hihocoder 1152 Lucky Substrings

#1152 : Lucky Substrings 时间限制:10000ms单点时限:1000ms内存限制:256MB描述 A string s is LUCKY if and only if the number of different characters in s is a fibonacci number. Given a string consisting of only lower case letters, output all its lucky non-empt…

随笔,记2014忆往昔岁月

博客园开通了一年多&#xff0c;这是第一篇博客。在此记下我的第一篇博客&#xff0c;同时&#xff0c;回忆过去几年自己的工作所得所想所感。 大学毕业&#xff0c;工作两年半了&#xff0c;做过很多事&#xff0c;比较杂&#xff0c;做过需求&#xff0c;做过设计&#xff0c…

PHP相关关系及定义

CGI(是一种协议): 是为了保证web server传递过来的数据是标准格式的&#xff0c;方便CGI程序的编写者。 web server&#xff08;如nginx&#xff09;是内容的分发者。 处理静态页面&#xff1a; 如果请求/index.html&#xff0c;web server就可以解…

Apache优化:修改最大并发连接数

http://www.365mini.com/page/apache-concurrency-configuration.htm Apache是一个跨平台的web服务器&#xff0c;由于其简单高效、稳定安全的特性&#xff0c;被广泛应用于计算机技术的各个领域。现在&#xff0c;Apache凭借其庞大的用户数&#xff0c;已成为用户数排名第一的…

黑马程序员___Java基础[02-Java基础语法](一)

Java语言基础组成 一、关键字 1)定义&#xff1a;被Java语言赋予了特殊含义的单词 2)特点&#xff1a;关键字中所有字母均为小写 3)作用及分类&#xff1a; 下面是Java语言保留专用的50个关键字&#xff1a; 用于定义数据类型的关键字&#xff08;12个&#xff09;&#xff1a;…

NSLog打印自定义对象

我们在开发中&#xff0c;如果直接使用NSLog打印对象&#xff0c;则会打印对象的指针&#xff08;如下图&#xff09; 但我们常常希望打印的是对象的属性的值&#xff0c;因此我们需要重写自定义类的description方法&#xff08;打印日志时&#xff0c;对象会收到description消…

数据库的安装与管理

数据库的安装与管理 1.mysql数据库的安装 yum install mariadb-server -y systemctl start mariadb ##开启数据库 netstat -antlupe | grep mysql ##查看端口 vim /etc/my.cnf ##修改配置文件。添加skip-networking1 systemctl restart mariadb ##重起服务 netstat -antlupe |…