From 3c2cc27467218dc24c985b906683e311f215033b Mon Sep 17 00:00:00 2001 From: hehaibing-1996 Date: Thu, 9 May 2024 16:38:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WCS.BLL/DbModels/ModuleInfo.cs | 43 ++++++---- WCS.BLL/DbModels/StoreInfo.cs | 2 +- WCS.BLL/HardWare/SingleLightShelf.cs | 3 +- WCS.BLL/HardWare/SmartShelf.cs | 2 +- WCS.BLL/HardWare/SmartShelfModule.cs | 2 +- WCS.BLL/Manager/ShelfManager.cs | 7 ++ .../Services/Service/InOutRecordService.cs | 2 +- .../Services/Service/StockTakingService.cs | 1 - WCS.BLL/Services/Service/StoreInfoService.cs | 9 -- .../InOutRecord/GetInOutRecordRequest.cs | 2 + .../ApiModel/InOutRecord/InOutRecordModel.cs | 2 +- .../Controllers/InOutRecordController.cs | 10 ++- WCS.WebApi/Controllers/InstoreController.cs | 28 ++++++ WCS.WebApi/Controllers/OutstoreController.cs | 74 ++++++++++++++++ .../ViewModels/InOutRecordViewModel.cs | 44 +++++++++- .../ViewModels/StocktakingDocumentViewModel.cs | 85 +++++++++++++++---- 货架标准上位机/Views/InOutRecordView.xaml | 40 ++++++--- .../Views/ShelfInfoAddOrUpdateView.xaml | 2 +- .../Views/StocktakingDocumentView.xaml | 4 + 19 files changed, 299 insertions(+), 63 deletions(-) diff --git a/WCS.BLL/DbModels/ModuleInfo.cs b/WCS.BLL/DbModels/ModuleInfo.cs index e5e2112..d3b0a8a 100644 --- a/WCS.BLL/DbModels/ModuleInfo.cs +++ b/WCS.BLL/DbModels/ModuleInfo.cs @@ -1,4 +1,5 @@ -using System; +using SqlSugar; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -7,65 +8,77 @@ using WCS.BLL.HardWare; namespace WCS.DAL.DbModels { + /// + ///模组信息表 + /// + [SugarTable("module_info")] public partial class ModuleInfo { /// - /// 模组Id + /// 主键 Id 自增 /// + [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)] public int Id { get; set; } /// /// 模组编码 /// + [SugarColumn(ColumnName = "module_code", Length = 50, IsNullable = false, ColumnDescription = "模组编码")] public string ModuleCode { get; set; } /// /// 货架Id /// + [SugarColumn(ColumnName = "shelf_id", IsNullable = false, ColumnDescription = "货架Id")] public int ShelfId { get; set; } /// - /// 货架编码 + /// 货架号 /// + [SugarColumn(ColumnName = "shelf_code", Length = 50, IsNullable = false, ColumnDescription = "货架编码;货架一般按照报警灯来区分 一个报警灯指示的是一个货架")] public string ShelfCode { get; set; } /// /// 板子的Id /// + [SugarColumn(ColumnName = "board_id", IsNullable = false, ColumnDescription = "模组pcb板id")] public int BoardId { get; set; } /// - /// 板子上有几个灯 + /// 板子上第几个灯 /// + [SugarColumn(ColumnName = "light_count", IsNullable = false, ColumnDescription = "板子上灯的数量")] public int LightCount { get; set; } /// - /// 板子所连接模块的Ip + /// 对应Can模块的Ip /// + [SugarColumn(ColumnName = "client_ip", Length = 50, IsNullable = false, ColumnDescription = "货架对应Can模块的Ip")] public string CleintIp { get; set; } /// - /// 第几行 + /// R 行 /// + [SugarColumn(ColumnName = "R", Length = 50, IsNullable = false, ColumnDescription = "R 行")] public string R { get; set; } /// - /// 第几列 + /// C 列 /// + [SugarColumn(ColumnName = "C", Length = 50, IsNullable = false, ColumnDescription = " C 列")] public string C { get; set; } /// - /// 串联后大货架编码;大货架编码:未串联时是与货架编码是一对一的关系;串联后与货架编码是一对多 + /// 串联后大货架编码;大货架编码:未串联时是与货架编码是一对一的关系;串联后与货架编码是一对多的关系 /// - public string Bigshelfcode { get; set; } + [SugarColumn(ColumnName = "big_shelf_code", Length = 50, IsNullable = true, ColumnDescription = "串联后大货架编码;大货架编码:未串联时是与货架编码是一对一的关系;串联后与货架编码是一对多的关系")] + public string? Bigshelfcode { get; set; } - /// - /// 是否被禁用 - /// - public bool IsEnable { get; set; } + [SugarColumn(ColumnName = "is_enable", IsNullable = false, ColumnDescription = "串联后大货架编码;大货架编码:未串联时是与货架编码是一对一的关系;串联后与货架编码是一对多的关系")] + public bool IsEnable { get; set; } = true; - - public Mode CurentMode { get; set; } = Mode.待机模式; + [SugarColumn(ColumnName = "current_mode", IsNullable = true, ColumnDescription = "串联后大货架编码;大货架编码:未串联时是与货架编码是一对一的关系;串联后与货架编码是一对多的关系")] + public Mode CurrentMode { get; set; } = Mode.待机模式; } } diff --git a/WCS.BLL/DbModels/StoreInfo.cs b/WCS.BLL/DbModels/StoreInfo.cs index 2d6bea9..a760bd0 100644 --- a/WCS.BLL/DbModels/StoreInfo.cs +++ b/WCS.BLL/DbModels/StoreInfo.cs @@ -49,7 +49,7 @@ namespace WCS.DAL.DbModels /// /// 板子的Id /// - [SugarColumn(ColumnName = "board_id", IsNullable = false, ColumnDescription = "货架Id")] + [SugarColumn(ColumnName = "board_id", IsNullable = false, ColumnDescription = "模组pcb板id")] public int BoardId { get; set; } /// diff --git a/WCS.BLL/HardWare/SingleLightShelf.cs b/WCS.BLL/HardWare/SingleLightShelf.cs index 3cebed2..98589cb 100644 --- a/WCS.BLL/HardWare/SingleLightShelf.cs +++ b/WCS.BLL/HardWare/SingleLightShelf.cs @@ -33,7 +33,7 @@ namespace WCS.BLL.HardWare public void GoInInstore(string IPAdress) { - throw new NotImplementedException(); + //找到对应的灯 亮灯 } public void GoInOutstore(List MatDetails, OutOrder outOrder) @@ -53,6 +53,7 @@ namespace WCS.BLL.HardWare public void GoOutInstore() { + //找到已亮灯的 灭灯 throw new NotImplementedException(); } diff --git a/WCS.BLL/HardWare/SmartShelf.cs b/WCS.BLL/HardWare/SmartShelf.cs index 9855f92..0fe0ec2 100644 --- a/WCS.BLL/HardWare/SmartShelf.cs +++ b/WCS.BLL/HardWare/SmartShelf.cs @@ -38,7 +38,7 @@ namespace WCS.BLL.HardWare ModuleCode = module.ModuleCode, BoardId = module.BoardId, IsEnable = module.IsEnable, - CurrentMode = module.CurentMode + CurrentMode = module.CurrentMode }); } ModulesStr = string.Join(";", Modules.Select(t => t.ModuleCode)); diff --git a/WCS.BLL/HardWare/SmartShelfModule.cs b/WCS.BLL/HardWare/SmartShelfModule.cs index bcbd796..30cb307 100644 --- a/WCS.BLL/HardWare/SmartShelfModule.cs +++ b/WCS.BLL/HardWare/SmartShelfModule.cs @@ -153,7 +153,7 @@ namespace WCS.BLL.HardWare { if (CurrentMode != Mode.待机模式) { - //TO DO 退出对应的模式 然后再发送进入入库模式 + return; } var storeInfos = DbHelp.db.Queryable() .Where(t => t.BoardId == BoardId) diff --git a/WCS.BLL/Manager/ShelfManager.cs b/WCS.BLL/Manager/ShelfManager.cs index 385e3f5..dd2207e 100644 --- a/WCS.BLL/Manager/ShelfManager.cs +++ b/WCS.BLL/Manager/ShelfManager.cs @@ -38,6 +38,13 @@ namespace WCS.BLL.Manager ShelfCode = shelfInDb.ShelfCode, GroupName = shelfInDb.GroupName, }; + case 2: + return new SmartShelf(shelfInDb) + { + ShelfId = shelfInDb.Id, + ShelfCode = shelfInDb.ShelfCode, + GroupName = shelfInDb.GroupName, + }; default: return null; } diff --git a/WCS.BLL/Services/Service/InOutRecordService.cs b/WCS.BLL/Services/Service/InOutRecordService.cs index cc6c217..738541d 100644 --- a/WCS.BLL/Services/Service/InOutRecordService.cs +++ b/WCS.BLL/Services/Service/InOutRecordService.cs @@ -34,6 +34,7 @@ namespace WCS.BLL.Services.Service .WhereIF(!string.IsNullOrEmpty(request.MatSpec), (id, si) => id.MatSpec.Contains(request.MatSpec)) .WhereIF(!string.IsNullOrEmpty(request.MatSupplier), (id, si) => id.MatSpec.Contains(request.MatSupplier)) .WhereIF(!string.IsNullOrEmpty(request.MatCustomer), (id, si) => id.MatSpec.Contains(request.MatCustomer)) + .WhereIF(request.Direction != null, (id, si) => id.Direction == request.Direction) .WhereIF(request.StoreId != 0, (id, si) => id.StoreId == request.StoreId) @@ -94,7 +95,6 @@ namespace WCS.BLL.Services.Service .WhereIF(!string.IsNullOrEmpty(request.StoreCode), (id, si) => id.StoreCode.Contains(request.StoreCode)) ; var records = await recordsQueryable - .Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize) .Select() .ToListAsync(); //生成序号 diff --git a/WCS.BLL/Services/Service/StockTakingService.cs b/WCS.BLL/Services/Service/StockTakingService.cs index ec976d6..a5c1b95 100644 --- a/WCS.BLL/Services/Service/StockTakingService.cs +++ b/WCS.BLL/Services/Service/StockTakingService.cs @@ -909,7 +909,6 @@ namespace WCS.BLL.Services.Service }; DbHelp.db.Updateable(inventoryDetail).ExecuteCommand(); DbHelp.db.Insertable(inOutRecord).ExecuteCommand(); - } //数量相等的情况 暂时不用管 不动库存数据也不生成记录 else diff --git a/WCS.BLL/Services/Service/StoreInfoService.cs b/WCS.BLL/Services/Service/StoreInfoService.cs index d5aad9b..20d5e92 100644 --- a/WCS.BLL/Services/Service/StoreInfoService.cs +++ b/WCS.BLL/Services/Service/StoreInfoService.cs @@ -236,15 +236,6 @@ namespace WCS.BLL.Services.Service } } - Task> IStoreInfoService.GetShelves(GetShelvesRequest request) - { - throw new NotImplementedException(); - } - - Task> IStoreInfoService.addOrUpdateShelfInfo(AddShelfInfoRequest request) - { - throw new NotImplementedException(); - } async Task> IStoreInfoService.GenerateStoreInfo() { diff --git a/WCS.Model/ApiModel/InOutRecord/GetInOutRecordRequest.cs b/WCS.Model/ApiModel/InOutRecord/GetInOutRecordRequest.cs index ac5ff53..7641434 100644 --- a/WCS.Model/ApiModel/InOutRecord/GetInOutRecordRequest.cs +++ b/WCS.Model/ApiModel/InOutRecord/GetInOutRecordRequest.cs @@ -20,6 +20,8 @@ namespace WCS.Model.ApiModel.InOutRecord public string MatSupplier { get; set; } public string MatCustomer { get; set; } + + public DirectionEnum? Direction { get; set; } #endregion #region 库位属性 diff --git a/WCS.Model/ApiModel/InOutRecord/InOutRecordModel.cs b/WCS.Model/ApiModel/InOutRecord/InOutRecordModel.cs index 510cc79..4cad1a5 100644 --- a/WCS.Model/ApiModel/InOutRecord/InOutRecordModel.cs +++ b/WCS.Model/ApiModel/InOutRecord/InOutRecordModel.cs @@ -25,7 +25,7 @@ namespace WCS.Model.ApiModel.InOutRecord #endregion public string? OrderNumber { get; set; } - public DirectionEnum Direction { get; set; } + public DirectionEnum? Direction { get; set; } public bool IsUpload { get; set; } = false; public DateTime OperateTime { get; set; } public string OperateUser { get; set; } diff --git a/WCS.WebApi/Controllers/InOutRecordController.cs b/WCS.WebApi/Controllers/InOutRecordController.cs index 7518e58..35263a4 100644 --- a/WCS.WebApi/Controllers/InOutRecordController.cs +++ b/WCS.WebApi/Controllers/InOutRecordController.cs @@ -45,13 +45,19 @@ namespace WCS.WebApi.Controllers var columns = new[] { new ExportableColumn("序号","RowNumber"), + new ExportableColumn("库位","StoreCode"), new ExportableColumn("物料编码","MatCode"), new ExportableColumn("物料名称","MatName"), new ExportableColumn("规格","MatSpec"), new ExportableColumn("批次","MatBatch"), + new ExportableColumn("供应商","MatSupplier"), + new ExportableColumn("客户","MatCustomer"), new ExportableColumn("数量","MatQty"), - new ExportableColumn("库位","StoreCode"), - new ExportableColumn("入库时间","InstoreTime"), + new ExportableColumn("类型","Direction"), + + new ExportableColumn("操作人","OperateUser"), + new ExportableColumn("操作时间","OperateTime"), + new ExportableColumn("物料SN", "MatSN"), }; if (data == null) diff --git a/WCS.WebApi/Controllers/InstoreController.cs b/WCS.WebApi/Controllers/InstoreController.cs index f5aefe9..d637d3d 100644 --- a/WCS.WebApi/Controllers/InstoreController.cs +++ b/WCS.WebApi/Controllers/InstoreController.cs @@ -114,5 +114,33 @@ namespace WebApi.Controllers }; } } + + + + /// + /// ƻύ + /// + /// + /// + [Route("singleLightCommitInstore")] + [HttpPost(Name = "queryInstoreStatus")] + public async Task singleLightCommitInstore(QueryByMatSnRequest request) + { + //TODO: ƻύ + try + { + return await _instoreService.queryInstoreStatus(request); + //ShelfManager. + // + } + catch (Exception ex) + { + return new ResponseCommon() + { + Code = 300, + Message = $"ʧ:{ex.Message}", + }; + } + } } } diff --git a/WCS.WebApi/Controllers/OutstoreController.cs b/WCS.WebApi/Controllers/OutstoreController.cs index e1fdbe2..ac10222 100644 --- a/WCS.WebApi/Controllers/OutstoreController.cs +++ b/WCS.WebApi/Controllers/OutstoreController.cs @@ -215,5 +215,79 @@ namespace WebApi.Controllers }; } } + + + /// + /// ƿʼ + /// + /// + /// + [Route("singleLightGoInOutstore")] + [HttpPost(Name = "singleLightGoInOutstore")] + public async Task singleLightGoInOutstore(GetOutOrderDetailRequest request) + { + //TODO + try + { + return await _outstoreService.GoInOutstore(request); + } + catch (Exception ex) + { + return new ResponseBase() + { + Code = 300, + Message = "ģʽʧܣ" + ex.Message, + }; + } + } + + /// + /// ƽ + /// + /// + /// + [Route("singleLightGoOutOutstore")] + [HttpPost(Name = "singleLightGoOutOutstore")] + public async Task singleLightGoOutOutstore(GetOutOrderDetailRequest request) + { + //TODO + try + { + return await _outstoreService.GoOutOutstore(request); + } + catch (Exception ex) + { + return new ResponseBase() + { + Code = 300, + Message = "ѯʧܣ" + ex.Message, + }; + } + } + + /// + /// ȷϳ + /// + /// + /// + [Route("singleLightConfirmOutstore")] + [HttpPost(Name = "singleLightConfirmOutstore")] + public async Task singleLightConfirmOutstore(GetOutOrderDetailRequest request) + { + //TODO + try + { + return await _outstoreService.GoOutOutstore(request); + } + catch (Exception ex) + { + return new ResponseBase() + { + Code = 300, + Message = "ѯʧܣ" + ex.Message, + }; + } + } + } } diff --git a/货架标准上位机/ViewModels/InOutRecordViewModel.cs b/货架标准上位机/ViewModels/InOutRecordViewModel.cs index 3315160..138ebae 100644 --- a/货架标准上位机/ViewModels/InOutRecordViewModel.cs +++ b/货架标准上位机/ViewModels/InOutRecordViewModel.cs @@ -27,6 +27,8 @@ using WCS.Model.ApiModel.MatInventoryDetail; using HandyControl.Tools.Extension; using WCS.Model.ApiModel.Stocktaking; using WCS.Model.ApiModel.InOutRecord; +using System.Collections.ObjectModel; +using static 货架标准上位机.ViewModel.InOutRecordViewModel; namespace 货架标准上位机.ViewModel { @@ -162,6 +164,44 @@ namespace 货架标准上位机.ViewModel SetProperty(ref matSN, value); } } + + + private DirectionEnum? selectedDirection; + public DirectionEnum? SelectedDirection + { + get { return selectedDirection; } + set + { + SetProperty(ref selectedDirection, value); + } + } + + public ObservableCollection Directions => GetEnumValues(); + private ObservableCollection GetEnumValues() + { + // 初始化ObservableCollection + var directions = new ObservableCollection(); + // 添加“全部”选项 + directions.Add(new DirectionItem { Text = "全部", Value = null }); // Value设置为null或某个表示“全部”的值 + + // 遍历DirectionEnum枚举并添加项 + foreach (DirectionEnum direction in Enum.GetValues(typeof(DirectionEnum))) + { + directions.Add(new DirectionItem { Text = direction.ToString(), Value = direction }); + } + return directions; + } + + public class DirectionItem + { + public string Text { get; set; } + public object Value { get; set; } + + public override string ToString() + { + return Text; + } + } #endregion #region Command @@ -192,11 +232,13 @@ namespace 货架标准上位机.ViewModel { var body = new GetInOutRecordRequest() { - MatName = MatName, + MatSN = MatSN, + MatName = MatName, MatBatch = MatBatch, MatCode = MatCode, StoreCode = StoreCode, + Direction = SelectedDirection, UserName = LocalStatic.CurrentUser, DeviceType = LocalFile.Config.DeviceType, diff --git a/货架标准上位机/ViewModels/StocktakingDocumentViewModel.cs b/货架标准上位机/ViewModels/StocktakingDocumentViewModel.cs index 02a291f..1e99c13 100644 --- a/货架标准上位机/ViewModels/StocktakingDocumentViewModel.cs +++ b/货架标准上位机/ViewModels/StocktakingDocumentViewModel.cs @@ -90,7 +90,7 @@ namespace 货架标准上位机.ViewModels return; } - #region 调用接口获取数据 + #region 调用接口获取单据 try { var body = new GetStockTakingOrdersRequest() @@ -113,7 +113,7 @@ namespace 货架标准上位机.ViewModels } catch (Exception ex) { - Growl.Error("加载数据失败:" + ex.Message); + Growl.Error("加载单据失败:" + ex.Message); } finally { @@ -138,20 +138,20 @@ namespace 货架标准上位机.ViewModels { if (DataGridItemSource == null) { - Growl.Warning("未勾选数据!"); + Growl.Warning("未勾选单据!"); return; } - //判断是否勾选数据 + //判断是否勾选单据 var selectetOrder = DataGridItemSource.Where(t => t.IsSelected) .FirstOrDefault(); if (selectetOrder == null) { - Growl.Warning("未勾选数据!"); + Growl.Warning("未勾选单据!"); return; } - #region 调用接口获取数据 + #region 调用接口获取单据 var body = new GetStockTakingOrderMatDetailRequest() { @@ -203,19 +203,19 @@ namespace 货架标准上位机.ViewModels { if (DataGridItemSource == null) { - Growl.Warning("未勾选数据!"); + Growl.Warning("未勾选单据!"); return; } - //判断是否勾选数据 + //判断是否勾选单据 var selectedOutOrder = DataGridItemSource.Where(t => t.IsSelected) .FirstOrDefault(); if (selectedOutOrder == null) { - Growl.Warning("未勾选数据!"); + Growl.Warning("未勾选单据!"); return; } - #region 调用接口获取数据 + #region 调用接口获取单据 var body = new GetOutOrderDetailRequest() { OrderId = selectedOutOrder.Id, @@ -267,15 +267,15 @@ namespace 货架标准上位机.ViewModels //是否已搜索 if (DataGridItemSource == null) { - Growl.Warning("未勾选数据!"); + Growl.Warning("未勾选单据!"); return; } - //判断是否已勾选数据 + //判断是否已勾选单据 var selectetOrder = DataGridItemSource.Where(t => t.IsSelected) .FirstOrDefault(); if (selectetOrder == null) { - Growl.Warning("未勾选数据!"); + Growl.Warning("未勾选单据!"); return; } @@ -321,15 +321,15 @@ namespace 货架标准上位机.ViewModels //是否已搜索 if (DataGridItemSource == null) { - Growl.Warning("未勾选数据!"); + Growl.Warning("未勾选单据!"); return; } - //判断是否已勾选数据 + //判断是否已勾选单据 var selectetOrder = DataGridItemSource.Where(t => t.IsSelected) .FirstOrDefault(); if (selectetOrder == null) { - Growl.Warning("未勾选数据!"); + Growl.Warning("未勾选单据!"); return; } @@ -364,6 +364,59 @@ namespace 货架标准上位机.ViewModels { } } + + public ICommand BtnCommitCommand { get => new DelegateCommand(BtnCommit); } + public void BtnCommit() + { + try + { + //是否已搜索 + if (DataGridItemSource == null) + { + Growl.Warning("未勾选单据!"); + return; + } + //判断是否已勾选单据 + var selectetOrder = DataGridItemSource.Where(t => t.IsSelected) + .FirstOrDefault(); + if (selectetOrder == null) + { + Growl.Warning("未勾选单据!"); + return; + } + + #region 调用接口提交盘点 + var body = new GetStockTakingOrderMatDetailRequest() + { + StockTakingOrderId = selectetOrder.Id, + StockTakingOrderNumber = selectetOrder.StocktakingOrderNumber, + UserName = LocalStatic.CurrentUser, + DeviceType = LocalFile.Config.DeviceType, + }; + var Result = ApiHelp.GetDataFromHttp(LocalFile.Config.ApiIpHost + "stockTaking/commitStockTakingOrder", body, "POST"); + if (Result != null && Result.Code == 200) + { + Growl.Warning("单据已提交,库存数据已修改!"); + BtnSearch(); + } + else if (Result != null) + { + Growl.Warning(Result.Message); + } + else + { + Growl.Warning("调用接口失败!"); + } + #endregion + } + catch (Exception ex) + { + Growl.Error("出现异常:" + ex.Message); + } + finally + { + } + } #endregion #region PageOperation 分页操作 diff --git a/货架标准上位机/Views/InOutRecordView.xaml b/货架标准上位机/Views/InOutRecordView.xaml index c62a021..bce9355 100644 --- a/货架标准上位机/Views/InOutRecordView.xaml +++ b/货架标准上位机/Views/InOutRecordView.xaml @@ -54,7 +54,7 @@ ItemsSource="{Binding Items}" Text="{Binding MatCode}" DisplayMemberPath="MatCode"/> - + @@ -62,6 +62,14 @@ VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="18" MinWidth="120" > + + + + @@ -69,19 +77,24 @@ VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="18" MinWidth="120" > - - - + VerticalAlignment="Center" HorizontalAlignment="Right" + Text=" 类 型 :" FontSize="18" > + + +