From f50cdeeb393ecf904514c9f6bb73e0585b566607 Mon Sep 17 00:00:00 2001 From: CPL <1179393954@qq.com> Date: Wed, 5 Mar 2025 09:47:30 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A6=BE=E6=AC=A3=E6=80=BB=E6=B1=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + LeatherProject/LeatherApp/FrmMain.cs | 50 +++++++++++++++++++++- LeatherProject/LeatherApp/Page/FHome.cs | 2 + LeatherProject/LeatherApp/Utils/DBUtils.cs | 28 ++++++------ 4 files changed, 68 insertions(+), 13 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..69c051d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/LeatherProject/.vs diff --git a/LeatherProject/LeatherApp/FrmMain.cs b/LeatherProject/LeatherApp/FrmMain.cs index 2574d85..f875d8b 100644 --- a/LeatherProject/LeatherApp/FrmMain.cs +++ b/LeatherProject/LeatherApp/FrmMain.cs @@ -13,6 +13,7 @@ using LeatherApp.Page; using System.Reflection; using Service; using LeatherApp.Utils; +using HZH_Controls.Forms; namespace LeatherApp { @@ -188,6 +189,9 @@ namespace LeatherApp //HideProcessForm();//完成后关闭动画 frm.TopLevel = true; frm.UserName = szUserCode; + + //查询硬盘 + CheckDisk(this, 100); //frm.Password = "1"; frm.ShowDialog(); frm.Dispose(); @@ -268,7 +272,51 @@ namespace LeatherApp { this.HideProcessForm(); this.Visible = true; - } + } + + #region 硬盘检测 + public bool CheckDisk(IWin32Window owner, int max = 10) + { + if (!string.IsNullOrEmpty(Config.ImagePath)) + { + string path = Config.ImagePath; + string volume = path.Substring(0, path.IndexOf(':')); + long freespace = GetHardDiskSpace(volume); + if (freespace < max) + { + string tip = $"当前{volume}硬盘容量:{freespace}GB,小于{max}GB。注意清理!!"; + FrmDialog.ShowDialog(owner, tip, "警告", true); + return false; + } + } + return true; + } + //drive.TotalFreeSpace单位为bit,根据需要除以1024 + //drive同时可以可以获取磁盘分区容量等 + //单位GB + public long GetHardDiskSpace(string str_HardDiskName) + { + long totalSize = 0; + try + { + str_HardDiskName = str_HardDiskName + ":\\"; + System.IO.DriveInfo[] drives = System.IO.DriveInfo.GetDrives(); + foreach (System.IO.DriveInfo drive in drives) + { + if (drive.Name == str_HardDiskName) + { + totalSize = drive.TotalFreeSpace / (1024 * 1024 * 1024); + } + } + } + catch + { + totalSize = 0; + } + return totalSize; + } + #endregion + private void FrmManager_FormClosing(object sender, FormClosingEventArgs e) { UILocalize.OK = "是"; diff --git a/LeatherProject/LeatherApp/Page/FHome.cs b/LeatherProject/LeatherApp/Page/FHome.cs index 8a0362c..7e120ef 100644 --- a/LeatherProject/LeatherApp/Page/FHome.cs +++ b/LeatherProject/LeatherApp/Page/FHome.cs @@ -5521,6 +5521,8 @@ namespace LeatherApp.Page DefectInfoList = deflist, UserName = model.UserName, WorkTeam = model.WorkTeam, + PJXTBH = model.PJXTBH, + DefectType = model.DefectType, }; htTask.Add(currKey, record); diff --git a/LeatherProject/LeatherApp/Utils/DBUtils.cs b/LeatherProject/LeatherApp/Utils/DBUtils.cs index 6bbb7d2..7459cb0 100644 --- a/LeatherProject/LeatherApp/Utils/DBUtils.cs +++ b/LeatherProject/LeatherApp/Utils/DBUtils.cs @@ -300,18 +300,22 @@ namespace LeatherApp.Utils //幅宽 double agvmf = 0; double mf1 = 0, mf2 = 0, mf3 = 0; - if (records.FacePointList.Count > 10) - mf1 = records.FacePointList[10][1]; - else - mf1 = records.FacePointList[0][1]; - if (records.FacePointList.Count > 10) - mf3 = records.FacePointList[records.FacePointList.Count - 10][1]; - else - mf3 = records.FacePointList[records.FacePointList.Count - 1][1]; - if (records.FacePointList.Count > 0) - mf2 = records.FacePointList[records.FacePointList.Count/2][1]; + if (records.FacePointList != null && records.FacePointList.Count > 0) + { + if (records.FacePointList.Count > 10) + mf1 = records.FacePointList[10][1]; + else + mf1 = records.FacePointList[0][1]; + if (records.FacePointList.Count > 10) + mf3 = records.FacePointList[records.FacePointList.Count - 10][1]; + else + mf3 = records.FacePointList[records.FacePointList.Count - 1][1]; + if (records.FacePointList.Count > 0) + mf2 = records.FacePointList[records.FacePointList.Count / 2][1]; - agvmf = (mf1 + mf2 + mf3)/3; + agvmf = (mf1 + mf2 + mf3) / 3; + agvmf = records.FacePointList.Select(x => x[1]).ToList().Average(); + } //新数据插入 db.Insertable(new XCLErpUploadData() { @@ -329,7 +333,7 @@ namespace LeatherApp.Utils MF1 = mf1, MF2 = mf2, MF3 = mf3, - AvgMF = records.FacePointList.Select(x => x[1]).ToList().Average(), + AvgMF = agvmf, HD1= hd1, HD2= hd2,