From 549a45dcf06bb94f3e84bd6320c13641176d585c Mon Sep 17 00:00:00 2001 From: hehaibing-1996 Date: Fri, 14 Mar 2025 08:34:03 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=99=BA=E8=83=BD=E8=B4=A7=E6=9E=B6=E9=80=80?= =?UTF-8?q?=E5=87=BA=E5=87=BA=E5=BA=93=E5=90=8E=E8=A7=A3=E9=94=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2.数据库支持多线程 3.调整出库单据导入模板 --- WCS.BLL/HardWare/SmartShelf.cs | 12 +++++ WCS.DAL/Db/DbHelp.cs | 2 +- .../{出库导入模板.xlsx => 出库单据导入模板.xlsx} | Bin .../OutInventoryImportDucumentViewModel.cs | 49 +++++++++++++++++- .../Views/OutInventoryAddDucumentView.xaml | 2 +- .../Views/OutInventoryImportDucumentView.xaml | 15 +++++- .../Views/OutInventoryImportDucumentView.xaml.cs | 5 ++ 货架标准上位机/货架标准上位机.csproj | 3 ++ 8 files changed, 84 insertions(+), 4 deletions(-) rename 货架标准上位机/Excel/{出库导入模板.xlsx => 出库单据导入模板.xlsx} (100%) diff --git a/WCS.BLL/HardWare/SmartShelf.cs b/WCS.BLL/HardWare/SmartShelf.cs index b2cb037..9b64871 100644 --- a/WCS.BLL/HardWare/SmartShelf.cs +++ b/WCS.BLL/HardWare/SmartShelf.cs @@ -694,6 +694,18 @@ namespace WCS.BLL.HardWare WarningManager.SendWarning(warningModel); } + var currentOutStoreMatSns = CurrentOutStoreMatSNs.ToList(); + Task.Run(() => + { + var matDetails = DbHelp.db.Queryable() + .Where(t => currentOutStoreMatSns.Contains(t.MatSN)) + .Where(t => t.IsLocked) + .ToList(); + matDetails.ForEach(t => t.IsLocked = false); + DbHelp.db.Updateable(matDetails).ExecuteCommand(); + }); + + CurrentOutStoreMatSNs.Clear(); WarningLight.CloseLight(TcpCleint); SetCurrentMode(Mode.待机模式); diff --git a/WCS.DAL/Db/DbHelp.cs b/WCS.DAL/Db/DbHelp.cs index 180b104..c0850f9 100644 --- a/WCS.DAL/Db/DbHelp.cs +++ b/WCS.DAL/Db/DbHelp.cs @@ -15,7 +15,7 @@ namespace WCS.DAL.Db /// public static SqlSugarScope db = new SqlSugarScope(new ConnectionConfig() { - ConnectionString = $"Data Source={DbPath.DataDbPath};", + ConnectionString = $"Data Source={DbPath.DataDbPath};Version=3;journal_mode=WAL;", DbType = DbType.Sqlite,//[Sqlite]安装[System.Data.SQLite]; IsAutoCloseConnection = true }, db => diff --git a/货架标准上位机/Excel/出库导入模板.xlsx b/货架标准上位机/Excel/出库单据导入模板.xlsx similarity index 100% rename from 货架标准上位机/Excel/出库导入模板.xlsx rename to 货架标准上位机/Excel/出库单据导入模板.xlsx diff --git a/货架标准上位机/ViewModels/OutInventoryImportDucumentViewModel.cs b/货架标准上位机/ViewModels/OutInventoryImportDucumentViewModel.cs index a23ffa0..283ee8f 100644 --- a/货架标准上位机/ViewModels/OutInventoryImportDucumentViewModel.cs +++ b/货架标准上位机/ViewModels/OutInventoryImportDucumentViewModel.cs @@ -6,10 +6,12 @@ using System.Collections.ObjectModel; using System.IO; using System.Linq; using System.Text.RegularExpressions; +using System.Threading.Tasks; using System.Windows; using System.Windows.Input; using WCS.BLL.DbModels; using WCS.Model; +using WCS.Model.ApiModel.Home; using WCS.Model.ApiModel.MatBaseInfo; using WCS.Model.ApiModel.MatInventoryDetail; using 智能仓储WCS管理系统.Api; @@ -19,6 +21,46 @@ namespace 智能仓储WCS管理系统.ViewModels public class OutInventoryImportDucumentViewModel : BindableBase { #region Property + private List shelfTypeItems; + public List ShelfTypeItems + { + get { return shelfTypeItems; } + set + { + SetProperty(ref shelfTypeItems, value); + } + } + public void InitShelfTypeItems() + { + //调用接口更新! + Task.Run(() => + { + var body = new RequestBase() + { + UserName = LocalStatic.CurrentUser, + DeviceType = LocalFile.Config.DeviceType, + }; + + var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "home/getShelfTypes", body, "POST"); + if (Result != null && Result.Data != null && Result.Data.Lists.Count() > 0) + { + ShelfTypeItems = Result.Data.Lists; + SelectedShelfTypeItem = Result.Data.Lists.First(); + } + }); + } + + private ShelfTypeModel selectedShelfTypeItem; + public ShelfTypeModel SelectedShelfTypeItem + { + get { return selectedShelfTypeItem; } + set + { + SetProperty(ref selectedShelfTypeItem, value); + } + } + + private ObservableCollection dataGridItemSource; public ObservableCollection DataGridItemSource { @@ -49,9 +91,10 @@ namespace 智能仓储WCS管理系统.ViewModels #region 选择文件保存路径 Microsoft.Win32.SaveFileDialog sfd = new Microsoft.Win32.SaveFileDialog(); sfd.Filter = ".xlsx文件(*.xlsx)|*.xlsx"; - sfd.FileName = "出库导入模板"; + sfd.FileName = "出库单据导入模板"; sfd.Title = "请选择文件保存地址"; sfd.OverwritePrompt = true; + if (sfd.ShowDialog() != true) { return; @@ -65,6 +108,8 @@ namespace 智能仓储WCS管理系统.ViewModels try { File.Copy(sourceFile, destinationFile, true); // true表示如果目标文件存在,则覆盖它 + // 设置文件的最后写入时间为当前时间 + File.SetLastWriteTime(destinationFile, DateTime.Now); Growl.Success("文件下载成功!"); } catch (IOException ioEx) @@ -174,6 +219,8 @@ namespace 智能仓储WCS管理系统.ViewModels { var body = new SysOutOrderByMatCodeRequest() { + ShelfTypeId = SelectedShelfTypeItem.Id, + ShelfTypeName = SelectedShelfTypeItem.ShelfTypeName, OrderType = "出库", OrderSource = "WCS前端", ItemList = DataGridItemSource.Select(t => new MatCodeItemList() diff --git a/货架标准上位机/Views/OutInventoryAddDucumentView.xaml b/货架标准上位机/Views/OutInventoryAddDucumentView.xaml index 1c2ae28..784d7cb 100644 --- a/货架标准上位机/Views/OutInventoryAddDucumentView.xaml +++ b/货架标准上位机/Views/OutInventoryAddDucumentView.xaml @@ -34,7 +34,7 @@ - + diff --git a/货架标准上位机/Views/OutInventoryImportDucumentView.xaml b/货架标准上位机/Views/OutInventoryImportDucumentView.xaml index f7ef259..c353ddd 100644 --- a/货架标准上位机/Views/OutInventoryImportDucumentView.xaml +++ b/货架标准上位机/Views/OutInventoryImportDucumentView.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:hc="https://handyorg.github.io/handycontrol" - Height="500" Width="850" WindowStyle="None" Background="{x:Null}" BorderThickness="0" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Opacity="1"> + Height="500" Width="850" WindowStyle="None" Loaded="Window_Loaded" Background="{x:Null}" BorderThickness="0" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Opacity="1">