From 94aa92f536e59fe6f750ba0684474dfef7be0a83 Mon Sep 17 00:00:00 2001 From: hehaibing-1996 Date: Sat, 11 Jan 2025 18:37:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A7=E6=9E=B6=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WCS.BLL/DbModels/STZL/EnableStatusEnum.cs | 17 + WCS.BLL/DbModels/STZL/ShelfInfo.cs | 16 +- WCS.BLL/DbModels/STZL/ShelfTypeInfo.cs | 22 + WCS.BLL/Manager/DbInit.cs | 4 +- .../Services/IService/IMatBaseInfoService.cs | 2 +- .../Services/IService/IStoreInfoService.cs | 5 +- .../Services/Service/MatBaseInfoService.cs | 2 +- WCS.BLL/Services/Service/StoreInfoService.cs | 52 ++- WCS.Model/ApiModel/Home/ShelfTypeModel.cs | 2 +- ...eInfosRequest.cs => DeleteInfosRequest.cs} | 2 +- .../ApiModel/StoreInfo/GetShelvesRequest.cs | 3 +- .../ApiModel/StoreInfo/ShelfInfoModel.cs | 81 +++- WCS.WebApi/Controllers/HomeController.cs | 63 ++- .../Controllers/MatBaseInfoController.cs | 2 +- WCS.WebApi/Controllers/StoreInfoController.cs | 6 + 货架标准上位机/ViewModels/HomeViewModel.cs | 29 -- .../ViewModels/InOutRecordViewModel.cs | 70 +-- .../ViewModels/MatBaseInfoViewModel.cs | 2 +- 货架标准上位机/ViewModels/MatInfoViewModel.cs | 2 +- .../ViewModels/MatInventoryDetailViewModel.cs | 430 +++++++++--------- .../ViewModels/OutInventoryAddDucumentViewModel.cs | 108 ++--- .../ViewModels/ShelfInfoAddOrUpdateViewModel.cs | 120 ++--- .../ViewModels/ShelfInfoViewModel.cs | 122 +++-- 货架标准上位机/Views/MatBaseInfoView.xaml | 5 +- .../Views/ShelfInfoAddOrUpdateView.xaml | 76 +--- .../Views/ShelfInfoAddOrUpdateView.xaml.cs | 36 -- 货架标准上位机/Views/ShelfInfoView.xaml | 46 +- 货架标准上位机/Views/ShelfInfoView.xaml.cs | 9 +- 28 files changed, 697 insertions(+), 637 deletions(-) create mode 100644 WCS.BLL/DbModels/STZL/EnableStatusEnum.cs create mode 100644 WCS.BLL/DbModels/STZL/ShelfTypeInfo.cs rename WCS.Model/ApiModel/MatBaseInfo/{DeleteMatBaseInfosRequest.cs => DeleteInfosRequest.cs} (78%) diff --git a/WCS.BLL/DbModels/STZL/EnableStatusEnum.cs b/WCS.BLL/DbModels/STZL/EnableStatusEnum.cs new file mode 100644 index 0000000..db5d9bc --- /dev/null +++ b/WCS.BLL/DbModels/STZL/EnableStatusEnum.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WCS.BLL.DbModels.STZL +{ + /// + /// 启用禁用状态 + /// + public enum EnableStatusEnum + { + 启用 = 1, + 禁用 = 0 + } +} diff --git a/WCS.BLL/DbModels/STZL/ShelfInfo.cs b/WCS.BLL/DbModels/STZL/ShelfInfo.cs index bf1b586..73f14e9 100644 --- a/WCS.BLL/DbModels/STZL/ShelfInfo.cs +++ b/WCS.BLL/DbModels/STZL/ShelfInfo.cs @@ -18,16 +18,22 @@ namespace WCS.DAL.DbModels public int Id { get; set; } /// - /// 货架编码 对应二维码 - /// - [SugarColumn(ColumnName = "shelf_code", Length = 64, IsNullable = false, ColumnDescription = "货架编码")] - public string ShelfCode { get; set; } + /// 货架类型Id + /// + [SugarColumn(ColumnName = "shelf_type_id", IsNullable = true, ColumnDescription = "货架类型Id")] + public int ShelfTypeId { get; set; } /// /// 货架类型 /// [SugarColumn(ColumnName = "shelf_type", Length = 64, IsNullable = true, ColumnDescription = "货架类型")] - public string ShelfType { get; set; } + public string ShelfTypeName { get; set; } + + /// + /// 货架编码 对应二维码 + /// + [SugarColumn(ColumnName = "shelf_code", Length = 64, IsNullable = false, ColumnDescription = "货架编码")] + public string ShelfCode { get; set; } /// /// 货架状态 货架当前的状态空货架/非空货架 diff --git a/WCS.BLL/DbModels/STZL/ShelfTypeInfo.cs b/WCS.BLL/DbModels/STZL/ShelfTypeInfo.cs new file mode 100644 index 0000000..02c9223 --- /dev/null +++ b/WCS.BLL/DbModels/STZL/ShelfTypeInfo.cs @@ -0,0 +1,22 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WCS.BLL.DbModels +{ + /// + /// 货架类型 + /// + [SugarTable("wcs_shelf_type")] + public class ShelfTypeInfo + { + [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)] + public int Id { get; set; } + + [SugarColumn(ColumnName = "shelf_type_name", Length = 64, IsNullable = true, ColumnDescription = "货架类型名称")] + public string ShelfTypeName { get; set; } + } +} diff --git a/WCS.BLL/Manager/DbInit.cs b/WCS.BLL/Manager/DbInit.cs index eed15c6..47b1cdc 100644 --- a/WCS.BLL/Manager/DbInit.cs +++ b/WCS.BLL/Manager/DbInit.cs @@ -70,11 +70,11 @@ namespace WCS.BLL.Manager DbHelp.dbLog.DbMaintenance.CreateDatabase(); Logs.Write("【初始化数据库】创建数据库", LogsType.StartBoot); - DbHelp.db.CodeFirst.InitTables( typeof(ShelfInfo), typeof(StoreInfo) + DbHelp.db.CodeFirst.InitTables(typeof(ShelfInfo), typeof(StoreInfo), typeof(ShelfTypeInfo) , typeof(InventoryDetail), typeof(OutOrder), typeof(OutOrderDetail), typeof(OutOrderMatDetail) , typeof(MatBaseInfo), typeof(MatInfo) , typeof(StockTakingOrder), typeof(StockTakingOrderMatDetail), typeof(InOutRecord) - , typeof(DocumentSerialNumber), typeof(MatInfoLog) + , typeof(DocumentSerialNumber), typeof(MatInfoLog) , typeof(AppVersion) ); diff --git a/WCS.BLL/Services/IService/IMatBaseInfoService.cs b/WCS.BLL/Services/IService/IMatBaseInfoService.cs index 56aac35..7d55c34 100644 --- a/WCS.BLL/Services/IService/IMatBaseInfoService.cs +++ b/WCS.BLL/Services/IService/IMatBaseInfoService.cs @@ -18,7 +18,7 @@ namespace WCS.BLL.Services.IService public Task> addOrUpdateMatBaseInfo(AddMatBaseInfoRequest request); - public Task> deleteMatBaseInfo(DeleteMatBaseInfosRequest request); + public Task> deleteMatBaseInfo(DeleteInfosRequest request); public Task>> getMatCodeList(GetMatCodeListRequest request); diff --git a/WCS.BLL/Services/IService/IStoreInfoService.cs b/WCS.BLL/Services/IService/IStoreInfoService.cs index 853f421..a1a3814 100644 --- a/WCS.BLL/Services/IService/IStoreInfoService.cs +++ b/WCS.BLL/Services/IService/IStoreInfoService.cs @@ -26,7 +26,10 @@ namespace WCS.BLL.Services.IService /// /// public Task> addOrUpdateShelfInfo(AddShelfInfoRequest request); - + + public Task> deleteShelfInfo(DeleteInfosRequest request); + + /// /// 查询库位列表 /// diff --git a/WCS.BLL/Services/Service/MatBaseInfoService.cs b/WCS.BLL/Services/Service/MatBaseInfoService.cs index 3e2033e..d0786cc 100644 --- a/WCS.BLL/Services/Service/MatBaseInfoService.cs +++ b/WCS.BLL/Services/Service/MatBaseInfoService.cs @@ -349,7 +349,7 @@ namespace WCS.BLL.Services.Service } } - public async Task> deleteMatBaseInfo(DeleteMatBaseInfosRequest request) + public async Task> deleteMatBaseInfo(DeleteInfosRequest request) { //先查询出具体的Id var matBaseInfos = await DbHelp.db.Queryable() diff --git a/WCS.BLL/Services/Service/StoreInfoService.cs b/WCS.BLL/Services/Service/StoreInfoService.cs index 1051f7c..e7d1b6a 100644 --- a/WCS.BLL/Services/Service/StoreInfoService.cs +++ b/WCS.BLL/Services/Service/StoreInfoService.cs @@ -17,6 +17,7 @@ using WCS.DAL.DbModels; using WCS.Model; using WCS.Model.ApiModel; using WCS.Model.ApiModel.InOutRecord; +using WCS.Model.ApiModel.MatBaseInfo; using WCS.Model.ApiModel.StoreInfo; using WCS.Model.ApiModel.User; @@ -30,7 +31,9 @@ namespace WCS.BLL.Services.Service try { var recordsQueryable = DbHelp.db.Queryable() - ; + .WhereIF(request.ShelfTypeId != null, t => t.ShelfTypeId == request.ShelfTypeId) + .WhereIF(request.IsEnable != null, t => t.IsEnable == request.IsEnable) + .WhereIF(!string.IsNullOrEmpty(request.ShelfCode), t => t.ShelfCode.Contains(request.ShelfCode)); var totalCount = await recordsQueryable.CountAsync(); var records = await recordsQueryable @@ -69,6 +72,7 @@ namespace WCS.BLL.Services.Service try { var shelfnfo = await DbHelp.db.Queryable() + .Where(t => t.ShelfCode == request.ShelfInfo.ShelfCode) .FirstAsync(); //修改货架信息 if (request.AddOrUpdate == AddOrUpdate.Update) @@ -83,7 +87,7 @@ namespace WCS.BLL.Services.Service return new ResponseCommon { Code = 201, - Message = $"更新货架信息失败:货架不存在!", + Message = $"更新货架信息失败:该货架不存在!", Data = null }; } @@ -92,14 +96,14 @@ namespace WCS.BLL.Services.Service return new ResponseCommon { Code = 201, - Message = $"更新货架信息失败:已存在货架编码!", + Message = $"更新货架信息失败:货架[{shelfnfo.ShelfCode}]已存在!!", Data = null }; } else { - - var rowNum = await DbHelp.db.Updateable(shelfnfo).ExecuteCommandAsync(); + request.ShelfInfo.ModifyUser = request.UserName; + var rowNum = await DbHelp.db.Updateable(request.ShelfInfo).ExecuteCommandAsync(); if (rowNum == 0) { return new ResponseCommon @@ -127,17 +131,14 @@ namespace WCS.BLL.Services.Service return new ResponseCommon { Code = 201, - Message = $"货架信息失败:货架已存在!", + Message = $"货架信息失败:货架[{shelfnfo.ShelfCode}]已存在!", Data = null }; } else { - var newShelfInfo = new ShelfInfo() - { - - }; - var rowNum = await DbHelp.db.Insertable(newShelfInfo).ExecuteCommandAsync(); + request.ShelfInfo.ModifyUser = request.UserName; + var rowNum = await DbHelp.db.Insertable(request.ShelfInfo).ExecuteCommandAsync(); if (rowNum == 0) { return new ResponseCommon @@ -218,6 +219,35 @@ namespace WCS.BLL.Services.Service } } + public async Task> deleteShelfInfo(DeleteInfosRequest request) + { + //先查询出具体的Id + var shelfInfos = await DbHelp.db.Queryable() + .Where(t => request.MatBaseInfoIds.Contains(t.Id)) + .ToListAsync(); + //执行删除 + try + { + var deleteRows = await DbHelp.db.Deleteable(shelfInfos).ExecuteCommandAsync(); + return new ResponseCommon + { + Code = 200, + Message = $"已删除{deleteRows}条数据!", + Data = null + }; + } + catch (Exception ex) + { + var response = new ResponseCommon + { + Code = 300, + Message = $"操作失败:{ex.Message}", + Data = null + }; + return response; + } + } + #region 模组管理 /// /// 发送指令获取模组的电压值 diff --git a/WCS.Model/ApiModel/Home/ShelfTypeModel.cs b/WCS.Model/ApiModel/Home/ShelfTypeModel.cs index e329cc3..930c07e 100644 --- a/WCS.Model/ApiModel/Home/ShelfTypeModel.cs +++ b/WCS.Model/ApiModel/Home/ShelfTypeModel.cs @@ -6,7 +6,7 @@ namespace WCS.Model.ApiModel.Home { public class ShelfTypeModel { - public int Id { get; set; } + public int? Id { get; set; } public string ShelfTypeName { get; set; } } diff --git a/WCS.Model/ApiModel/MatBaseInfo/DeleteMatBaseInfosRequest.cs b/WCS.Model/ApiModel/MatBaseInfo/DeleteInfosRequest.cs similarity index 78% rename from WCS.Model/ApiModel/MatBaseInfo/DeleteMatBaseInfosRequest.cs rename to WCS.Model/ApiModel/MatBaseInfo/DeleteInfosRequest.cs index 4068572..1407c96 100644 --- a/WCS.Model/ApiModel/MatBaseInfo/DeleteMatBaseInfosRequest.cs +++ b/WCS.Model/ApiModel/MatBaseInfo/DeleteInfosRequest.cs @@ -5,7 +5,7 @@ using WCS.Model.ApiModel.User; namespace WCS.Model.ApiModel.MatBaseInfo { - public class DeleteMatBaseInfosRequest : RequestBase + public class DeleteInfosRequest : RequestBase { public List MatBaseInfoIds { get; set; } } diff --git a/WCS.Model/ApiModel/StoreInfo/GetShelvesRequest.cs b/WCS.Model/ApiModel/StoreInfo/GetShelvesRequest.cs index 1348929..ad8d5fc 100644 --- a/WCS.Model/ApiModel/StoreInfo/GetShelvesRequest.cs +++ b/WCS.Model/ApiModel/StoreInfo/GetShelvesRequest.cs @@ -6,7 +6,8 @@ namespace WCS.Model.ApiModel.StoreInfo { public class GetShelvesRequest : PageQueryRequestBase { - public int ShelfTypeId { get; set; } + public int? ShelfTypeId { get; set; } public string ShelfCode { get; set; } + public bool? IsEnable { get; set; } } } diff --git a/WCS.Model/ApiModel/StoreInfo/ShelfInfoModel.cs b/WCS.Model/ApiModel/StoreInfo/ShelfInfoModel.cs index ad1160d..2ad56fb 100644 --- a/WCS.Model/ApiModel/StoreInfo/ShelfInfoModel.cs +++ b/WCS.Model/ApiModel/StoreInfo/ShelfInfoModel.cs @@ -9,50 +9,85 @@ namespace WCS.Model.ApiModel.StoreInfo { public int Id { get; set; } - public string ShelfCode { get; set; } - public int ShelfTypeId { get; set; } + /// + /// 货架类型ID + /// + public int? ShelfTypeId { get; set; } = 0; /// /// 货架类型名称 /// - public string ShelfTypeName { get; set; } + public string ShelfTypeName { get; set; } = string.Empty; /// - /// 货架当前状态 - /// - public int CurrentMode { get; set; } - /// - /// 货架行数 - /// - public int Rowcounts { get; set; } + /// 货架编码 对应二维码 + /// + public string ShelfCode { get; set; } = string.Empty; /// - /// 货架列数 + /// 货架状态 货架当前的状态空货架/非空货架 /// - public int Columncounts { get; set; } + public ShelfStatusEnum ShelfStatus { get; set; } = ShelfStatusEnum.空货架; /// - /// 货架对应警示灯的Id + /// 货架区域 /// - public int LightId { get; set; } + public string ShelfArea { get; set; } = string.Empty; /// - /// 货架对应Can模块的Ip + /// 货架尺寸 /// - public string ClientIp { get; set; } + public string ShelfSize { get; set; } = string.Empty; /// - /// 货架的组别、区域(区分单个软件管哪些货架的,前端的配置文件配置一个组别,查询时只显示当前组别的货架) + /// 备注 /// - public string GroupName { get; set; } + public string Remark { get; set; } = string.Empty; - public bool IsBind { get; set; } + #region 当前位置信息 + /// + /// 当前位置ID + /// + public int CurrentLocationId { get; set; } = 0; - public string BigShelfCode { get; set; } + /// + /// 当前位置编码 + /// + public string CurrentLocaiotnCode { get; set; } = string.Empty; + #endregion + /// + /// 更新人 + /// + public string ModifyUser { get; set; } = string.Empty; + /// + /// 更新时间 + /// + public DateTime ModifyTime { get; set; } = DateTime.Now; + + /// + /// 是否启用 + /// + public bool IsEnable { get; set; } = true; + + public string IsEnableStr + { + get + { + if (IsEnable) + return "启用"; + else + return "禁用"; + } + } + + /// + /// 序号 + /// public int RowNumber { get; set; } + public bool IsSelected { get { return isSelected; } @@ -70,4 +105,10 @@ namespace WCS.Model.ApiModel.StoreInfo PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } + + public enum ShelfStatusEnum + { + 空货架 = 0, + 非空货架 = 1, + } } diff --git a/WCS.WebApi/Controllers/HomeController.cs b/WCS.WebApi/Controllers/HomeController.cs index 4f31b5f..f850f64 100644 --- a/WCS.WebApi/Controllers/HomeController.cs +++ b/WCS.WebApi/Controllers/HomeController.cs @@ -126,25 +126,6 @@ namespace WCS.WebApi.Controllers } } - [Route("shelfCheckAll")] - [HttpPost(Name = "shelfCheckAll")] - public async Task shelfCheckAll(GetShelfStatusRequest request) - { - try - { - return await _selfCheckService.StartSelfCheckByGroupName(request.GroupNames); - } - catch (Exception ex) - { - return new ResponseBase() - { - Code = 300, - Message = "操作失败:" + ex.Message, - }; - } - } - - /// /// 重置货架的状态 使其回到待机模式 /// @@ -204,8 +185,6 @@ namespace WCS.WebApi.Controllers } } - - /// /// 获取货架对应的服务端的Ip和端口号 /// @@ -230,7 +209,6 @@ namespace WCS.WebApi.Controllers } } - [Route("getWebSocketWarnings")] [HttpPost(Name = "getWebSocketWarnings")] public async Task getWebSocketWarnings(RequestBase request) @@ -254,5 +232,46 @@ namespace WCS.WebApi.Controllers }; } } + + + + + + [Route("getShelfTypes")] + [HttpPost(Name = "getShelfTypes")] + public async Task getShelfTypes(RequestBase request) + { + try + { + //直接获取当前所有货架类型并返回 + var shelfTypes = DbHelp.db.Queryable() + .Select(t => new ShelfTypeModel() + { + Id = t.Id, + ShelfTypeName = t.ShelfTypeName + }) + .ToList(); + return new PageQueryResponse() + { + Code = 200, + Message = "success", + Data = new PageQueryResponseData + { + Lists = shelfTypes, + Count = shelfTypes.Count + } + }; + } + catch (Exception ex) + { + return new PageQueryResponse() + { + Code = 300, + Message = $"查询失败:{ex.Message}", + }; + } + } + + } } diff --git a/WCS.WebApi/Controllers/MatBaseInfoController.cs b/WCS.WebApi/Controllers/MatBaseInfoController.cs index 9313fae..ff063b7 100644 --- a/WCS.WebApi/Controllers/MatBaseInfoController.cs +++ b/WCS.WebApi/Controllers/MatBaseInfoController.cs @@ -96,7 +96,7 @@ namespace WCS.WebApi.Controllers } [HttpPost("deleteMatBaseInfo")] - public async Task> deleteMatBaseInfo(DeleteMatBaseInfosRequest request) + public async Task> deleteMatBaseInfo(DeleteInfosRequest request) { return await _matBaseInfoService.deleteMatBaseInfo(request); } diff --git a/WCS.WebApi/Controllers/StoreInfoController.cs b/WCS.WebApi/Controllers/StoreInfoController.cs index a9527d6..1634100 100644 --- a/WCS.WebApi/Controllers/StoreInfoController.cs +++ b/WCS.WebApi/Controllers/StoreInfoController.cs @@ -36,6 +36,12 @@ namespace WCS.WebApi.Controllers { return await _storeInfoService.addOrUpdateShelfInfo(request); } + + [HttpPost("deleteShelfInfo")] + public async Task> deleteShelfInfo(DeleteInfosRequest request) + { + return await _storeInfoService.deleteShelfInfo(request); + } #endregion #region 库位管理 diff --git a/货架标准上位机/ViewModels/HomeViewModel.cs b/货架标准上位机/ViewModels/HomeViewModel.cs index 7ecad09..2b8ed12 100644 --- a/货架标准上位机/ViewModels/HomeViewModel.cs +++ b/货架标准上位机/ViewModels/HomeViewModel.cs @@ -111,36 +111,7 @@ namespace 智慧物流软件系统.ViewModel public void SelfCheck() { #region 调用接口请求后台进行自检 - lock (this) - { - try - { - var body = new GetShelfStatusRequest() - { - UserName = LocalStatic.CurrentUser, - DeviceType = "WCS前端", - GroupNames = LocalFile.Config.GroupName, - }; - var Result = ApiHelp.GetDataFromHttp(LocalFile.Config.ApiIpHost + "home/shelfCheckAll", body, "POST",true); - if (Result != null && Result.Code == 200) - { - - } - else - { - } - Thread.Sleep(20); - } - catch (Exception ex) - { - - } - finally - { - - } - } #endregion } #endregion diff --git a/货架标准上位机/ViewModels/InOutRecordViewModel.cs b/货架标准上位机/ViewModels/InOutRecordViewModel.cs index 08e337b..4f6f0c2 100644 --- a/货架标准上位机/ViewModels/InOutRecordViewModel.cs +++ b/货架标准上位机/ViewModels/InOutRecordViewModel.cs @@ -267,44 +267,44 @@ namespace 智慧物流软件系统.ViewModel CurrentPage = 1; return; } - #region 调用接口获取数据 - var dia = Dialog.Show(new TextDialog()); - try - { - var body = new GetInOutRecordRequest() - { + //#region 调用接口获取数据 + //var dia = Dialog.Show(new TextDialog()); + //try + //{ + // var body = new GetInOutRecordRequest() + // { - MatSN = MatSN, - MatName = MatName, - MatBatch = MatBatch, - MatCode = MatCode, - StoreCode = StoreCode, - Direction = SelectedDirection, + // MatSN = MatSN, + // MatName = MatName, + // MatBatch = MatBatch, + // MatCode = MatCode, + // StoreCode = StoreCode, + // Direction = SelectedDirection, - ShelfTypeId = SelectedShelfTypeItem == null ? 0 : SelectedShelfTypeItem.Id, + // ShelfTypeId = SelectedShelfTypeItem == null ? 0 : SelectedShelfTypeItem.Id, - UserName = LocalStatic.CurrentUser, - DeviceType = LocalFile.Config.DeviceType, - PageNumber = CurrentPage, - PageSize = PageSize, - }; - var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "inOutRecord/getInOutRecord", body, "POST"); - if (Result != null && Result.Data != null && Result.Data.Lists != null) - { - DataGridItemSource = Result.Data.Lists; - MaxPage = Result.Data.MaxPage; - TotalCount = Result.Data.TotalCount; - } - } - catch (Exception ex) - { - Growl.Error("加载数据失败:" + ex.Message); - } - finally - { - dia.Close(); - } - #endregion + // UserName = LocalStatic.CurrentUser, + // DeviceType = LocalFile.Config.DeviceType, + // PageNumber = CurrentPage, + // PageSize = PageSize, + // }; + // var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "inOutRecord/getInOutRecord", body, "POST"); + // if (Result != null && Result.Data != null && Result.Data.Lists != null) + // { + // DataGridItemSource = Result.Data.Lists; + // MaxPage = Result.Data.MaxPage; + // TotalCount = Result.Data.TotalCount; + // } + //} + //catch (Exception ex) + //{ + // Growl.Error("加载数据失败:" + ex.Message); + //} + //finally + //{ + // dia.Close(); + //} + //#endregion } public ICommand BtnExportCommand { get => new DelegateCommand(BtnExport); } diff --git a/货架标准上位机/ViewModels/MatBaseInfoViewModel.cs b/货架标准上位机/ViewModels/MatBaseInfoViewModel.cs index 586bf89..7cf6181 100644 --- a/货架标准上位机/ViewModels/MatBaseInfoViewModel.cs +++ b/货架标准上位机/ViewModels/MatBaseInfoViewModel.cs @@ -348,7 +348,7 @@ namespace 智慧物流软件系统.ViewModel } else { - var body = new DeleteMatBaseInfosRequest() + var body = new DeleteInfosRequest() { UserName = LocalStatic.CurrentUser, DeviceType = LocalFile.Config.DeviceType, diff --git a/货架标准上位机/ViewModels/MatInfoViewModel.cs b/货架标准上位机/ViewModels/MatInfoViewModel.cs index 76acb41..27e2223 100644 --- a/货架标准上位机/ViewModels/MatInfoViewModel.cs +++ b/货架标准上位机/ViewModels/MatInfoViewModel.cs @@ -222,7 +222,7 @@ namespace 智慧物流软件系统.ViewModel } else { - var body = new DeleteMatBaseInfosRequest() + var body = new DeleteInfosRequest() { UserName = LocalStatic.CurrentUser, DeviceType = LocalFile.Config.DeviceType, diff --git a/货架标准上位机/ViewModels/MatInventoryDetailViewModel.cs b/货架标准上位机/ViewModels/MatInventoryDetailViewModel.cs index 2451709..43c5490 100644 --- a/货架标准上位机/ViewModels/MatInventoryDetailViewModel.cs +++ b/货架标准上位机/ViewModels/MatInventoryDetailViewModel.cs @@ -241,48 +241,48 @@ namespace 智慧物流软件系统.ViewModel return; } - #region 调用接口获取数据 - var dia = Dialog.Show(new TextDialog()); - try - { - var body = new GetMatInventoryDetailRequest() - { - MatName = MatName, - MatSN = MatSN, - MatBatch = MatBatch, - MatCode = MatCode, - StoreCode = StoreCode, + //#region 调用接口获取数据 + //var dia = Dialog.Show(new TextDialog()); + //try + //{ + // var body = new GetMatInventoryDetailRequest() + // { + // MatName = MatName, + // MatSN = MatSN, + // MatBatch = MatBatch, + // MatCode = MatCode, + // StoreCode = StoreCode, - ShelfTypeId = SelectedShelfTypeItem == null ? 0 : SelectedShelfTypeItem.Id, - ShelfCode = ShelfCode, + // ShelfTypeId = SelectedShelfTypeItem == null ? 0 : SelectedShelfTypeItem.Id, + // ShelfCode = ShelfCode, - UserName = LocalStatic.CurrentUser, - DeviceType = LocalFile.Config.DeviceType, - PageNumber = CurrentPage, - PageSize = PageSize, - }; - var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "matInventoryDetail/getMatInventoryDetail", body, "POST"); - if (Result != null && Result.Data != null && Result.Data.Lists != null) - { - DataGridItemSource = Result.Data.Lists; - MaxPage = Result.Data.MaxPage; - TotalCount = Result.Data.TotalCount; - TotalQtyStr = "物料总数量" + Result.Message; - } - else - { - TotalQtyStr = string.Empty; - } - } - catch (Exception ex) - { - Growl.Error("加载数据失败:" + ex.Message); - } - finally - { - dia.Close(); - } - #endregion + // UserName = LocalStatic.CurrentUser, + // DeviceType = LocalFile.Config.DeviceType, + // PageNumber = CurrentPage, + // PageSize = PageSize, + // }; + // var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "matInventoryDetail/getMatInventoryDetail", body, "POST"); + // if (Result != null && Result.Data != null && Result.Data.Lists != null) + // { + // DataGridItemSource = Result.Data.Lists; + // MaxPage = Result.Data.MaxPage; + // TotalCount = Result.Data.TotalCount; + // TotalQtyStr = "物料总数量" + Result.Message; + // } + // else + // { + // TotalQtyStr = string.Empty; + // } + //} + //catch (Exception ex) + //{ + // Growl.Error("加载数据失败:" + ex.Message); + //} + //finally + //{ + // dia.Close(); + //} + //#endregion } public ICommand BtnExportCommand { get => new DelegateCommand(BtnExport); } @@ -331,95 +331,95 @@ namespace 智慧物流软件系统.ViewModel { try { - #region 调用接口获取物料SN - try - { - var body = new GetMatInventoryDetailRequest() - { - MatName = MatName, - MatSN = MatSN, - MatBatch = MatBatch, - MatCode = MatCode, - StoreCode = StoreCode, + //#region 调用接口获取物料SN + //try + //{ + // var body = new GetMatInventoryDetailRequest() + // { + // MatName = MatName, + // MatSN = MatSN, + // MatBatch = MatBatch, + // MatCode = MatCode, + // StoreCode = StoreCode, - ShelfTypeId = SelectedShelfTypeItem == null ? 0 : SelectedShelfTypeItem.Id, - ShelfCode = ShelfCode, + // ShelfTypeId = SelectedShelfTypeItem == null ? 0 : SelectedShelfTypeItem.Id, + // ShelfCode = ShelfCode, - UserName = LocalStatic.CurrentUser, - DeviceType = LocalFile.Config.DeviceType, - PageNumber = 1, - PageSize = 65535, - }; - var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "matInventoryDetail/getMatInventoryDetail", body, "POST"); - if (Result != null && Result.Data != null && Result.Data.Lists != null) - { - //获取搜索条件返回数据中未锁定的物料 - var unLockedMatSns = Result.Data.Lists.Where(t => t.IsLocked == false) - .Select(t => t.MatSN) - .ToList(); + // UserName = LocalStatic.CurrentUser, + // DeviceType = LocalFile.Config.DeviceType, + // PageNumber = 1, + // PageSize = 65535, + // }; + // var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "matInventoryDetail/getMatInventoryDetail", body, "POST"); + // if (Result != null && Result.Data != null && Result.Data.Lists != null) + // { + // //获取搜索条件返回数据中未锁定的物料 + // var unLockedMatSns = Result.Data.Lists.Where(t => t.IsLocked == false) + // .Select(t => t.MatSN) + // .ToList(); - if (unLockedMatSns.Count == 0) - { - HandyControl.Controls.MessageBox.Show("根据您的搜索条件不存在可以出库的物料(或物料已全部被锁定)!"); - return; - } - //提示 是否生成出库单 - var result = HandyControl.Controls.MessageBox.Show($"根据您的搜索条件,共有{unLockedMatSns.Count}盘未锁定的物料,是否生成出库单并锁定物料?", "提示", MessageBoxButton.OKCancel); + // if (unLockedMatSns.Count == 0) + // { + // HandyControl.Controls.MessageBox.Show("根据您的搜索条件不存在可以出库的物料(或物料已全部被锁定)!"); + // return; + // } + // //提示 是否生成出库单 + // var result = HandyControl.Controls.MessageBox.Show($"根据您的搜索条件,共有{unLockedMatSns.Count}盘未锁定的物料,是否生成出库单并锁定物料?", "提示", MessageBoxButton.OKCancel); - if (result == MessageBoxResult.OK) - { - var dia = Dialog.Show(new TextDialog()); - try - { - #region 调用接口生成出库单据 - var body1 = new SysOutOrderByMatSnRequest() - { - OrderType = "出库", - OrderSource = "WCS前端-库存数据出库", - SnList = unLockedMatSns, - DeviceType = LocalFile.Config.DeviceType, - UserName = LocalStatic.CurrentUser - }; - var Result1 = ApiHelp.GetDataFromHttp(LocalFile.Config.ApiIpHost + "outstore/sysOutOrderByMatSn", body1, "POST"); - if (Result1 != null && Result1.Code == 200) - { - App.Current.Dispatcher.Invoke(() => - { - dia.Close(); - dia.Collapse(); - HandyControl.Controls.MessageBox.Show(Result1.Message); - }); - } - else if (Result1 != null) - { - Growl.Warning(Result1.Message); - } + // if (result == MessageBoxResult.OK) + // { + // var dia = Dialog.Show(new TextDialog()); + // try + // { + // #region 调用接口生成出库单据 + // var body1 = new SysOutOrderByMatSnRequest() + // { + // OrderType = "出库", + // OrderSource = "WCS前端-库存数据出库", + // SnList = unLockedMatSns, + // DeviceType = LocalFile.Config.DeviceType, + // UserName = LocalStatic.CurrentUser + // }; + // var Result1 = ApiHelp.GetDataFromHttp(LocalFile.Config.ApiIpHost + "outstore/sysOutOrderByMatSn", body1, "POST"); + // if (Result1 != null && Result1.Code == 200) + // { + // App.Current.Dispatcher.Invoke(() => + // { + // dia.Close(); + // dia.Collapse(); + // HandyControl.Controls.MessageBox.Show(Result1.Message); + // }); + // } + // else if (Result1 != null) + // { + // Growl.Warning(Result1.Message); + // } - #endregion - } - catch (Exception ex) - { - Growl.Error("生成出库单据失败:" + ex.Message); - } - finally - { - App.Current.Dispatcher.Invoke(() => - { - dia.Close(); - dia.Collapse(); - }); - } - } - } - } - catch (Exception ex) - { - Growl.Error("获取数据失败:" + ex.Message); - } - finally - { - } - #endregion + // #endregion + // } + // catch (Exception ex) + // { + // Growl.Error("生成出库单据失败:" + ex.Message); + // } + // finally + // { + // App.Current.Dispatcher.Invoke(() => + // { + // dia.Close(); + // dia.Collapse(); + // }); + // } + // } + // } + //} + //catch (Exception ex) + //{ + // Growl.Error("获取数据失败:" + ex.Message); + //} + //finally + //{ + //} + //#endregion } catch (Exception ex) { @@ -430,102 +430,102 @@ namespace 智慧物流软件系统.ViewModel public ICommand BtnGenerateStocktakingCommand { get => new DelegateCommand(BtnGenerateStocktaking); } public void BtnGenerateStocktaking() { - try - { - #region 调用接口获取物料SN - try - { - var body = new GetMatInventoryDetailRequest() - { - MatName = MatName, - MatSN = MatSN, - MatBatch = MatBatch, - MatCode = MatCode, - StoreCode = StoreCode, + //try + //{ + // #region 调用接口获取物料SN + // try + // { + // var body = new GetMatInventoryDetailRequest() + // { + // MatName = MatName, + // MatSN = MatSN, + // MatBatch = MatBatch, + // MatCode = MatCode, + // StoreCode = StoreCode, - ShelfTypeId = SelectedShelfTypeItem == null ? 0 : SelectedShelfTypeItem.Id, - ShelfCode = ShelfCode, + // ShelfTypeId = SelectedShelfTypeItem == null ? 0 : SelectedShelfTypeItem.Id, + // ShelfCode = ShelfCode, - UserName = LocalStatic.CurrentUser, - DeviceType = LocalFile.Config.DeviceType, - PageNumber = CurrentPage, - PageSize = 65535, - }; - var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "matInventoryDetail/getMatInventoryDetail", body, "POST"); - if (Result != null && Result.Data != null && Result.Data.Lists != null) - { - //获取搜索条件返回数据中未锁定的物料 - var unLockedMatSns = Result.Data.Lists.Where(t => t.IsLocked == false) - .Select(t => t.MatSN) - .ToList(); + // UserName = LocalStatic.CurrentUser, + // DeviceType = LocalFile.Config.DeviceType, + // PageNumber = CurrentPage, + // PageSize = 65535, + // }; + // var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "matInventoryDetail/getMatInventoryDetail", body, "POST"); + // if (Result != null && Result.Data != null && Result.Data.Lists != null) + // { + // //获取搜索条件返回数据中未锁定的物料 + // var unLockedMatSns = Result.Data.Lists.Where(t => t.IsLocked == false) + // .Select(t => t.MatSN) + // .ToList(); - if (unLockedMatSns.Count == 0) - { - HandyControl.Controls.MessageBox.Show("根据您的搜索条件不存在可以盘点的物料!"); - return; - } - //提示 是否生成出库单 - var result = HandyControl.Controls.MessageBox.Show($"根据您的搜索条件,共有{unLockedMatSns.Count}盘未锁定的物料,是否生成盘点单?", "提示", MessageBoxButton.OKCancel); + // if (unLockedMatSns.Count == 0) + // { + // HandyControl.Controls.MessageBox.Show("根据您的搜索条件不存在可以盘点的物料!"); + // return; + // } + // //提示 是否生成出库单 + // var result = HandyControl.Controls.MessageBox.Show($"根据您的搜索条件,共有{unLockedMatSns.Count}盘未锁定的物料,是否生成盘点单?", "提示", MessageBoxButton.OKCancel); - if (result == MessageBoxResult.OK) - { - var dia = Dialog.Show(new TextDialog()); - try - { - #region 调用接口生成盘点单据 - var body1 = new SysStockTakingOrderRequest() - { - StocktakingOrderType = "snList", - StocktakingOrderSource = "WCS前端-库存数据", - List = unLockedMatSns, - DeviceType = LocalFile.Config.DeviceType, - UserName = LocalStatic.CurrentUser - }; - var Result1 = ApiHelp.GetDataFromHttp(LocalFile.Config.ApiIpHost + "stockTaking/sysStockTakingOrder", body1, "POST"); - if (Result1 != null && Result1.Code == 200) - { - App.Current.Dispatcher.Invoke(() => - { - dia.Close(); - dia.Collapse(); - HandyControl.Controls.MessageBox.Show(Result1.Message); - }); - } - else if (Result1 != null) - { - Growl.Warning(Result1.Message); - } + // if (result == MessageBoxResult.OK) + // { + // var dia = Dialog.Show(new TextDialog()); + // try + // { + // #region 调用接口生成盘点单据 + // var body1 = new SysStockTakingOrderRequest() + // { + // StocktakingOrderType = "snList", + // StocktakingOrderSource = "WCS前端-库存数据", + // List = unLockedMatSns, + // DeviceType = LocalFile.Config.DeviceType, + // UserName = LocalStatic.CurrentUser + // }; + // var Result1 = ApiHelp.GetDataFromHttp(LocalFile.Config.ApiIpHost + "stockTaking/sysStockTakingOrder", body1, "POST"); + // if (Result1 != null && Result1.Code == 200) + // { + // App.Current.Dispatcher.Invoke(() => + // { + // dia.Close(); + // dia.Collapse(); + // HandyControl.Controls.MessageBox.Show(Result1.Message); + // }); + // } + // else if (Result1 != null) + // { + // Growl.Warning(Result1.Message); + // } - #endregion - } - catch (Exception ex) - { - Growl.Error("生成盘点单据失败:" + ex.Message); - } - finally - { - App.Current.Dispatcher.Invoke(() => - { - dia.Close(); - dia.Collapse(); - }); - } - } - } - } - catch (Exception ex) - { - Growl.Error("获取数据失败:" + ex.Message); - } - finally - { - } - #endregion - } - catch (Exception ex) - { - Growl.Error("导出失败:" + ex.Message); - } + // #endregion + // } + // catch (Exception ex) + // { + // Growl.Error("生成盘点单据失败:" + ex.Message); + // } + // finally + // { + // App.Current.Dispatcher.Invoke(() => + // { + // dia.Close(); + // dia.Collapse(); + // }); + // } + // } + // } + // } + // catch (Exception ex) + // { + // Growl.Error("获取数据失败:" + ex.Message); + // } + // finally + // { + // } + // #endregion + //} + //catch (Exception ex) + //{ + // Growl.Error("导出失败:" + ex.Message); + //} } #endregion diff --git a/货架标准上位机/ViewModels/OutInventoryAddDucumentViewModel.cs b/货架标准上位机/ViewModels/OutInventoryAddDucumentViewModel.cs index a722544..80ef7e3 100644 --- a/货架标准上位机/ViewModels/OutInventoryAddDucumentViewModel.cs +++ b/货架标准上位机/ViewModels/OutInventoryAddDucumentViewModel.cs @@ -115,22 +115,22 @@ namespace 智慧物流软件系统.ViewModels { HandyControl.Controls.MessageBox.Show("请选择货架类型!"); } - var window = new OutInventoryAddMatView(SelectedShelfTypeItem.Id); - window.Owner = Application.Current.MainWindow; - window.Topmost = true; + //var window = new OutInventoryAddMatView(SelectedShelfTypeItem.Id); + //window.Owner = Application.Current.MainWindow; + //window.Topmost = true; - var result = window.ShowDialog(); - if (result == true) - { - if (DataGridItemSource == null) - DataGridItemSource = new ObservableCollection(); - DataGridItemSource.Add(window.inventorySummary); - SelectedTypeCount = DataGridItemSource.Count; - } - else - { - return; - } + //var result = window.ShowDialog(); + //if (result == true) + //{ + // if (DataGridItemSource == null) + // DataGridItemSource = new ObservableCollection(); + // DataGridItemSource.Add(window.inventorySummary); + // SelectedTypeCount = DataGridItemSource.Count; + //} + //else + //{ + // return; + //} } public ICommand DelCommand { get => new DelegateCommand(Del); } @@ -185,45 +185,45 @@ namespace 智慧物流软件系统.ViewModels // return; //} } - #region 调用接口生成出库单据 - try - { - var body = new SysOutOrderByMatCodeRequest() - { - OrderType = "出库", - OrderSource = "WCS前端", - ShelfTypeId = SelectedShelfTypeItem.Id, - ShelfTypeName = SelectedShelfTypeItem.ShelfTypeName, - ItemList = DataGridItemSource.Select(t => new MatCodeItemList() - { - MatCode = t.MatCode, - MatName = t.MatName, - MatBatch = t.MatBatch, - ReqQty = t.NeedQty, - }).ToList(), - DeviceType = LocalFile.Config.DeviceType, - UserName = LocalStatic.CurrentUser - }; - var Result = ApiHelp.GetDataFromHttp(LocalFile.Config.ApiIpHost + "outstore/sysOutOrderByMatCode", body, "POST"); - if (Result != null && Result.Code == 200) - { - Growl.Success(Result.Message); - OnRequestClose(true); - } - else if (Result != null) - { - Growl.Warning(Result.Message); - return; - } - } - catch (Exception ex) - { - Growl.Error("加载数据失败:" + ex.Message); - } - finally - { - } - #endregion + //#region 调用接口生成出库单据 + //try + //{ + // var body = new SysOutOrderByMatCodeRequest() + // { + // OrderType = "出库", + // OrderSource = "WCS前端", + // ShelfTypeId = SelectedShelfTypeItem.Id, + // ShelfTypeName = SelectedShelfTypeItem.ShelfTypeName, + // ItemList = DataGridItemSource.Select(t => new MatCodeItemList() + // { + // MatCode = t.MatCode, + // MatName = t.MatName, + // MatBatch = t.MatBatch, + // ReqQty = t.NeedQty, + // }).ToList(), + // DeviceType = LocalFile.Config.DeviceType, + // UserName = LocalStatic.CurrentUser + // }; + // var Result = ApiHelp.GetDataFromHttp(LocalFile.Config.ApiIpHost + "outstore/sysOutOrderByMatCode", body, "POST"); + // if (Result != null && Result.Code == 200) + // { + // Growl.Success(Result.Message); + // OnRequestClose(true); + // } + // else if (Result != null) + // { + // Growl.Warning(Result.Message); + // return; + // } + //} + //catch (Exception ex) + //{ + // Growl.Error("加载数据失败:" + ex.Message); + //} + //finally + //{ + //} + //#endregion } #endregion } diff --git a/货架标准上位机/ViewModels/ShelfInfoAddOrUpdateViewModel.cs b/货架标准上位机/ViewModels/ShelfInfoAddOrUpdateViewModel.cs index c735292..dcfb5a4 100644 --- a/货架标准上位机/ViewModels/ShelfInfoAddOrUpdateViewModel.cs +++ b/货架标准上位机/ViewModels/ShelfInfoAddOrUpdateViewModel.cs @@ -22,19 +22,22 @@ namespace 智慧物流软件系统.ViewModel public void SetValues(ShelfInfoModel shelfInfoModel) { - if (shelfInfoModel != null) + if (shelfInfoModel == null) { - ShelfId = shelfInfoModel.Id; - SelectedShelfTypeItem = shelfTypeItems.First(t => t.Id == shelfInfoModel.ShelfTypeId); - ShelfCode = shelfInfoModel.ShelfCode; - RowCounts = shelfInfoModel.Rowcounts; - ColumnCounts = shelfInfoModel.Columncounts; - LightId = shelfInfoModel.LightId; - ClientIp = shelfInfoModel.ClientIp; - GroupName = shelfInfoModel.GroupName; - IsBind = shelfInfoModel.IsBind; - BigShelfCode = shelfInfoModel.BigShelfCode; + shelfInfoModel = new ShelfInfoModel(); } + ShelfId = shelfInfoModel.Id; + + var item = ShelfTypeItems.FirstOrDefault(t => t.Id == shelfInfoModel.ShelfTypeId); + if (item != null) + { + SelectedShelfTypeItem = item; + } + ShelfCode = shelfInfoModel.ShelfCode; + ShelfSize = shelfInfoModel.ShelfSize; + Remark = shelfInfoModel.Remark; + IsEnable = shelfInfoModel.IsEnable; + } public ShelfInfoModel GetValues() @@ -45,27 +48,12 @@ namespace 智慧物流软件系统.ViewModel ShelfTypeId = SelectedShelfTypeItem.Id, ShelfTypeName = SelectedShelfTypeItem.ShelfTypeName, ShelfCode = ShelfCode, - Rowcounts = RowCounts, - Columncounts = ColumnCounts, - LightId = LightId, - ClientIp = ClientIp, - GroupName = GroupName, - IsBind = IsBind, - BigShelfCode = BigShelfCode, + ShelfSize = ShelfSize, + Remark = Remark, + IsEnable = IsEnable, }; } - private int shelfId; - public int ShelfId - { - get { return shelfId; } - set - { - SetProperty(ref shelfId, value); - } - } - - private List shelfTypeItems; public List ShelfTypeItems { @@ -86,6 +74,16 @@ namespace 智慧物流软件系统.ViewModel } } + private int shelfId; + public int ShelfId + { + get { return shelfId; } + set + { + SetProperty(ref shelfId, value); + } + } + private string shelfCode; public string ShelfCode { @@ -96,73 +94,33 @@ namespace 智慧物流软件系统.ViewModel } } - private int rowCounts; - public int RowCounts + private string shelfSize; + public string ShelfSize { - get { return rowCounts; } + get { return shelfSize; } set { - SetProperty(ref rowCounts, value); + SetProperty(ref shelfSize, value); } } - private int columnCounts; - public int ColumnCounts + private string remark; + public string Remark { - get { return columnCounts; } + get { return remark; } set { - SetProperty(ref columnCounts, value); + SetProperty(ref remark, value); } } - private int lightId; - public int LightId + private bool isEnable; + public bool IsEnable { - get { return lightId; } + get { return isEnable; } set { - SetProperty(ref lightId, value); - } - } - - private string clientIp; - public string ClientIp - { - get { return clientIp; } - set - { - SetProperty(ref clientIp, value); - } - } - - private string groupName; - public string GroupName - { - get { return groupName; } - set - { - SetProperty(ref groupName, value); - } - } - - private bool isBind; - public bool IsBind - { - get { return isBind; } - set - { - SetProperty(ref isBind, value); - } - } - - private string bigShelfCode; - public string BigShelfCode - { - get { return bigShelfCode; } - set - { - SetProperty(ref bigShelfCode, value); + SetProperty(ref isEnable, value); } } #endregion diff --git a/货架标准上位机/ViewModels/ShelfInfoViewModel.cs b/货架标准上位机/ViewModels/ShelfInfoViewModel.cs index fc6facc..47eb15c 100644 --- a/货架标准上位机/ViewModels/ShelfInfoViewModel.cs +++ b/货架标准上位机/ViewModels/ShelfInfoViewModel.cs @@ -52,7 +52,7 @@ namespace 智慧物流软件系统.ViewModel /// - /// 物料批次 + /// 货架编号 /// private string shelfCode; public string ShelfCode @@ -73,11 +73,25 @@ namespace 智慧物流软件系统.ViewModel SetProperty(ref shelfTypeItems, value); } } + + private ShelfTypeModel? selectedShelfTypeItem; + public ShelfTypeModel? SelectedShelfTypeItem + { + get { return selectedShelfTypeItem; } + set + { + SetProperty(ref selectedShelfTypeItem, value); + } + } + public void InitShelfTypeItems() { //调用接口更新! Task.Run(() => { + ShelfTypeItems = new List(); + ShelfTypeItems.Add(new ShelfTypeModel { Id = null, ShelfTypeName = "全部" }); + var body = new RequestBase() { UserName = LocalStatic.CurrentUser, @@ -87,18 +101,23 @@ namespace 智慧物流软件系统.ViewModel 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; + ShelfTypeItems.AddRange(Result.Data.Lists); } + + SelectedShelfTypeItem = ShelfTypeItems.FirstOrDefault(); }); } - private ShelfTypeModel selectedShelfTypeItem; - public ShelfTypeModel SelectedShelfTypeItem + /// + /// 启用状态 + /// + private bool? isEnable; + public bool? IsEnable { - get { return selectedShelfTypeItem; } + get { return isEnable; } set { - SetProperty(ref selectedShelfTypeItem, value); + SetProperty(ref isEnable, value); } } #endregion @@ -107,8 +126,12 @@ namespace 智慧物流软件系统.ViewModel public ICommand BtnResetCommand { get => new DelegateCommand(BtnReset); } public void BtnReset() { - SelectedShelfTypeItem = null; + if (ShelfTypeItems != null) + { + SelectedShelfTypeItem = ShelfTypeItems.FirstOrDefault(); + } ShelfCode = string.Empty; + IsEnable = null; } public ICommand BtnSearchCommand { get => new DelegateCommand(BtnSearchReset); } @@ -130,8 +153,9 @@ namespace 智慧物流软件系统.ViewModel { var body = new GetShelvesRequest() { - ShelfTypeId = SelectedShelfTypeItem == null ? 0 : SelectedShelfTypeItem.Id, + ShelfTypeId = SelectedShelfTypeItem == null ? null : SelectedShelfTypeItem.Id, ShelfCode = ShelfCode, + IsEnable = IsEnable, UserName = LocalStatic.CurrentUser, DeviceType = LocalFile.Config.DeviceType, PageNumber = CurrentPage, @@ -194,32 +218,68 @@ namespace 智慧物流软件系统.ViewModel public ICommand BtnDeleteCommand { get => new DelegateCommand(BtnDelete); } public void BtnDelete() { - //查询勾选的第一个数据 - var shelfInfo = DataGridItemSource?.Where(t => t.IsSelected == true).FirstOrDefault(); - if (shelfInfo == null) + Growl.Ask($"是否删除所有勾选的数据?", isConfirmed => { - Growl.Warning("请选择需要删除的数据!"); - } - else - { - var body = new AddShelfInfoRequest() + if (isConfirmed) { - UserName = LocalStatic.CurrentUser, - DeviceType = LocalFile.Config.DeviceType, - ShelfInfo = shelfInfo, - AddOrUpdate = AddOrUpdate.Delete - }; - var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "storeInfo/addOrUpdateShelfInfo", body, "POST"); - if (Result != null && Result.Code == 200) - { - Growl.Success("删除成功!"); - CurrentPage = 1; + //查询勾选的第一个数据 + var matBaseInfoIds = DataGridItemSource?.Where(t => t.IsSelected == true) + .Select(t => t.Id) + .ToList(); + + if (matBaseInfoIds == null) + { + Growl.Warning("请选择需要修改的数据!"); + } + else + { + var body = new DeleteInfosRequest() + { + UserName = LocalStatic.CurrentUser, + DeviceType = LocalFile.Config.DeviceType, + MatBaseInfoIds = matBaseInfoIds, + }; + var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "storeInfo/deleteShelfInfo", body, "POST"); + if (Result != null && Result.Code == 200) + { + BtnSearch(); + Growl.Success("删除成功!" + Result?.Message); + } + else + { + Growl.Error($"{Result?.Message?.ToString()}"); + } + } } - else - { - Growl.Error($"{Result?.Message?.ToString()}"); - } - } + return true; + }); + + ////查询勾选的第一个数据 + //var shelfInfo = DataGridItemSource?.Where(t => t.IsSelected == true).FirstOrDefault(); + //if (shelfInfo == null) + //{ + // Growl.Warning("请选择需要删除的数据!"); + //} + //else + //{ + // var body = new AddShelfInfoRequest() + // { + // UserName = LocalStatic.CurrentUser, + // DeviceType = LocalFile.Config.DeviceType, + // ShelfInfo = shelfInfo, + // AddOrUpdate = AddOrUpdate.Delete + // }; + // var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "storeInfo/addOrUpdateShelfInfo", body, "POST"); + // if (Result != null && Result.Code == 200) + // { + // Growl.Success("删除成功!"); + // CurrentPage = 1; + // } + // else + // { + // Growl.Error($"{Result?.Message?.ToString()}"); + // } + //} } #endregion diff --git a/货架标准上位机/Views/MatBaseInfoView.xaml b/货架标准上位机/Views/MatBaseInfoView.xaml index af32e5e..8c330f8 100644 --- a/货架标准上位机/Views/MatBaseInfoView.xaml +++ b/货架标准上位机/Views/MatBaseInfoView.xaml @@ -53,12 +53,11 @@ + Text="启用状态:" FontSize="18" > + SelectedValuePath="Tag" SelectedValue="{Binding IsEnable}"> 全部 启用 禁用 diff --git a/货架标准上位机/Views/ShelfInfoAddOrUpdateView.xaml b/货架标准上位机/Views/ShelfInfoAddOrUpdateView.xaml index e39d361..6375c3a 100644 --- a/货架标准上位机/Views/ShelfInfoAddOrUpdateView.xaml +++ b/货架标准上位机/Views/ShelfInfoAddOrUpdateView.xaml @@ -7,7 +7,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:hc="https://handyorg.github.io/handycontrol" mc:Ignorable="d" - Height="440" Width="320" WindowStyle="None" BorderThickness="0" Background="{x:Null}" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Opacity="1"> + Height="280" Width="320" WindowStyle="None" BorderThickness="0" Background="{x:Null}" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Opacity="1"> @@ -24,7 +24,7 @@ - + - + - + + Text="{Binding ShelfSize}"> - - - + + Text="{Binding Remark}"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - 启用 - 禁用 + SelectedValuePath="Tag" SelectedValue="{Binding IsEnable}"> + 启用 + 禁用 - - - - - + - - - - - - - - - + + + + + + + @@ -141,8 +149,6 @@ - - diff --git a/货架标准上位机/Views/ShelfInfoView.xaml.cs b/货架标准上位机/Views/ShelfInfoView.xaml.cs index 7b45f64..ebf8c8b 100644 --- a/货架标准上位机/Views/ShelfInfoView.xaml.cs +++ b/货架标准上位机/Views/ShelfInfoView.xaml.cs @@ -29,8 +29,10 @@ namespace 智慧物流软件系统 private void LoadedVisible(object sender, EventArgs e) { - viewModel.BtnReset(); + //viewModel.BtnReset(); + viewModel.InitShelfTypeItems(); + viewModel.BtnSearchReset(); } @@ -87,5 +89,10 @@ namespace 智慧物流软件系统 { ; } + + private void UserControlBase_Loaded(object sender, RoutedEventArgs e) + { + //viewModel.BtnSearch(); + } } }