From 432a96198f99800f9b6d695acd0b8d73e1ab1a3d Mon Sep 17 00:00:00 2001 From: hehaibing-1996 Date: Wed, 15 May 2024 18:59:24 +0800 Subject: [PATCH] fature --- WCS.BLL/DbModels/MatInfo.cs | 9 +- WCS.BLL/DbModels/ModuleInfo.cs | 13 +- WCS.BLL/DbModels/StockTakingOrder.cs | 6 + WCS.BLL/DbModels/StoreInfo.cs | 11 + WCS.BLL/HardWare/SmartShelf.cs | 72 ++---- WCS.BLL/HardWare/SmartShelfModule.cs | 14 +- WCS.BLL/Manager/TCPClientManager.cs | 66 ++++- WCS.BLL/Manager/WarningManager.cs | 1 + .../Services/IService/IMatBaseInfoService.cs | 4 +- .../Services/IService/IStoreInfoService.cs | 17 ++ WCS.BLL/Services/Service/GenerateService.cs | 3 +- .../Services/Service/InOutRecordService.cs | 2 +- WCS.BLL/Services/Service/InstoreService.cs | 2 +- .../Service/InterfaceRecordService.cs | 2 +- .../Services/Service/MatBaseInfoService.cs | 59 ++++- .../Service/MatInventoryDetailService.cs | 2 +- WCS.BLL/Services/Service/OutstoreService.cs | 6 +- .../Services/Service/StockTakingService.cs | 70 +++++- WCS.BLL/Services/Service/StoreInfoService.cs | 97 +++++++- WCS.BLL/Tool/TCPClient.cs | 15 +- .../ApiModel/MatBaseInfo/GetMatInfoRequest.cs | 4 + .../ApiModel/MatBaseInfo/MatInfoModel.cs | 2 + .../MatBaseInfo/PrintedMatInfoRequest.cs | 11 + .../ApiModel/StoreInfo/GetModulesRequest.cs | 13 + .../ApiModel/StoreInfo/GetStoresRequest.cs | 14 ++ .../ApiModel/StoreInfo/ModuleInfoModel.cs | 51 ++++ .../ApiModel/StoreInfo/StoreInfoModel.cs | 41 ++++ .../Controllers/MatBaseInfoController.cs | 12 + WCS.WebApi/Controllers/StoreInfoController.cs | 23 +- WCS.WebApi/Program.cs | 2 +- 货架标准上位机/Api/ApiHelp.cs | 10 +- 货架标准上位机/Models/AuthEnum.cs | 1 + .../Resources/扫码枪结束入库二维码.png | Bin 0 -> 6269 bytes .../ViewModels/InInventoryViewModel.cs | 68 +++++- .../ViewModels/InOutRecordViewModel.cs | 12 +- .../ViewModels/InterfaceRecordViewModel.cs | 12 +- .../ViewModels/MatBaseInfoViewModel.cs | 19 +- 货架标准上位机/ViewModels/MatInfoViewModel.cs | 152 +++++++++++- .../ViewModels/MatInventoryDetailViewModel.cs | 16 +- .../ViewModels/ModuleInfoViewModel.cs | 228 ++++++++++++++++++ .../ViewModels/OutInventoryDocumentViewModel.cs | 11 +- .../ViewModels/OutInventoryViewModel.cs | 2 +- .../ViewModels/ShelfInfoViewModel.cs | 10 +- .../ViewModels/StocktakingDocumentViewModel.cs | 12 +- .../ViewModels/StocktakingViewModel.cs | 4 + .../ViewModels/StoreInfoViewModel.cs | 214 ++++++++++++++++ .../Views/Controls/ProcessDialog.xaml | 16 ++ .../Views/Controls/ProcessDialog.xaml.cs | 31 +++ .../Views/Controls/ProcessDialogViewModel.cs | 20 ++ 货架标准上位机/Views/InInventoryView.xaml | 17 +- 货架标准上位机/Views/InOutRecordView.xaml | 29 ++- 货架标准上位机/Views/InOutRecordView.xaml.cs | 1 + 货架标准上位机/Views/InterfaceRecordView.xaml | 30 ++- .../Views/InterfaceRecordView.xaml.cs | 1 + .../Views/MainWindows/MainWindow1.xaml | 4 +- 货架标准上位机/Views/MatBaseInfoView.xaml | 29 ++- 货架标准上位机/Views/MatBaseInfoView.xaml.cs | 1 + .../Views/MatBaseInoGenarateMatInfoView.xaml.cs | 70 ++++++ 货架标准上位机/Views/MatInfoView.xaml | 94 +++++--- 货架标准上位机/Views/MatInfoView.xaml.cs | 1 + .../Views/MatInventoryDetailView.xaml | 29 ++- .../Views/MatInventoryDetailView.xaml.cs | 1 + 货架标准上位机/Views/ModuleInfoView.xaml | 164 +++++++++++++ 货架标准上位机/Views/ModuleInfoView.xaml.cs | 90 +++++++ .../Views/OutInventoryDocumentView.xaml | 42 ++-- 货架标准上位机/Views/OutInventoryView.xaml | 7 +- 货架标准上位机/Views/ShelfInfoView.xaml | 35 ++- 货架标准上位机/Views/ShelfInfoView.xaml.cs | 3 +- 货架标准上位机/Views/StockTakingView.xaml | 2 +- 货架标准上位机/Views/StockTakingView.xaml.cs | 5 + .../Views/StocktakingDocumentView.xaml | 32 ++- 货架标准上位机/Views/StoreInfoView.xaml | 178 ++++++++++++++ 货架标准上位机/Views/StoreInfoView.xaml.cs | 90 +++++++ 货架标准上位机/WebSocket.cs | 5 +- 货架标准上位机/货架标准上位机.csproj | 4 + 75 files changed, 2174 insertions(+), 272 deletions(-) create mode 100644 WCS.Model/ApiModel/MatBaseInfo/PrintedMatInfoRequest.cs create mode 100644 WCS.Model/ApiModel/StoreInfo/GetModulesRequest.cs create mode 100644 WCS.Model/ApiModel/StoreInfo/GetStoresRequest.cs create mode 100644 WCS.Model/ApiModel/StoreInfo/ModuleInfoModel.cs create mode 100644 WCS.Model/ApiModel/StoreInfo/StoreInfoModel.cs create mode 100644 货架标准上位机/Resources/扫码枪结束入库二维码.png create mode 100644 货架标准上位机/ViewModels/ModuleInfoViewModel.cs create mode 100644 货架标准上位机/ViewModels/StoreInfoViewModel.cs create mode 100644 货架标准上位机/Views/Controls/ProcessDialog.xaml create mode 100644 货架标准上位机/Views/Controls/ProcessDialog.xaml.cs create mode 100644 货架标准上位机/Views/Controls/ProcessDialogViewModel.cs create mode 100644 货架标准上位机/Views/ModuleInfoView.xaml create mode 100644 货架标准上位机/Views/ModuleInfoView.xaml.cs create mode 100644 货架标准上位机/Views/StoreInfoView.xaml create mode 100644 货架标准上位机/Views/StoreInfoView.xaml.cs diff --git a/WCS.BLL/DbModels/MatInfo.cs b/WCS.BLL/DbModels/MatInfo.cs index 2f8e6a9..9c392f7 100644 --- a/WCS.BLL/DbModels/MatInfo.cs +++ b/WCS.BLL/DbModels/MatInfo.cs @@ -42,7 +42,7 @@ namespace WCS.BLL.DbModels [SugarColumn(ColumnName = "mat_spec", Length = 150, IsNullable = true, ColumnDescription = "物料规格")] public string? MatSpec { get; set; } - + [SugarColumn(ColumnName = "mat_unit", Length = 100, IsNullable = true, ColumnDescription = "物料单位")] public string? MatUnit { get; set; } @@ -75,6 +75,13 @@ namespace WCS.BLL.DbModels /// [SugarColumn(ColumnName = "is_printed", ColumnDescription = "是否已打印")] public bool IsPrinted { get; set; } = false; + + /// + /// 打印次数 + /// + [SugarColumn(ColumnName = "printed_times", DefaultValue = "0", ColumnDescription = "打印次数")] + public int PrintedTimes { get; set; } + /// /// Desc:更新人 /// Default: diff --git a/WCS.BLL/DbModels/ModuleInfo.cs b/WCS.BLL/DbModels/ModuleInfo.cs index d3b0a8a..59eeedc 100644 --- a/WCS.BLL/DbModels/ModuleInfo.cs +++ b/WCS.BLL/DbModels/ModuleInfo.cs @@ -12,7 +12,7 @@ namespace WCS.DAL.DbModels ///模组信息表 /// [SugarTable("module_info")] - public partial class ModuleInfo + public class ModuleInfo { /// @@ -80,5 +80,16 @@ namespace WCS.DAL.DbModels [SugarColumn(ColumnName = "current_mode", IsNullable = true, ColumnDescription = "串联后大货架编码;大货架编码:未串联时是与货架编码是一对一的关系;串联后与货架编码是一对多的关系")] public Mode CurrentMode { get; set; } = Mode.待机模式; + + /// + /// 序号 + /// + [SugarColumn(IsIgnore = true)] + public int RowNumber { get; set; } + /// + /// 是否已经选择 + /// + [SugarColumn(IsIgnore = true)] + public bool IsSelected { get; set; } } } diff --git a/WCS.BLL/DbModels/StockTakingOrder.cs b/WCS.BLL/DbModels/StockTakingOrder.cs index 1b31581..47498ce 100644 --- a/WCS.BLL/DbModels/StockTakingOrder.cs +++ b/WCS.BLL/DbModels/StockTakingOrder.cs @@ -50,6 +50,12 @@ namespace WCS.BLL.DbModels [SugarColumn(ColumnName = "create_user", Length = 100, IsNullable = true, ColumnDescription = "创建人")] public string CreateUser { get; set; } + /// + /// 更新时间 + /// + [SugarColumn(ColumnName = "update_time", IsNullable = false, ColumnDescription = "更新时间")] + public DateTime UpdateTime { get; set; } = DateTime.Now; + /// /// 序号 /// diff --git a/WCS.BLL/DbModels/StoreInfo.cs b/WCS.BLL/DbModels/StoreInfo.cs index a760bd0..0f84620 100644 --- a/WCS.BLL/DbModels/StoreInfo.cs +++ b/WCS.BLL/DbModels/StoreInfo.cs @@ -87,5 +87,16 @@ namespace WCS.DAL.DbModels /// [SugarColumn(ColumnName = "offset_voltage", IsNullable = true, ColumnDescription = "电压偏移值")] public decimal OffsetVoltage { get; set; } + + /// + /// 序号 + /// + [SugarColumn(IsIgnore = true)] + public int RowNumber { get; set; } + /// + /// 是否已经选择 + /// + [SugarColumn(IsIgnore = true)] + public bool IsSelected { get; set; } } } diff --git a/WCS.BLL/HardWare/SmartShelf.cs b/WCS.BLL/HardWare/SmartShelf.cs index 0fe0ec2..638efec 100644 --- a/WCS.BLL/HardWare/SmartShelf.cs +++ b/WCS.BLL/HardWare/SmartShelf.cs @@ -45,49 +45,6 @@ namespace WCS.BLL.HardWare ModuleIds = Modules.Select(t => t.BoardId).ToList(); }); - - ////初始化TCPCleint - //TcpCleint = new TCPClient("192.168.0.11:20002", "192.168.0.154:20003"); - //TcpCleint.tcpClient.Received += (client, e) => - //{ - // var data = e.ByteBlock.Buffer.Take((int)e.ByteBlock.Length).ToArray(); - // e.ByteBlock.Clear(); - // var len = data.Length; - // for (int index = 0; index < data.Length - TcpCleint.PreFixLength; index++) - // { - // //协议拆包 通过前缀校验是否为完整数据包 - // var prefixInData = data.Skip(index).Take(TcpCleint.PreFixLength); - // var isEqual = prefixInData.SequenceEqual(TcpCleint.Prefix); - // if (isEqual) - // { - // var dataTemp = data.Skip(index).Take(TcpCleint.PreFixLength + TcpCleint.DataLength).ToArray(); - // if (dataTemp.Length < TcpCleint.PreFixLength + TcpCleint.DataLength)//拆包后不满足一条指令的长度 - // { - // continue; - // } - // index += (TcpCleint.PreFixLength + TcpCleint.DataLength - 1);//每次循环index会+1 所以这里-1 - // //获取板子ID - // var boardIds = (data[TcpCleint.PreFixLength + 0] << 8) + data[TcpCleint.PreFixLength + 1]; - // var lightNumber = Convert.ToInt32(data[TcpCleint.PreFixLength + 3]); - - // //协议处理 判断功能位 - // switch (dataTemp[TcpCleint.PreFixLength + 2]) - // { - // case 0x01://进入入库模式信号 - // GoInInstoreProcess(dataTemp, boardIds, lightNumber); - // break; - // case 0x03://正常入库信号 - // InStoreReturnProcess(dataTemp); - // break; - // default: - // ; - // break; - // } - // } - // } - // return EasyTask.CompletedTask; - //}; - //TcpCleint.Connect(); } @@ -748,6 +705,7 @@ namespace WCS.BLL.HardWare } //获取当前板所有库位 var storeInfos = DbHelp.db.Queryable() + .Where(t => t.ShelfId == ShelfId) .Where(t => t.BoardId == boardId) .ToList(); //当前板子的灯数量 @@ -915,7 +873,9 @@ namespace WCS.BLL.HardWare { var boardId = (data[TcpCleint.PreFixLength + 0] << 8) + data[TcpCleint.PreFixLength + 1]; var number = Convert.ToInt32(data[TcpCleint.PreFixLength + 3]); - var storeInfo = DbHelp.db.Queryable().Where(t => t.BoardId == boardId + var storeInfo = DbHelp.db.Queryable().Where(t => + t.ShelfId == ShelfId + && t.BoardId == boardId && t.LightNumber == number).First(); if (storeInfo == null) @@ -1062,6 +1022,7 @@ namespace WCS.BLL.HardWare Logs.Write("协议处理5.1"); lightNumber = (int)data[TcpCleint.PreFixLength + 4]; var storeInfo = DbHelp.db.Queryable() + .Where(t => t.ShelfId == ShelfId) .Where(t => t.BoardId == boardId && t.LightNumber == lightNumber) .First(); Logs.Write("协议处理5.2"); @@ -1202,6 +1163,7 @@ namespace WCS.BLL.HardWare } //获取当前板所有库位 var storeInfos = DbHelp.db.Queryable() + .Where(t => t.ShelfId == ShelfId) .Where(t => t.BoardId == boardId) .ToList(); //当前板子的灯数量 @@ -1310,6 +1272,7 @@ namespace WCS.BLL.HardWare } lightNumber = Convert.ToInt32(data[TcpCleint.PreFixLength + 3]); var storeInfo = DbHelp.db.Queryable().Where(t => t.BoardId == boardId + && t.ShelfId == ShelfId && t.LightNumber == lightNumber) .First(); if (storeInfo == null) @@ -1423,9 +1386,19 @@ namespace WCS.BLL.HardWare //确认本次出库 module.ComfirmOutstore(TcpCleint, data[TcpCleint.PreFixLength + 3]); + + + //当前柜子是否还存在未出库的 + CurrentOutStoreMatSNs.RemoveAll(t => t == matSN);//删除本次已出的物料SN + var isExsistOut = CurrentOutStoreMatSNs.Any(); + + var tempOrder = CurrentOutOrder; //通知前台刷新 Task.Run(() => { + //更新订单状态 + UpdateOutOrderStatus(tempOrder); + var messageMode = new WebSocketMessageModel() { IsWarning = false, @@ -1435,18 +1408,9 @@ namespace WCS.BLL.HardWare WarningManager.SendWarning(messageMode); }); - //当前柜子是否还存在未出库的 - CurrentOutStoreMatSNs.RemoveAll(t => t == matSN);//删除本次已出的物料SN - var isExsistOut = CurrentOutStoreMatSNs.Any(); - //本次亮灯的物料已全部取出 if (!isExsistOut) { - - - //更新订单状态 - UpdateOutOrderStatus(CurrentOutOrder); - CurrentOutOrder = null; //退出出库模式 @@ -1547,7 +1511,6 @@ namespace WCS.BLL.HardWare } - } catch (Exception ex) { @@ -1634,6 +1597,7 @@ namespace WCS.BLL.HardWare { lightNumber = (int)data[TcpCleint.PreFixLength + 4]; var storeInfo = DbHelp.db.Queryable() + .Where(t => t.ShelfId == ShelfId) .Where(t => t.BoardId == boardId && t.LightNumber == lightNumber) .First(); if (storeInfo == null) diff --git a/WCS.BLL/HardWare/SmartShelfModule.cs b/WCS.BLL/HardWare/SmartShelfModule.cs index 30cb307..ab59ceb 100644 --- a/WCS.BLL/HardWare/SmartShelfModule.cs +++ b/WCS.BLL/HardWare/SmartShelfModule.cs @@ -92,6 +92,7 @@ namespace WCS.BLL.HardWare //TO DO 退出对应的模式 然后再发送进入入库模式 } var storeInfos = DbHelp.db.Queryable() + .Where(t => t.ModuleId == ModuleId) .Where(t => t.BoardId == BoardId) .OrderBy(t => t.LightNumber) .ToList(); @@ -156,6 +157,7 @@ namespace WCS.BLL.HardWare return; } var storeInfos = DbHelp.db.Queryable() + .Where(t => t.ModuleId == ModuleId) .Where(t => t.BoardId == BoardId) .OrderBy(t => t.LightNumber) .ToList(); @@ -184,7 +186,7 @@ namespace WCS.BLL.HardWare public void GoInOutStoreMode(TCPClient tcpClient, List outSns) { CurrentOutSns = outSns; - var storeInfos = DbHelp.db.Queryable() + var storeInfos = DbHelp.db.Queryable().Where(t => t.ModuleId == ModuleId) .Where(t => t.BoardId == BoardId) .OrderBy(t => t.LightNumber) .ToList(); @@ -247,7 +249,7 @@ namespace WCS.BLL.HardWare { CurrentStockTakingSns = stockTakingSns; - var storeInfos = DbHelp.db.Queryable() + var storeInfos = DbHelp.db.Queryable().Where(t => t.ModuleId == ModuleId) .Where(t => t.BoardId == BoardId) .OrderBy(t => t.LightNumber) .ToList(); @@ -277,7 +279,7 @@ namespace WCS.BLL.HardWare tcpClient.Send(tcpClient.GenerateMessage(BoardId, GoInStockTakingModeData)); } - + /// /// 已确认过的物料 /// @@ -286,7 +288,7 @@ namespace WCS.BLL.HardWare { CurrentStockTakingSns = stockTakingSns; - var storeInfos = DbHelp.db.Queryable() + var storeInfos = DbHelp.db.Queryable().Where(t => t.ModuleId == ModuleId) .Where(t => t.BoardId == BoardId) .OrderBy(t => t.LightNumber) .ToList(); @@ -317,14 +319,14 @@ namespace WCS.BLL.HardWare tcpClient.Send(tcpClient.GenerateMessage(BoardId, ConfirmStockTakingData)); } - + /// /// 单个确认物料 /// /// public void ConfirmStockTakingSingle(TCPClient tcpClient, int lightNumber) { - var storeInfos = DbHelp.db.Queryable() + var storeInfos = DbHelp.db.Queryable().Where(t => t.ModuleId == ModuleId) .Where(t => t.BoardId == BoardId) .OrderBy(t => t.LightNumber) .ToList(); diff --git a/WCS.BLL/Manager/TCPClientManager.cs b/WCS.BLL/Manager/TCPClientManager.cs index 2a11b69..1c6b76b 100644 --- a/WCS.BLL/Manager/TCPClientManager.cs +++ b/WCS.BLL/Manager/TCPClientManager.cs @@ -28,7 +28,7 @@ namespace WCS.BLL.Manager .ToList(); foreach (var ip in ips) { - var tcpCleint = new TCPClient(ip, "192.168.9.183:20003"); + var tcpCleint = new TCPClient(ip, ""); //配置断线重连 tcpCleint.tcpClient.Received += (client, e) => { @@ -102,9 +102,49 @@ namespace WCS.BLL.Manager Logs.Write("协议处理完毕!"); return EasyTask.CompletedTask; }; + //配置首次连接后复位操作 + tcpCleint.tcpClient.Connected += (client, e) => + { + var clientIpHost = client.IP + ":" + client.Port; + var TcpCleint = TCPClientManager.GetTCPClientByIPHost(clientIpHost); + if (TcpCleint == null) + { + return EasyTask.CompletedTask; + } + //首次连接 + if (TcpCleint.IsFirstConnected == false) + { + InitStatus(TcpCleint); + TcpCleint.IsFirstConnected = true; + } + return EasyTask.CompletedTask; + }; + TCPClients.Add(tcpCleint); tcpCleint.Connect(); } + + //启动线程监听所有TCP是否已经完成首次连接 + Task.Run(() => + { + while (true) + { + Thread.Sleep(1000); + var noFirstConnectedClients = TCPClientManager.TCPClients.Where(t => t.IsFirstConnected == false) + .ToList(); + if (noFirstConnectedClients.Count == 0) + { + break; + } + else + { + noFirstConnectedClients.ForEach(t => + { + t.ReConnectAsync(); + }); + } + } + }); } //后台启动时给所有板子、警示灯发送复位操作 保持状态一致 @@ -133,6 +173,30 @@ namespace WCS.BLL.Manager } }); } + + //后台启动时给所有板子、警示灯发送复位操作 保持状态一致 + public static void InitStatus(TCPClient tcpClient) + { + Task.Run(() => + { + try + { + Thread.Sleep(1000); + + //板子复位 + new SmartShelfModule() + { + BoardId = 2047 + }.Reset(tcpClient); + //报警灯复位 + new WarningLight().CloseLight(tcpClient); + } + catch (Exception ex) + { + Logs.Write($"[{tcpClient.RemoteIPHost}]:启动时复位异常,{ex.Message}"); + } + }); + } public static TCPClient GetTCPClientByIPHost(string IpHost) { return TCPClients.Where(t => t.RemoteIPHost == IpHost).FirstOrDefault(); diff --git a/WCS.BLL/Manager/WarningManager.cs b/WCS.BLL/Manager/WarningManager.cs index 0d9f4af..ab69ca2 100644 --- a/WCS.BLL/Manager/WarningManager.cs +++ b/WCS.BLL/Manager/WarningManager.cs @@ -144,6 +144,7 @@ namespace WCS.BLL.Manager { //获取库位 var storeInfo = DbHelp.db.Queryable() + .Where(t => t.ShelfId == warning.ShelfId) .Where(t => t.Id == warning.StoreId) .First(); if (storeInfo != null) diff --git a/WCS.BLL/Services/IService/IMatBaseInfoService.cs b/WCS.BLL/Services/IService/IMatBaseInfoService.cs index 3529c84..56aac35 100644 --- a/WCS.BLL/Services/IService/IMatBaseInfoService.cs +++ b/WCS.BLL/Services/IService/IMatBaseInfoService.cs @@ -14,7 +14,7 @@ namespace WCS.BLL.Services.IService public Task> exportMatBaseInfo(GetMatBaseInfoRequest request); - public Task>> importMatBaseInfo(List lists,string userName,string deviceType); + public Task>> importMatBaseInfo(List lists, string userName, string deviceType); public Task> addOrUpdateMatBaseInfo(AddMatBaseInfoRequest request); @@ -24,5 +24,7 @@ namespace WCS.BLL.Services.IService public Task> getMatInfo(GetMatInfoRequest request); + + public Task printedMatInfo(PrintedMatInfoRequest request); } } diff --git a/WCS.BLL/Services/IService/IStoreInfoService.cs b/WCS.BLL/Services/IService/IStoreInfoService.cs index b871fd3..49bff75 100644 --- a/WCS.BLL/Services/IService/IStoreInfoService.cs +++ b/WCS.BLL/Services/IService/IStoreInfoService.cs @@ -29,5 +29,22 @@ namespace WCS.BLL.Services.IService public Task> GenerateStoreInfo(); + + + /// + /// 查询货架列表 + /// + /// + /// + public Task> GetModules(GetModulesRequest request); + + + /// + /// 查询货架列表 + /// + /// + /// + public Task> GetStores(GetStoresRequest request); + } } diff --git a/WCS.BLL/Services/Service/GenerateService.cs b/WCS.BLL/Services/Service/GenerateService.cs index 1074923..f89c77f 100644 --- a/WCS.BLL/Services/Service/GenerateService.cs +++ b/WCS.BLL/Services/Service/GenerateService.cs @@ -78,9 +78,10 @@ namespace WCS.BLL.Services.Service MatQty = request.MatQty, ModifyUser = request.UserName }; + matInfo.Id = DbHelp.db.Insertable(matInfo).ExecuteReturnIdentity(); matInfoList.Add(matInfo); } - DbHelp.db.Insertable(matInfoList).ExecuteCommand(); + matBaseInfo.SerialNumber = startNumber + request.TotalCount; DbHelp.db.Updateable(matBaseInfo).ExecuteCommand(); DbHelp.db.CommitTran(); diff --git a/WCS.BLL/Services/Service/InOutRecordService.cs b/WCS.BLL/Services/Service/InOutRecordService.cs index 738541d..285660e 100644 --- a/WCS.BLL/Services/Service/InOutRecordService.cs +++ b/WCS.BLL/Services/Service/InOutRecordService.cs @@ -49,7 +49,7 @@ namespace WCS.BLL.Services.Service //生成序号 for (int i = 0; i < records.Count; i++) { - records[i].RowNumber = (request.PageNumber - 1) * 10 + i + 1; + records[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1; } return new PageQueryResponse() diff --git a/WCS.BLL/Services/Service/InstoreService.cs b/WCS.BLL/Services/Service/InstoreService.cs index b568d89..c15cf04 100644 --- a/WCS.BLL/Services/Service/InstoreService.cs +++ b/WCS.BLL/Services/Service/InstoreService.cs @@ -149,7 +149,7 @@ namespace WCS.BLL.Services.Service } #region 获取物料数据 //调用接口或者直接查询数据库 - //TODO做成配置 调用接口 + // 调用接口 if (LocalFile.Config.IsAccessWMS) { #region 调用WMS接口获取物料信息 diff --git a/WCS.BLL/Services/Service/InterfaceRecordService.cs b/WCS.BLL/Services/Service/InterfaceRecordService.cs index 09a4578..34ab7ed 100644 --- a/WCS.BLL/Services/Service/InterfaceRecordService.cs +++ b/WCS.BLL/Services/Service/InterfaceRecordService.cs @@ -45,7 +45,7 @@ namespace WCS.BLL.Services.Service //生成序号 for (int i = 0; i < records.Count; i++) { - records[i].RowNumber = (request.PageNumber - 1) * 10 + i + 1; + records[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1; } //Task.WaitAll(new Task[] { recordsTask, totalCountTask }); diff --git a/WCS.BLL/Services/Service/MatBaseInfoService.cs b/WCS.BLL/Services/Service/MatBaseInfoService.cs index 29df460..a3f5cd3 100644 --- a/WCS.BLL/Services/Service/MatBaseInfoService.cs +++ b/WCS.BLL/Services/Service/MatBaseInfoService.cs @@ -23,7 +23,10 @@ namespace WCS.BLL.Services.Service /// public class MatBaseInfoService : IMatBaseInfoService { - public MatBaseInfoService() { } + public MatBaseInfoService() + { + + } public async Task> getMatBaseInfo(GetMatBaseInfoRequest request) { @@ -42,7 +45,7 @@ namespace WCS.BLL.Services.Service //生成序号 for (int i = 0; i < records.Count; i++) { - records[i].RowNumber = (request.PageNumber - 1) * 10 + i + 1; + records[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1; } return new PageQueryResponse() @@ -410,8 +413,6 @@ namespace WCS.BLL.Services.Service } } - - public async Task> getMatInfo(GetMatInfoRequest request) { try @@ -420,6 +421,8 @@ namespace WCS.BLL.Services.Service .WhereIF(!string.IsNullOrEmpty(request.MatCode), t => t.MatCode.Contains(request.MatCode)) .WhereIF(!string.IsNullOrEmpty(request.MatName), t => t.MatName.Contains(request.MatName)) .WhereIF(!string.IsNullOrEmpty(request.MatSpec), t => t.MatSpec.Contains(request.MatSpec)) + .WhereIF(!string.IsNullOrEmpty(request.MatBatch), t => t.MatBatch.Contains(request.MatBatch)) + .WhereIF(request.IsPrinted != null, t => t.IsPrinted == request.IsPrinted) .WhereIF(!string.IsNullOrEmpty(request.MatSN), t => t.MatSn.Contains(request.MatSN)); var totalCount = await recordsQueryable.CountAsync(); var records = await recordsQueryable @@ -428,7 +431,7 @@ namespace WCS.BLL.Services.Service //生成序号 for (int i = 0; i < records.Count; i++) { - records[i].RowNumber = (request.PageNumber - 1) * 10 + i + 1; + records[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1; } return new PageQueryResponse() @@ -454,5 +457,51 @@ namespace WCS.BLL.Services.Service } } + public async Task printedMatInfo(PrintedMatInfoRequest request) + { + try + { + + if (request == null || request.PrintedMatInfoIds == null || request.PrintedMatInfoIds.Count == 0) + { + return new ResponseCommon() + { + Code = 300, + Message = $"操作失败:参数为null", + }; + } + + DbHelp.db.BeginTran(); + //获取打印的具体数据 + var matInfos = await DbHelp.db.Queryable() + .Where(t => request.PrintedMatInfoIds.Contains(t.Id)) + .ToListAsync(); + //打印次数加一 + matInfos.ForEach(matInfo => + { + matInfo.IsPrinted = true; + matInfo.PrintedTimes = matInfo.PrintedTimes + 1; + }); + await DbHelp.db.Updateable(matInfos).ExecuteCommandAsync(); + DbHelp.db.CommitTran(); + + return new ResponseCommon() + { + Code = 200, + Message = $"Success", + }; + } + catch (Exception ex) + { + DbHelp.db.RollbackTran(); + return new ResponseCommon() + { + Code = 300, + Message = $"操作失败:{ex.Message}", + }; + } + } + + } } diff --git a/WCS.BLL/Services/Service/MatInventoryDetailService.cs b/WCS.BLL/Services/Service/MatInventoryDetailService.cs index c5e0ace..b9881c5 100644 --- a/WCS.BLL/Services/Service/MatInventoryDetailService.cs +++ b/WCS.BLL/Services/Service/MatInventoryDetailService.cs @@ -47,7 +47,7 @@ namespace WCS.BLL.Services.Service //生成序号 for (int i = 0; i < records.Count; i++) { - records[i].RowNumber = (request.PageNumber - 1) * 10 + i + 1; + records[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1; } return new PageQueryResponse() diff --git a/WCS.BLL/Services/Service/OutstoreService.cs b/WCS.BLL/Services/Service/OutstoreService.cs index 37c1674..fe2d224 100644 --- a/WCS.BLL/Services/Service/OutstoreService.cs +++ b/WCS.BLL/Services/Service/OutstoreService.cs @@ -208,7 +208,7 @@ namespace WCS.BLL.Services.Service //生成序号 for (int i = 0; i < records.Count; i++) { - records[i].RowNumber = (request.PageNumber - 1) * 10 + i + 1; + records[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1; } return new PageQueryResponse() @@ -378,7 +378,7 @@ namespace WCS.BLL.Services.Service return new ResponseCommon> { Code = 200, - Message = "Success", + Message = outOrder.OrderStatus.ToString(), Data = orderMatDetail }; } @@ -527,7 +527,7 @@ namespace WCS.BLL.Services.Service .WhereIF(!string.IsNullOrEmpty(outOrderDetail.MatBatch), t => t.MatBatch == outOrderDetail.MatBatch) .Where(t => t.IsLocked == false)//未锁定的物料 .OrderBy(t => t.MatBatch)//先进先出 - //(t => t.MatQty)//零散料先出 + //(t => t.MatQty)//零散料先出 .ToList(); //2.2按照搜索出来的库存和当前未出的数量 计算需要出的SN diff --git a/WCS.BLL/Services/Service/StockTakingService.cs b/WCS.BLL/Services/Service/StockTakingService.cs index 73a10ed..c71eb2b 100644 --- a/WCS.BLL/Services/Service/StockTakingService.cs +++ b/WCS.BLL/Services/Service/StockTakingService.cs @@ -345,7 +345,7 @@ namespace WCS.BLL.Services.Service //生成序号 for (int i = 0; i < records.Count; i++) { - records[i].RowNumber = (request.PageNumber - 1) * 10 + i + 1; + records[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1; } return new PageQueryResponse() @@ -386,9 +386,6 @@ namespace WCS.BLL.Services.Service case Model.ApiModel.Stocktaking.StocktakingOrderStatus.部分盘点: recordsQueryable = recordsQueryable.Where(t => t.StocktakingOrderStatus == StocktakingOrderStatus.部分盘点); break; - case Model.ApiModel.Stocktaking.StocktakingOrderStatus.已提交: - recordsQueryable = recordsQueryable.Where(t => t.StocktakingOrderStatus == StocktakingOrderStatus.已提交); - break; case Model.ApiModel.Stocktaking.StocktakingOrderStatus.盘点完成: recordsQueryable = recordsQueryable.Where(t => t.StocktakingOrderStatus == StocktakingOrderStatus.盘点完成); break; @@ -397,7 +394,8 @@ namespace WCS.BLL.Services.Service } var records = await recordsQueryable - .OrderByDescending(t => t.CreateTime) + .Where(t => t.StocktakingOrderStatus != StocktakingOrderStatus.已提交) + .OrderByDescending(t => t.UpdateTime) .Take(40) .ToListAsync(); @@ -507,6 +505,14 @@ namespace WCS.BLL.Services.Service Message = $"操作失败:不存在单据号为{request.StockTakingOrderNumber}的盘点单!", }; } + if (order.StocktakingOrderStatus == StocktakingOrderStatus.已提交) + { + return new ResponseCommon() + { + Code = 201, + Message = $"操作失败:盘点单据:{request.StockTakingOrderNumber}已提交!", + }; + } } else { @@ -562,6 +568,10 @@ namespace WCS.BLL.Services.Service shelf.GoInStocktaking(matDetails, order); shelf.OrderNumber = order.StocktakingOrderNumber; }); + //更新Order + order.UpdateTime = DateTime.Now; + DbHelp.db.Updateable(order).ExecuteCommand(); + //返回 return new ResponseCommon() { @@ -698,16 +708,24 @@ namespace WCS.BLL.Services.Service }; } //返回具体的单据信息 - var stockTakinbgOrder = await DbHelp.db.Queryable() + var stockTakinOrderMatDetail = await DbHelp.db.Queryable() .Where(t => t.StocktakingOrderId == stockTakingOrder.Id) .Where(t => t.MatSN == request.MatSN) .FirstAsync(); - return new ResponseCommon() - { - Code = 200, - Message = "success", - Data = stockTakinbgOrder - }; + if (stockTakinOrderMatDetail != null) + return new ResponseCommon() + { + Code = 200, + Message = "success", + Data = stockTakinOrderMatDetail + }; + else + return new ResponseCommon() + { + Code = 201, + Message = "不是本次盘点的物料!", + Data = null + }; } public async Task confirmStocktakingOrder(ConfirmStocktakingOrderRequest request) @@ -736,6 +754,8 @@ namespace WCS.BLL.Services.Service DbHelp.db.Updateable(stockTakingMatDetail) .ExecuteCommand(); + + #region 发送指令 对应货架对应模组确认盘点 //判断货架是否已进入盘点模式 var shelf = ShelfManager.Shelves @@ -771,6 +791,32 @@ namespace WCS.BLL.Services.Service #endregion DbHelp.db.CommitTran(); + + #region 更新Order状态 + Task.Run(() => + { + //获取Order + var order = DbHelp.db.Queryable().Where(t => t.Id == stockTakingMatDetail.StocktakingOrderId).First(); + if (order != null) + { + var orderDetails = DbHelp.db.Queryable() + .Where(t => t.StocktakingOrderId == stockTakingMatDetail.StocktakingOrderId) + .ToList(); + var stocktakedDetailCount = orderDetails.Where(t => t.IsStocktaking).Count(); + if (stocktakedDetailCount < orderDetails.Count && order.StocktakingOrderStatus == StocktakingOrderStatus.未盘点) + { + order.StocktakingOrderStatus = StocktakingOrderStatus.部分盘点; + DbHelp.db.Updateable(order).ExecuteCommand(); + } + else if (stocktakedDetailCount == orderDetails.Count) + { + order.StocktakingOrderStatus = StocktakingOrderStatus.盘点完成; + DbHelp.db.Updateable(order).ExecuteCommand(); + } + } + }); + #endregion + return new ResponseCommon() { Code = 200, diff --git a/WCS.BLL/Services/Service/StoreInfoService.cs b/WCS.BLL/Services/Service/StoreInfoService.cs index 20d5e92..9056619 100644 --- a/WCS.BLL/Services/Service/StoreInfoService.cs +++ b/WCS.BLL/Services/Service/StoreInfoService.cs @@ -36,7 +36,7 @@ namespace WCS.BLL.Services.Service //生成序号 for (int i = 0; i < records.Count; i++) { - records[i].RowNumber = (request.PageNumber - 1) * 10 + i + 1; + records[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1; } return new PageQueryResponse() { @@ -236,8 +236,11 @@ namespace WCS.BLL.Services.Service } } - - async Task> IStoreInfoService.GenerateStoreInfo() + /// + /// TODO HardCode 根据模组信息生成库位 + /// + /// + public async Task> GenerateStoreInfo() { var shelfInfo = await DbHelp.db.Queryable().Where(t => t.ShelfCode == "C04-1").FirstAsync(); var ModuleInfos = await DbHelp.db.Queryable().Where(t => t.ShelfId == shelfInfo.Id).ToListAsync(); @@ -262,7 +265,93 @@ namespace WCS.BLL.Services.Service } }); - return new ResponseCommon() { Message = "111"}; + return new ResponseCommon() { Message = "111" }; } + + #region 模组管理 + public async Task> GetModules(GetModulesRequest request) + { + try + { + var recordsQueryable = DbHelp.db.Queryable() + .WhereIF(!string.IsNullOrEmpty(request.ModuleCode), t => t.ModuleCode.Contains(request.ModuleCode)) + .WhereIF(!string.IsNullOrEmpty(request.ShelfCode), t => t.ShelfCode.Contains(request.ShelfCode)); + var totalCount = await recordsQueryable.CountAsync(); + var records = await recordsQueryable + .Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize) + .ToListAsync(); + //生成序号 + for (int i = 0; i < records.Count; i++) + { + records[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1; + } + return new PageQueryResponse() + { + Code = 200, + Message = $"success", + Data = new PageQueryResponseData() + { + TotalCount = totalCount, + MaxPage = request.PageSize == 0 ? 0 : (int)Math.Ceiling((decimal)totalCount / request.PageSize), + Count = records.Count, + Lists = records.ToList() + } + }; + + } + catch (Exception ex) + { + return new PageQueryResponse() + { + Code = 300, + Message = $"操作失败:{ex.Message}", + }; + } + } + #endregion + + #region 库位管理 + public async Task> GetStores(GetStoresRequest request) + { + try + { + var recordsQueryable = DbHelp.db.Queryable() + .WhereIF(!string.IsNullOrEmpty(request.ShelfCode), t => t.ShelfCode.Contains(request.ShelfCode)) + .WhereIF(!string.IsNullOrEmpty(request.ModuleCode), t => t.ModuleCode.Contains(request.ModuleCode)) + .WhereIF(!string.IsNullOrEmpty(request.StoreCode), t => t.StoreCode.Contains(request.StoreCode)) + .WhereIF(!string.IsNullOrEmpty(request.CurrentMatSN), t => t.CurrentMatSn.Contains(request.CurrentMatSN)) + ; + var totalCount = await recordsQueryable.CountAsync(); + var records = await recordsQueryable + .Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize) + .ToListAsync(); + //生成序号 + for (int i = 0; i < records.Count; i++) + { + records[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1; + } + return new PageQueryResponse() + { + Code = 200, + Message = $"success", + Data = new PageQueryResponseData() + { + TotalCount = totalCount, + MaxPage = request.PageSize == 0 ? 0 : (int)Math.Ceiling((decimal)totalCount / request.PageSize), + Count = records.Count, + Lists = records.ToList() + } + }; + } + catch (Exception ex) + { + return new PageQueryResponse() + { + Code = 300, + Message = $"操作失败:{ex.Message}", + }; + } + } + #endregion } } diff --git a/WCS.BLL/Tool/TCPClient.cs b/WCS.BLL/Tool/TCPClient.cs index 2dee961..ee74e07 100644 --- a/WCS.BLL/Tool/TCPClient.cs +++ b/WCS.BLL/Tool/TCPClient.cs @@ -17,6 +17,9 @@ namespace WCS.BLL public bool IsOnline { get; set; } = false; + //第一次连接是否已连接 + public bool IsFirstConnected { get; set; } = false; + //can模块协议前缀 public readonly byte[] Prefix = new byte[] { 0x08, 0x00, 0x00 }; //can模块协议前缀长度 @@ -76,7 +79,6 @@ namespace WCS.BLL tcpClient.Received += (client, e) => { var data = e.ByteBlock.Buffer.Take((int)e.ByteBlock.Length).ToArray(); - //e.ByteBlock.Clear(); Logs.Write($"校验发送接收,收到数据" + BitConverter.ToString(data)); var len = data.Length; for (int index = 0; index < data.Length - PreFixLength; index++) @@ -106,7 +108,7 @@ namespace WCS.BLL } Logs.Write($"校验发送接收处理完毕" + BitConverter.ToString(data)); return null; - + }; tcpClient.Connected += (client, e) => @@ -114,7 +116,7 @@ namespace WCS.BLL this.IsOnline = true; return EasyTask.CompletedTask; }; - + tcpClient.Disconnected += (client, e) => { this.IsOnline = false; @@ -128,12 +130,12 @@ namespace WCS.BLL { try { - //TODO如果指令未回应n次 则取消重发 + //TODO如果指令已发两次 则取消重发 Console.WriteLine(Thread.CurrentThread.ManagedThreadId); await Task.Delay(100); if (MessageList.Count > 0) { - var failedMessage = MessageList.Where(t => t.Value.SendTimes >= 3).ToList(); + var failedMessage = MessageList.Where(t => t.Value.SendTimes >= 2).ToList(); foreach (var message in failedMessage) { Logs.Write(BitConverter.ToString(message.Value.Message) + @@ -152,15 +154,12 @@ namespace WCS.BLL await Task.Delay(10); } } - } } catch { - } } - }); } catch (Exception ex) diff --git a/WCS.Model/ApiModel/MatBaseInfo/GetMatInfoRequest.cs b/WCS.Model/ApiModel/MatBaseInfo/GetMatInfoRequest.cs index 026a9e1..cb33054 100644 --- a/WCS.Model/ApiModel/MatBaseInfo/GetMatInfoRequest.cs +++ b/WCS.Model/ApiModel/MatBaseInfo/GetMatInfoRequest.cs @@ -13,5 +13,9 @@ namespace WCS.Model.ApiModel.MatBaseInfo public string MatSpec { get; set; } public string MatSN { get; set; } + + public string MatBatch { get; set; } + + public bool? IsPrinted { get; set; } } } diff --git a/WCS.Model/ApiModel/MatBaseInfo/MatInfoModel.cs b/WCS.Model/ApiModel/MatBaseInfo/MatInfoModel.cs index 63e702c..4b01a01 100644 --- a/WCS.Model/ApiModel/MatBaseInfo/MatInfoModel.cs +++ b/WCS.Model/ApiModel/MatBaseInfo/MatInfoModel.cs @@ -30,6 +30,8 @@ namespace WCS.Model.ApiModel.MatBaseInfo public bool IsPrinted { get; set; } + public int PrintedTimes { get; set; } + public string? ModifyUser { get; set; } public DateTime? ModifyTime { get; set; } = DateTime.Now; diff --git a/WCS.Model/ApiModel/MatBaseInfo/PrintedMatInfoRequest.cs b/WCS.Model/ApiModel/MatBaseInfo/PrintedMatInfoRequest.cs new file mode 100644 index 0000000..9e806a1 --- /dev/null +++ b/WCS.Model/ApiModel/MatBaseInfo/PrintedMatInfoRequest.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace WCS.Model.ApiModel.MatBaseInfo +{ + public class PrintedMatInfoRequest : RequestBase + { + public List PrintedMatInfoIds { get; set; } + } +} diff --git a/WCS.Model/ApiModel/StoreInfo/GetModulesRequest.cs b/WCS.Model/ApiModel/StoreInfo/GetModulesRequest.cs new file mode 100644 index 0000000..f86f577 --- /dev/null +++ b/WCS.Model/ApiModel/StoreInfo/GetModulesRequest.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace WCS.Model.ApiModel.StoreInfo +{ + public class GetModulesRequest : PageQueryRequestBase + { + public string ShelfCode { get; set; } + + public string ModuleCode { get; set; } + } +} diff --git a/WCS.Model/ApiModel/StoreInfo/GetStoresRequest.cs b/WCS.Model/ApiModel/StoreInfo/GetStoresRequest.cs new file mode 100644 index 0000000..ce8a750 --- /dev/null +++ b/WCS.Model/ApiModel/StoreInfo/GetStoresRequest.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace WCS.Model.ApiModel.StoreInfo +{ + public class GetStoresRequest : PageQueryRequestBase + { + public string ShelfCode { get; set; } + public string ModuleCode { get; set; } + public string StoreCode { get; set; } + public string CurrentMatSN { get; set; } + } +} diff --git a/WCS.Model/ApiModel/StoreInfo/ModuleInfoModel.cs b/WCS.Model/ApiModel/StoreInfo/ModuleInfoModel.cs new file mode 100644 index 0000000..1213eb9 --- /dev/null +++ b/WCS.Model/ApiModel/StoreInfo/ModuleInfoModel.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Text; + +namespace WCS.Model.ApiModel.StoreInfo +{ + public class ModuleInfoModel : INotifyPropertyChanged + { + public int Id { get; set; } + + public string ModuleCode { get; set; } + public int ShelfId { get; set; } + + public string ShelfCode { get; set; } + + public int BoardId { get; set; } + + public int LightCount { get; set; } + + public string CleintIp { get; set; } + + public string R { get; set; } + + public string C { get; set; } + + public string? Bigshelfcode { get; set; } + + public bool IsEnable { get; set; } + + //public Mode CurrentMode { get; set; } = Mode.待机模式; + public int RowNumber { get; set; } + + public bool IsSelected + { + get { return isSelected; } + set + { + isSelected = value; + OnPropertyChanged(nameof(IsSelected)); + } + } + public bool isSelected; + + public event PropertyChangedEventHandler PropertyChanged; + protected virtual void OnPropertyChanged(string propertyName) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + } +} diff --git a/WCS.Model/ApiModel/StoreInfo/StoreInfoModel.cs b/WCS.Model/ApiModel/StoreInfo/StoreInfoModel.cs new file mode 100644 index 0000000..8d2a2b1 --- /dev/null +++ b/WCS.Model/ApiModel/StoreInfo/StoreInfoModel.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Text; + +namespace WCS.Model.ApiModel.StoreInfo +{ + public class StoreInfoModel : INotifyPropertyChanged + { + public int Id { get; set; } + public string StoreCode { get; set; } + public int ModuleId { get; set; } + public string ModuleCode { get; set; } + public int ShelfId { get; set; } + public string ShelfCode { get; set; } + public int BoardId { get; set; } + public int LightNumber { get; set; } + public int Priority { get; set; } + public string CurrentMatSn { get; set; } + public decimal CurrentVoltage { get; set; } + public decimal StandardVoltage { get; set; } + public decimal OffsetVoltage { get; set; } + public int RowNumber { get; set; } + public bool IsSelected + { + get { return isSelected; } + set + { + isSelected = value; + OnPropertyChanged(nameof(IsSelected)); + } + } + public bool isSelected; + + public event PropertyChangedEventHandler PropertyChanged; + protected virtual void OnPropertyChanged(string propertyName) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + } +} diff --git a/WCS.WebApi/Controllers/MatBaseInfoController.cs b/WCS.WebApi/Controllers/MatBaseInfoController.cs index 5b5ee85..7cec529 100644 --- a/WCS.WebApi/Controllers/MatBaseInfoController.cs +++ b/WCS.WebApi/Controllers/MatBaseInfoController.cs @@ -122,5 +122,17 @@ namespace WCS.WebApi.Controllers { return await _matBaseInfoService.getMatInfo(request); } + + /// + /// 打印物料条码后上传打印 + /// + /// + /// + [Route("printedMatInfo")] + [HttpPost(Name = "printedMatInfo")] + public async Task printedMatInfo(PrintedMatInfoRequest request) + { + return await _matBaseInfoService.printedMatInfo(request); + } } } diff --git a/WCS.WebApi/Controllers/StoreInfoController.cs b/WCS.WebApi/Controllers/StoreInfoController.cs index 0357891..1532fb3 100644 --- a/WCS.WebApi/Controllers/StoreInfoController.cs +++ b/WCS.WebApi/Controllers/StoreInfoController.cs @@ -11,7 +11,7 @@ using WCS.DAL.DbModels; namespace WCS.WebApi.Controllers { /// - /// 货架\、库位管理的页面 + /// 货架管理、模组管理、库位管理的接口 /// [ApiController] [Route("[controller]")] @@ -23,6 +23,7 @@ namespace WCS.WebApi.Controllers _storeInfoService = storeInfoService; } + #region 货架管理 [Route("getShelves")] [HttpPost(Name = "getShelves")] public async Task getShelves(GetShelvesRequest request) @@ -41,5 +42,25 @@ namespace WCS.WebApi.Controllers { return await _storeInfoService.GenerateStoreInfo(); } + #endregion + + + #region 模组管理 + [Route("getModules")] + [HttpPost(Name = "getModules")] + public async Task getModules(GetModulesRequest request) + { + return await _storeInfoService.GetModules(request); + } + #endregion + + #region 库位管理 + [Route("getStores")] + [HttpPost(Name = "getStores")] + public async Task getStores(GetStoresRequest request) + { + return await _storeInfoService.GetStores(request); + } + #endregion } } diff --git a/WCS.WebApi/Program.cs b/WCS.WebApi/Program.cs index 0a79839..fefaf41 100644 --- a/WCS.WebApi/Program.cs +++ b/WCS.WebApi/Program.cs @@ -32,7 +32,7 @@ namespace WebApi ShelfManager.InitShelves(); //λƺͰ - TCPClientManager.InitStatus(); + //TCPClientManager.InitStatus(); WarningManager.StartWarningMessageThread(); diff --git a/货架标准上位机/Api/ApiHelp.cs b/货架标准上位机/Api/ApiHelp.cs index aa9e2d8..f3559d2 100644 --- a/货架标准上位机/Api/ApiHelp.cs +++ b/货架标准上位机/Api/ApiHelp.cs @@ -270,7 +270,15 @@ namespace 货架标准上位机.Api } } - + /// + /// 调用接口超时时间10s + /// + /// + /// + /// + /// + /// + /// public static T GetDataFromHttp(string url, object dataObj, string httpMethod, bool isSaveLog = false) { Guid guid = Guid.NewGuid(); diff --git a/货架标准上位机/Models/AuthEnum.cs b/货架标准上位机/Models/AuthEnum.cs index 52093c0..727a7ad 100644 --- a/货架标准上位机/Models/AuthEnum.cs +++ b/货架标准上位机/Models/AuthEnum.cs @@ -17,6 +17,7 @@ namespace 货架标准上位机 权限 = 2000, 设置 = 3000, 调试 = 4000, + 主页 = 5000, } public class EnumTreeAttribute : Attribute diff --git a/货架标准上位机/Resources/扫码枪结束入库二维码.png b/货架标准上位机/Resources/扫码枪结束入库二维码.png new file mode 100644 index 0000000000000000000000000000000000000000..a2f7f03f2c856de2f143fe83593d322239a6e43b GIT binary patch literal 6269 zcmd^^{ZCV86vrQggw6%(6oOi~l$cF%3rrZhfEGcJ;v7XcUvWb-a6}6gRus~fLd7_F zYe|ec6-%VfvM7?O2n7o0kQOXM1+kj8ycA2BrMF0>yj0n}CHgl!$$q%GNz>fip68s; z`F_7G-oc=IEM2`60N}ALA?^nNTusD9T7rM_;C}2K{Psy!!hSXYo*l&Ha_&n{3IHpE zx5dTm%B!5v#0U+M%cEnmhvpAnyfeNv#-pF^9hta!;|SPt^1B!0pSakk0OVyZY^33j zvJRfw2!IS3joWgS{Fc#Zgd6Fg<0;P5Da?);PSu^fF=L;FXmMuL+C)Vls*(Y zp%_D=8Z?qrA8!%ImRr{t;5mA|@!5sVIsXLmjTb0*H4`AKW}$N2CFPNR-bQk`GHd(R zI6Ad+-sCh}s_oA~b>74KF`p!@}!7-Zm(4Xoz8(Q{2*Y$L;P6e0C~)5MR>2;(h5VH`eD zpDQRZE0RRkRA%kfwLVFPZX{vy?wF9XYqCc0e7F-nLz&{Pk=eW%%jrTaUVYbm5 zvm1nns!}dN@{8G0ntgO+4?W_j=WhlG0cQ=TwKMlKuONcnum(OC!%LsudMQ=(KGIu> z=qe(Fb4MIkr_RIL=2i+9>s!;_mM)v^G;wa$pBDS-{*}wdgpuo;0kUn@{6I^=7o&?CMJNS+Dt-*72KV6z8dk=OIF@Lm*q2rzmz9PlZRRCRx?g*=cIuq2 z2+kF7XhMKkHiRZ)A5PFvhbEb6>XJw|px-8~(BZA088%pINtvwL z(2eQKbZ>zj4i+V~#k1d8j8+a%jG)MBDSfRHwCZWVhBa7-h7Rp&w*_QQKBDjb)CAx_EhH zd&?y(+g9U8!laGQ_D+-Yg)lOxu-+a;bItnsc|C5pZudH_=k>Eg>E*0?kJ)ars>h@> z-JKP~_~MI!ixZyy2M7m1-t9<<@5wI{&RuL#QWioEmg9!kvR`Ch_U<^m=H&&q3K0|> z!nM$;!9OTmmTXMC3D=#e^T(Tt`NoGj%3;~D68Ggg1+)w$jKKJ3i;+o7(Cf+X8S|Y2 z-mBiyB3>Ds;@=t2Ev5{1g!6`2UmsJ3h5$(^?OOQMxp(T)W*=Pzv}Fec&U`0u8h2pA z)((?~jf-V;YF%^gihL297XoMLKl(1~(+t&KB44vU 0) { var currentScanedCode = Encoding.UTF8.GetString(e.ByteBlock, 0, e.ByteBlock.Len); - Logs.Write($"接收到扫码枪扫码数据{currentScanedCode}"); + Logs.Write($"接收到扫码枪[{scanner.COM}]扫码数据{currentScanedCode}", LogsType.Scanner); scanner.TempCode += currentScanedCode; //校验末尾码 CheckDataCompleteness(scanner); @@ -88,11 +88,18 @@ namespace 货架标准上位机.ViewModel var isModuleCode = Regex.IsMatch(scanner.TempCode, ModuleCodePattern); if (isModuleCode) { + Logs.Write($"[{scanner.COM}]校验到扫码数据为货架码【{scanner.TempCode}】", LogsType.Scanner); ModuleCodeProcess(scanner); } + else if (scanner.TempCode == "shelfGoOutInStore") + { + Logs.Write($"[{scanner.COM}]校验到扫码数据为结束入库码【{scanner.TempCode}】", LogsType.Scanner); + ShelfGoOutInstoreProcess(scanner); + } //TODO 增加正则表达式进行判断是否扫到的是物料码 else { + Logs.Write($"[{scanner.COM}]校验到扫码数据为物料码【{scanner.TempCode}】", LogsType.Scanner); MatSnProcess(scanner); } } @@ -118,13 +125,15 @@ namespace 货架标准上位机.ViewModel //如果扫码枪前一个货架未退出入库 if (scanner.IsInstoreMode) { - //判断当前入库货架是否包含本次扫码的模组 + //判断当前入库货架是否包含本次扫码的模组 表示用户重复对货架码进行扫码 不能让其多次进入入库 if (scanner.ModulesStr.Contains(scanner.TempCode)) { + Logs.Write($"当前扫码模组{scanner.TempCode},是当前入库货架{scanner.ShelfCode}的模组,不进行操作!", LogsType.Scanner); return; } else { + Logs.Write($"当前扫码模组{scanner.TempCode},不是当前入库货架{scanner.ShelfCode}的模组,先进行当前入库货架的退出入库操作!", LogsType.Scanner); #region 调用接口结束扫码枪占用入库的货架 try { @@ -135,26 +144,32 @@ namespace 货架标准上位机.ViewModel DeviceType = LocalFile.Config.DeviceType, UserName = LocalStatic.CurrentUser, }; - var Result = ApiHelp.GetDataFromHttp(LocalFile.Config.ApiIpHost + "instore/shelfGoOutInStore", body, "POST"); + var Result = ApiHelp.GetDataFromHttp(LocalFile.Config.ApiIpHost + "instore/shelfGoOutInStore", body, "POST", true); if (Result != null && Result.Code == 200) { + Logs.Write($"货架{scanner.ShelfCode}已成功退出入库!", LogsType.Scanner); scanner.ShelfCode = string.Empty; scanner.ModulesStr = string.Empty; - + } + else + { + Logs.Write($"货架{scanner.ShelfCode}退出入库失败!", LogsType.Scanner); + return; } } catch (Exception ex) { - + Logs.Write($"货架{scanner.ShelfCode}退出入库失败!发生异常:{ex.Message}", LogsType.Scanner); } #endregion } } - //调用接口 请求进入入库模式 + //调用接口 本次扫码的货架进入入库模式 #region 调用接口进入入库模式 try { + Logs.Write($"扫码模组{scanner.TempCode},请求进入入库!", LogsType.Scanner); var body = new ShelfGoInInstoreRequest() { ModuleCode = scanner.TempCode, @@ -165,20 +180,25 @@ namespace 货架标准上位机.ViewModel var Result = ApiHelp.GetDataFromHttp(LocalFile.Config.ApiIpHost + "instore/shelfGoInInStore", body, "POST"); if (Result != null && Result.Code == 200) { + Logs.Write($"扫码模组{scanner.TempCode},进入入库模式成功!", LogsType.Scanner); scanner.IsInstoreMode = true; scanner.ShelfCode = Result.Data.ShelfCode; scanner.ModulesStr = Result.Data.ModulesStr; - //TODO 清除其他扫码枪的占用 + + //清除其他扫码枪的占用 var sacnners = ScannerManager.Scanners .Where(t => ShelfCode == Result.Data.ShelfCode) + .Where(t => t.COM != scanner.COM) .ToList(); - foreach (var item in sacnners) + foreach (var scanner1 in sacnners) { - item.ShelfCode = string.Empty; + scanner1.ShelfCode = string.Empty; + scanner1.ModulesStr = string.Empty; } } else if (Result != null && !string.IsNullOrEmpty(Result.Message)) { + Logs.Write($"扫码模组{scanner.TempCode},进入入库模式失败!{Result.Message}", LogsType.Scanner); Growl.Warning(Result.Message); } } @@ -189,6 +209,36 @@ namespace 货架标准上位机.ViewModel #endregion } + /// + /// 扫码枪扫到结束码 + /// + /// + public void ShelfGoOutInstoreProcess(Scanner scanner) + { + #region 调用接口结束扫码枪占用入库的货架 + try + { + var body = new ShelfGoOutInStoreRequest() + { + ShelfCode = scanner.ShelfCode, + IPAdress = scanner.COM, + DeviceType = LocalFile.Config.DeviceType, + UserName = LocalStatic.CurrentUser, + }; + var Result = ApiHelp.GetDataFromHttp(LocalFile.Config.ApiIpHost + "instore/shelfGoOutInStore", body, "POST"); + if (Result != null && Result.Code == 200) + { + scanner.ShelfCode = string.Empty; + scanner.ModulesStr = string.Empty; + + } + } + catch (Exception ex) + { + + } + #endregion + } /// /// 扫到物料码的数据处理 /// diff --git a/货架标准上位机/ViewModels/InOutRecordViewModel.cs b/货架标准上位机/ViewModels/InOutRecordViewModel.cs index 138ebae..5498137 100644 --- a/货架标准上位机/ViewModels/InOutRecordViewModel.cs +++ b/货架标准上位机/ViewModels/InOutRecordViewModel.cs @@ -243,7 +243,7 @@ namespace 货架标准上位机.ViewModel UserName = LocalStatic.CurrentUser, DeviceType = LocalFile.Config.DeviceType, PageNumber = CurrentPage, - PageSize = 10, + PageSize = PageSize, }; var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "inOutRecord/getInOutRecord", body, "POST"); if (Result != null && Result.Data != null && Result.Data.Lists != null) @@ -293,7 +293,7 @@ namespace 货架标准上位机.ViewModel UserName = LocalStatic.CurrentUser, DeviceType = LocalFile.Config.DeviceType, PageNumber = CurrentPage, - PageSize = 10, + PageSize = 65535, }; await ApiHelp.PostDownloadFileAsync(path, System.Net.Http.HttpMethod.Post, LocalFile.Config.ApiIpHost + "inOutRecord/exportInOutRecord", body); Growl.Success("导出成功!"); @@ -334,6 +334,14 @@ namespace 货架标准上位机.ViewModel set { SetProperty(ref totalCount, value); } } + private int pageSize = 10; + public int PageSize + { + get => pageSize; + set { SetProperty(ref pageSize, value); } + } + + public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); } public void BtnFirstPage() { diff --git a/货架标准上位机/ViewModels/InterfaceRecordViewModel.cs b/货架标准上位机/ViewModels/InterfaceRecordViewModel.cs index 1d988da..afd9379 100644 --- a/货架标准上位机/ViewModels/InterfaceRecordViewModel.cs +++ b/货架标准上位机/ViewModels/InterfaceRecordViewModel.cs @@ -157,7 +157,7 @@ namespace 货架标准上位机.ViewModel UserName = LocalStatic.CurrentUser, DeviceType = LocalFile.Config.DeviceType, PageNumber = CurrentPage, - PageSize = 10, + PageSize = PageSize, }; var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "interfaceRecord/getInterfaceRecord", body, "POST"); @@ -211,7 +211,7 @@ namespace 货架标准上位机.ViewModel UserName = LocalStatic.CurrentUser, DeviceType = LocalFile.Config.DeviceType, PageNumber = CurrentPage, - PageSize = 10, + PageSize = 65535, }; await ApiHelp.PostDownloadFileAsync(path, System.Net.Http.HttpMethod.Post, LocalFile.Config.ApiIpHost + "interfaceRecord/exportInterfaceRecord", body); @@ -251,6 +251,14 @@ namespace 货架标准上位机.ViewModel set { SetProperty(ref totalCount, value); } } + private int pageSize = 10; + public int PageSize + { + get => pageSize; + set { SetProperty(ref pageSize, value); } + } + + public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); } public void BtnFirstPage() { diff --git a/货架标准上位机/ViewModels/MatBaseInfoViewModel.cs b/货架标准上位机/ViewModels/MatBaseInfoViewModel.cs index a61d065..ee7e65b 100644 --- a/货架标准上位机/ViewModels/MatBaseInfoViewModel.cs +++ b/货架标准上位机/ViewModels/MatBaseInfoViewModel.cs @@ -142,7 +142,7 @@ namespace 货架标准上位机.ViewModel UserName = LocalStatic.CurrentUser, DeviceType = LocalFile.Config.DeviceType, PageNumber = CurrentPage, - PageSize = 10, + PageSize = PageSize, }; var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "matBaseInfo/getMatBaseInfo", body, "POST"); @@ -163,8 +163,6 @@ namespace 货架标准上位机.ViewModel dia.Close(); } #endregion - - } /// @@ -173,7 +171,6 @@ namespace 货架标准上位机.ViewModel public ICommand BtnExportCommand { get => new DelegateCommand(BtnExport); } public async void BtnExport() { - try { #region 选择文件保存路径 @@ -199,7 +196,7 @@ namespace 货架标准上位机.ViewModel UserName = LocalStatic.CurrentUser, DeviceType = LocalFile.Config.DeviceType, PageNumber = CurrentPage, - PageSize = 10, + PageSize = 65535, }; await ApiHelp.PostDownloadFileAsync(path, System.Net.Http.HttpMethod.Post, LocalFile.Config.ApiIpHost + "matBaseInfo/exportMatBaseInfo", body); Growl.Success("导出成功!"); @@ -240,7 +237,7 @@ namespace 货架标准上位机.ViewModel UserName = LocalStatic.CurrentUser, DeviceType = LocalFile.Config.DeviceType, PageNumber = CurrentPage, - PageSize = 10, + PageSize = 65535, }; var result = await ApiHelp.PostImportFileAsync>>(path, System.Net.Http.HttpMethod.Post, LocalFile.Config.ApiIpHost + "matBaseInfo/importMatBaseInfo", LocalStatic.CurrentUser, LocalFile.Config.DeviceType); @@ -256,7 +253,6 @@ namespace 货架标准上位机.ViewModel else HandyControl.Controls.MessageBox.Show(result.Message); } - } catch (Exception ex) { @@ -295,7 +291,6 @@ namespace 货架标准上位机.ViewModel else { Growl.Error($"{Result?.Message?.ToString()}"); - //BtnAdd(); } } } @@ -430,6 +425,14 @@ namespace 货架标准上位机.ViewModel set { SetProperty(ref totalCount, value); } } + private int pageSize = 10; + public int PageSize + { + get => pageSize; + set { SetProperty(ref pageSize, value); } + } + + public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); } public void BtnFirstPage() { diff --git a/货架标准上位机/ViewModels/MatInfoViewModel.cs b/货架标准上位机/ViewModels/MatInfoViewModel.cs index 02a31c2..810ebac 100644 --- a/货架标准上位机/ViewModels/MatInfoViewModel.cs +++ b/货架标准上位机/ViewModels/MatInfoViewModel.cs @@ -26,11 +26,22 @@ using WCS.Model.ApiModel.MatBaseInfo; using System.Collections.ObjectModel; using HandyControl.Tools.Extension; using 货架标准上位机.Tool; +using System.Printing; +using System.Printing.IndexedProperties; namespace 货架标准上位机.ViewModel { public class MatInfoViewModel : BindableBase { + public MatInfoViewModel() + { + IsPrintedItemSource = new List() + { + new ComboBoxItem(){Text = "全部",Value = null}, + new ComboBoxItem(){Text = "否",Value = false }, + new ComboBoxItem(){Text = "是",Value = true}, + }; + } #region Property private ObservableCollection dataGridItemSource; public ObservableCollection DataGridItemSource @@ -52,6 +63,35 @@ namespace 货架标准上位机.ViewModel } } + private List isPrintedItemSource; + public List IsPrintedItemSource + { + get => isPrintedItemSource; + set { SetProperty(ref isPrintedItemSource, value); } + } + + public class ComboBoxItem + { + public string Text { get; set; } + public bool? Value { get; set; } + } + + private bool? isPrinted; + public bool? IsPrinted + { + get => isPrinted; + set { SetProperty(ref isPrinted, value); } + } + + private string matBatch; + public string MatBatch + { + get => matBatch; + set { SetProperty(ref matBatch, value); } + } + + + /// /// 物料编码 /// @@ -125,7 +165,6 @@ namespace 货架标准上位机.ViewModel return; } #region 调用接口获取数据 - //var dia = Dialog.Show(new TextDialog()); try { var body = new GetMatInfoRequest() @@ -134,11 +173,13 @@ namespace 货架标准上位机.ViewModel MatName = MatName, MatSpec = MatSpec, MatSN = MatSN, + MatBatch = MatBatch, + IsPrinted = IsPrinted, UserName = LocalStatic.CurrentUser, DeviceType = LocalFile.Config.DeviceType, PageNumber = CurrentPage, - PageSize = 10, + PageSize = PageSize, }; var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "matBaseInfo/getMatInfo", body, "POST"); @@ -166,7 +207,7 @@ namespace 货架标准上位机.ViewModel public ICommand BtnDeleteCommand { get => new DelegateCommand(BtnDelete); } public async void BtnDelete() { - Growl.Ask($"是否删除所有勾选得数据]!", isConfirmed => + Growl.Ask($"是否删除所有勾选的数据]!", isConfirmed => { if (isConfirmed) { @@ -187,7 +228,7 @@ namespace 货架标准上位机.ViewModel DeviceType = LocalFile.Config.DeviceType, MatBaseInfoIds = matBaseInfoIds, }; - var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "matBaseInfo/deleteMatBaseInfo", body, "POST"); + var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "matBaseInfos/deleteMatBaseInfo", body, "POST"); if (Result != null && Result.Code == 200) { CurrentPage = 1; @@ -204,10 +245,99 @@ namespace 货架标准上位机.ViewModel } public ICommand BtnPrintCommand { get => new DelegateCommand(BtnPrint); } - public async void BtnPrint() + public void BtnPrint() { - var matBaseInfo = DataGridItemSource?.Where(t => t.IsSelected == true).ToList(); - //TO DO后台批量打印 + var matBaseInfos = DataGridItemSource?.Where(t => t.IsSelected == true).ToList(); + + if (matBaseInfos == null || matBaseInfos.Count == 0) + { + Growl.Warning("请选择需要打印的物料!"); + return; + } + + //重复打印提示 + #region + var printedMatBaseInfo = matBaseInfos.Where(t => t.IsPrinted).ToList(); + if (printedMatBaseInfo != null && printedMatBaseInfo.Count > 0) + { + //拼接提示字符串 + var messageStr = "以下条码已打印:\r\n" + + string.Join("\r\n", printedMatBaseInfo.Select(t => $"[{t.MatSN}]已打印{t.PrintedTimes}次!").ToList()) + + "\r\n\r\n是否继续打印?(重复打印可能造成条码重复)"; + var result = HandyControl.Controls.MessageBox.Show(messageStr, "重复打印提示", MessageBoxButton.OKCancel); + if (result == MessageBoxResult.Cancel) + { + return; + } + } + #endregion + + //批量打印 + Task.Run(() => + { + try + { + ProcessDialog process = null; + Dialog dia = null; + var totalCount = matBaseInfos.Count(); + int currentCount = 0; + + App.Current.Dispatcher.Invoke(() => + { + process = new ProcessDialog(); + dia = Dialog.Show(process); + }); + matBaseInfos.ForEach(t => + { + PrintTender.PrintTag(new PrintClass() + { + MatSn = t.MatSN, + MatName = t.MatName, + MatCode = t.MatCode, + MatBatch = t.MatBatch, + MatQty = t.MatQty.ToString(), + MatSpec = t.MatSpec, + }); + currentCount++; + if (process != null) + process.viewModel.ProcessValue = Convert.ToInt32(((decimal)currentCount / totalCount) * 100); + }); + App.Current.Dispatcher.Invoke(() => + { + dia.Close(); + dia.Collapse(); + }); + + #region 回传后端打印成功 + try + { + var body = new PrintedMatInfoRequest() + { + PrintedMatInfoIds = matBaseInfos.Select(t => t.Id).ToList(), + UserName = LocalStatic.CurrentUser, + DeviceType = LocalFile.Config.DeviceType, + }; + var Result = ApiHelp.GetDataFromHttp(LocalFile.Config.ApiIpHost + "matBaseInfo/printedMatInfo", body, "POST"); + if (Result != null && Result.Code == 200) + { + //回传成功 + } + else + { + //回传失败 + } + } + catch (Exception ex) + { + Logs.Write("回传“打印成功”失败:" + ex.Message); + } + #endregion + } + catch (Exception ex) + { + Logs.Write("打印条码失败:" + ex.Message); + } + }); } #endregion @@ -238,6 +368,14 @@ namespace 货架标准上位机.ViewModel set { SetProperty(ref totalCount, value); } } + private int pageSize = 10; + public int PageSize + { + get => pageSize; + set { SetProperty(ref pageSize, value); } + } + + public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); } public void BtnFirstPage() { diff --git a/货架标准上位机/ViewModels/MatInventoryDetailViewModel.cs b/货架标准上位机/ViewModels/MatInventoryDetailViewModel.cs index b17b2d9..ed5527e 100644 --- a/货架标准上位机/ViewModels/MatInventoryDetailViewModel.cs +++ b/货架标准上位机/ViewModels/MatInventoryDetailViewModel.cs @@ -220,7 +220,7 @@ namespace 货架标准上位机.ViewModel UserName = LocalStatic.CurrentUser, DeviceType = LocalFile.Config.DeviceType, PageNumber = CurrentPage, - PageSize = 10, + PageSize = PageSize, }; var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "matInventoryDetail/getMatInventoryDetail", body, "POST"); if (Result != null && Result.Data != null && Result.Data.Lists != null) @@ -270,7 +270,7 @@ namespace 货架标准上位机.ViewModel UserName = LocalStatic.CurrentUser, DeviceType = LocalFile.Config.DeviceType, PageNumber = CurrentPage, - PageSize = 10, + PageSize = 65535, }; await ApiHelp.PostDownloadFileAsync(path, System.Net.Http.HttpMethod.Post, LocalFile.Config.ApiIpHost + "matInventoryDetail/exportMatInventoryDetail", body); Growl.Success("导出成功!"); @@ -301,7 +301,7 @@ namespace 货架标准上位机.ViewModel UserName = LocalStatic.CurrentUser, DeviceType = LocalFile.Config.DeviceType, PageNumber = 1, - PageSize = 10000, + PageSize = 65535, }; var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "matInventoryDetail/getMatInventoryDetail", body, "POST"); if (Result != null && Result.Data != null && Result.Data.Lists != null) @@ -399,7 +399,7 @@ namespace 货架标准上位机.ViewModel UserName = LocalStatic.CurrentUser, DeviceType = LocalFile.Config.DeviceType, PageNumber = CurrentPage, - PageSize = 10000, + PageSize = 65535, }; var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "matInventoryDetail/getMatInventoryDetail", body, "POST"); if (Result != null && Result.Data != null && Result.Data.Lists != null) @@ -506,6 +506,14 @@ namespace 货架标准上位机.ViewModel set { SetProperty(ref totalCount, value); } } + private int pageSize = 10; + public int PageSize + { + get => pageSize; + set { SetProperty(ref pageSize, value); } + } + + public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); } public void BtnFirstPage() { diff --git a/货架标准上位机/ViewModels/ModuleInfoViewModel.cs b/货架标准上位机/ViewModels/ModuleInfoViewModel.cs new file mode 100644 index 0000000..6476799 --- /dev/null +++ b/货架标准上位机/ViewModels/ModuleInfoViewModel.cs @@ -0,0 +1,228 @@ +using HandyControl.Controls; +using MiniExcelLibs; +using Ping9719.WpfEx.Mvvm; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Input; +using 货架标准上位机.Views.Controls; +using 货架标准上位机.Api; +using WCS.Model; +using WCS.Model.ApiModel.Home; +using WCS.Model.ApiModel.StoreInfo; +using WCS.BLL.DbModels; +using WCS.Model.ApiModel.MatBaseInfo; +using WCS.Model.ApiModel.User; +using WCS.Model.ApiModel; +using Newtonsoft.Json.Bson; + +namespace 货架标准上位机.ViewModel +{ + public class ModuleInfoViewModel : BindableBase + { + public ModuleInfoViewModel() + { + + } + + #region Property + private List dataGridItemSource; + public List DataGridItemSource + { + get { return dataGridItemSource; } + set + { + SetProperty(ref dataGridItemSource, value); + } + } + + private ModuleInfoModel selectedataGridItem; + public ModuleInfoModel SelectedataGridItem + { + get { return selectedataGridItem; } + set + { + SetProperty(ref selectedataGridItem, value); + } + } + + + private string shelfCode; + public string ShelfCode + { + get { return shelfCode; } + set + { + SetProperty(ref shelfCode, value); + } + } + + private string moduleCode; + + public string ModuleCode + { + get => moduleCode; + set { SetProperty(ref moduleCode, value); } + } + + #endregion + + #region Command + public ICommand BtnResetCommand { get => new DelegateCommand(BtnReset); } + public void BtnReset() + { + ModuleCode = string.Empty; + ShelfCode = string.Empty; + } + + public ICommand BtnSearchCommand { get => new DelegateCommand(BtnSearchReset); } + public void BtnSearchReset() + { + BtnSearch(true); + } + + public void BtnSearch(bool IsPageReset = true) + { + if (CurrentPage == 0 || IsPageReset) + { + CurrentPage = 1; + return; + } + #region 调用接口获取数据 + var dia = Dialog.Show(new TextDialog()); + try + { + var body = new GetShelvesRequest() + { + ShelfCode = ShelfCode, + UserName = LocalStatic.CurrentUser, + DeviceType = LocalFile.Config.DeviceType, + PageNumber = CurrentPage, + PageSize = PageSize, + }; + var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "storeInfo/getModules", 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 BtnDeleteCommand { get => new DelegateCommand(BtnDelete); } + public void BtnDelete() + { + //查询勾选的第一个数据 + 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 + + #region PageOperation 分页操作 + private int currentPage; + public int CurrentPage + { + get { return currentPage; } + set + { + SetProperty(ref currentPage, value); + BtnSearch(false); + } + } + + private int maxPage; + public int MaxPage + { + get { return maxPage; } + set { SetProperty(ref maxPage, value); } + } + + //总数量 + private int totalCount; + public int TotalCount + { + get { return totalCount; } + set { SetProperty(ref totalCount, value); } + } + + private int pageSize = 10; + public int PageSize + { + get => pageSize; + set { SetProperty(ref pageSize, value); } + } + + + public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); } + public void BtnFirstPage() + { + CurrentPage = 1; + } + + public ICommand BtnPrePageCommand { get => new DelegateCommand(BtnPrePage); } + public void BtnPrePage() + { + if (CurrentPage > 1) + { + CurrentPage--; + } + } + + public ICommand BtnNextPageCommand { get => new DelegateCommand(BtnNextPage); } + public void BtnNextPage() + { + if (CurrentPage < MaxPage) + { + CurrentPage++; + } + } + + public ICommand BtnLastPageCommand { get => new DelegateCommand(BtnLastPage); } + public void BtnLastPage() + { + if (CurrentPage != MaxPage) + { + CurrentPage = MaxPage; + } + } + #endregion + + } +} diff --git a/货架标准上位机/ViewModels/OutInventoryDocumentViewModel.cs b/货架标准上位机/ViewModels/OutInventoryDocumentViewModel.cs index a62d059..e8bf1b9 100644 --- a/货架标准上位机/ViewModels/OutInventoryDocumentViewModel.cs +++ b/货架标准上位机/ViewModels/OutInventoryDocumentViewModel.cs @@ -100,7 +100,7 @@ namespace 货架标准上位机.ViewModels UserName = LocalStatic.CurrentUser, DeviceType = LocalFile.Config.DeviceType, PageNumber = CurrentPage, - PageSize = 10, + PageSize = PageSize, }; var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "outStore/GetOutOrderList", body, "POST"); if (Result != null && Result.Data != null && Result.Data.Lists != null) @@ -412,6 +412,14 @@ namespace 货架标准上位机.ViewModels set { SetProperty(ref totalCount, value); } } + private int pageSize = 10; + public int PageSize + { + get => pageSize; + set { SetProperty(ref pageSize, value); } + } + + public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); } public void BtnFirstPage() { @@ -445,5 +453,6 @@ namespace 货架标准上位机.ViewModels } } #endregion + } } diff --git a/货架标准上位机/ViewModels/OutInventoryViewModel.cs b/货架标准上位机/ViewModels/OutInventoryViewModel.cs index 1ace054..b3c44fc 100644 --- a/货架标准上位机/ViewModels/OutInventoryViewModel.cs +++ b/货架标准上位机/ViewModels/OutInventoryViewModel.cs @@ -278,6 +278,7 @@ namespace 货架标准上位机.ViewModel if (Result.Data.Count > 0) { DataGridItemSource = new ObservableCollection(Result.Data); + OrderStatus = Result.Message; } else { @@ -285,7 +286,6 @@ namespace 货架标准上位机.ViewModel { DataGridItemSource?.Clear(); }); - Growl.Warning("该单据未查询到发料明细!"); } } diff --git a/货架标准上位机/ViewModels/ShelfInfoViewModel.cs b/货架标准上位机/ViewModels/ShelfInfoViewModel.cs index 5fffe2e..71347d9 100644 --- a/货架标准上位机/ViewModels/ShelfInfoViewModel.cs +++ b/货架标准上位机/ViewModels/ShelfInfoViewModel.cs @@ -135,7 +135,7 @@ namespace 货架标准上位机.ViewModel UserName = LocalStatic.CurrentUser, DeviceType = LocalFile.Config.DeviceType, PageNumber = CurrentPage, - PageSize = 10, + PageSize = PageSize, }; var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "storeInfo/getShelves", body, "POST"); if (Result != null && Result.Data != null && Result.Data.Lists != null) @@ -250,6 +250,14 @@ namespace 货架标准上位机.ViewModel set { SetProperty(ref totalCount, value); } } + private int pageSize = 10; + public int PageSize + { + get => pageSize; + set { SetProperty(ref pageSize, value); } + } + + public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); } public void BtnFirstPage() { diff --git a/货架标准上位机/ViewModels/StocktakingDocumentViewModel.cs b/货架标准上位机/ViewModels/StocktakingDocumentViewModel.cs index 1e99c13..3e10719 100644 --- a/货架标准上位机/ViewModels/StocktakingDocumentViewModel.cs +++ b/货架标准上位机/ViewModels/StocktakingDocumentViewModel.cs @@ -101,7 +101,7 @@ namespace 货架标准上位机.ViewModels UserName = LocalStatic.CurrentUser, DeviceType = LocalFile.Config.DeviceType, PageNumber = CurrentPage, - PageSize = 10, + PageSize = PageSize, }; var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "stockTaking/getStockTakingOrders", body, "POST"); if (Result != null && Result.Data != null && Result.Data.Lists != null) @@ -398,6 +398,7 @@ namespace 货架标准上位机.ViewModels { Growl.Warning("单据已提交,库存数据已修改!"); BtnSearch(); + StockTakingView.viewModel.RefreshStockTakingOrderList(StockTakingView.viewModel.SelectedOutOrderNumber); } else if (Result != null) { @@ -419,6 +420,7 @@ namespace 货架标准上位机.ViewModels } #endregion + #region PageOperation 分页操作 private int currentPage; public int CurrentPage @@ -446,6 +448,14 @@ namespace 货架标准上位机.ViewModels set { SetProperty(ref totalCount, value); } } + private int pageSize = 10; + public int PageSize + { + get => pageSize; + set { SetProperty(ref pageSize, value); } + } + + public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); } public void BtnFirstPage() { diff --git a/货架标准上位机/ViewModels/StocktakingViewModel.cs b/货架标准上位机/ViewModels/StocktakingViewModel.cs index 237626b..cc5bb3d 100644 --- a/货架标准上位机/ViewModels/StocktakingViewModel.cs +++ b/货架标准上位机/ViewModels/StocktakingViewModel.cs @@ -232,6 +232,10 @@ namespace 货架标准上位机.ViewModel { SelectedOutOrder = OutOrderList.Where(t => t.StocktakingOrderNumber == OrderNumber).FirstOrDefault(); } + else + { + SelectedOutOrder = OutOrderList.FirstOrDefault(); ; + } } else if (Result != null && !string.IsNullOrEmpty(Result.Message)) { diff --git a/货架标准上位机/ViewModels/StoreInfoViewModel.cs b/货架标准上位机/ViewModels/StoreInfoViewModel.cs new file mode 100644 index 0000000..c91026c --- /dev/null +++ b/货架标准上位机/ViewModels/StoreInfoViewModel.cs @@ -0,0 +1,214 @@ +using HandyControl.Controls; +using MiniExcelLibs; +using Ping9719.WpfEx.Mvvm; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Input; +using 货架标准上位机.Views.Controls; +using 货架标准上位机.Api; +using WCS.Model; +using WCS.Model.ApiModel.Home; +using WCS.Model.ApiModel.StoreInfo; +using WCS.BLL.DbModels; +using WCS.Model.ApiModel.MatBaseInfo; +using WCS.Model.ApiModel.User; +using WCS.Model.ApiModel; +using Newtonsoft.Json.Bson; + +namespace 货架标准上位机.ViewModel +{ + public class StoreInfoViewModel : BindableBase + { + public StoreInfoViewModel() + { + + } + + #region Property + private List dataGridItemSource; + public List DataGridItemSource + { + get { return dataGridItemSource; } + set + { + SetProperty(ref dataGridItemSource, value); + } + } + + private StoreInfoModel selectedataGridItem; + public StoreInfoModel SelectedataGridItem + { + get { return selectedataGridItem; } + set + { + SetProperty(ref selectedataGridItem, value); + } + } + + + private string shelfCode; + public string ShelfCode + { + get { return shelfCode; } + set + { + SetProperty(ref shelfCode, value); + } + } + + private string moduleCode; + public string ModuleCode + { + get => moduleCode; + set { SetProperty(ref moduleCode, value); } + } + + private string storeCode; + public string StoreCode + { + get => storeCode; + set { SetProperty(ref storeCode, value); } + } + + private string currentMatSN; + public string CurrentMatSN + { + get => currentMatSN; + set { SetProperty(ref currentMatSN, value); } + } + + #endregion + + #region Command + public ICommand BtnResetCommand { get => new DelegateCommand(BtnReset); } + public void BtnReset() + { + ShelfCode = string.Empty; + ModuleCode = string.Empty; + StoreCode = string.Empty; + CurrentMatSN = string.Empty; + } + + public ICommand BtnSearchCommand { get => new DelegateCommand(BtnSearchReset); } + public void BtnSearchReset() + { + BtnSearch(true); + } + + public void BtnSearch(bool IsPageReset = true) + { + if (CurrentPage == 0 || IsPageReset) + { + CurrentPage = 1; + return; + } + #region 调用接口获取数据 + var dia = Dialog.Show(new TextDialog()); + try + { + var body = new GetStoresRequest() + { + ShelfCode = ShelfCode, + ModuleCode = ModuleCode, + StoreCode = StoreCode, + CurrentMatSN = CurrentMatSN, + UserName = LocalStatic.CurrentUser, + DeviceType = LocalFile.Config.DeviceType, + PageNumber = CurrentPage, + PageSize = PageSize, + }; + var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "storeInfo/getStores", 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 + } + #endregion + + #region PageOperation 分页操作 + private int currentPage; + public int CurrentPage + { + get { return currentPage; } + set + { + SetProperty(ref currentPage, value); + BtnSearch(false); + } + } + + private int maxPage; + public int MaxPage + { + get { return maxPage; } + set { SetProperty(ref maxPage, value); } + } + + //总数量 + private int totalCount; + public int TotalCount + { + get { return totalCount; } + set { SetProperty(ref totalCount, value); } + } + + private int pageSize = 10; + public int PageSize + { + get => pageSize; + set { SetProperty(ref pageSize, value); } + } + + + public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); } + public void BtnFirstPage() + { + CurrentPage = 1; + } + + public ICommand BtnPrePageCommand { get => new DelegateCommand(BtnPrePage); } + public void BtnPrePage() + { + if (CurrentPage > 1) + { + CurrentPage--; + } + } + + public ICommand BtnNextPageCommand { get => new DelegateCommand(BtnNextPage); } + public void BtnNextPage() + { + if (CurrentPage < MaxPage) + { + CurrentPage++; + } + } + + public ICommand BtnLastPageCommand { get => new DelegateCommand(BtnLastPage); } + public void BtnLastPage() + { + if (CurrentPage != MaxPage) + { + CurrentPage = MaxPage; + } + } + #endregion + } +} diff --git a/货架标准上位机/Views/Controls/ProcessDialog.xaml b/货架标准上位机/Views/Controls/ProcessDialog.xaml new file mode 100644 index 0000000..46586e5 --- /dev/null +++ b/货架标准上位机/Views/Controls/ProcessDialog.xaml @@ -0,0 +1,16 @@ + + + + + + + @@ -50,19 +50,10 @@ - - + - - + + 入库日志信息 diff --git a/货架标准上位机/Views/InOutRecordView.xaml b/货架标准上位机/Views/InOutRecordView.xaml index bce9355..90a2cb5 100644 --- a/货架标准上位机/Views/InOutRecordView.xaml +++ b/货架标准上位机/Views/InOutRecordView.xaml @@ -161,15 +161,26 @@ - - - - - - - - - + + + + + + + + + + + + + + + 10条/页 + 20条/页 + 50条/页 + 100条/页 + 500条/页 + diff --git a/货架标准上位机/Views/InOutRecordView.xaml.cs b/货架标准上位机/Views/InOutRecordView.xaml.cs index f7afa32..fd4758a 100644 --- a/货架标准上位机/Views/InOutRecordView.xaml.cs +++ b/货架标准上位机/Views/InOutRecordView.xaml.cs @@ -34,6 +34,7 @@ namespace 货架标准上位机 { viewModel.InitMatCode(); viewModel.BtnReset(); + viewModel.BtnSearchReset(); } } } diff --git a/货架标准上位机/Views/InterfaceRecordView.xaml b/货架标准上位机/Views/InterfaceRecordView.xaml index ae1ecff..89176a9 100644 --- a/货架标准上位机/Views/InterfaceRecordView.xaml +++ b/货架标准上位机/Views/InterfaceRecordView.xaml @@ -135,15 +135,26 @@ - - - - - - - - - + + + + + + + + + + + + + + + 10条/页 + 20条/页 + 50条/页 + 100条/页 + 500条/页 + @@ -173,7 +184,6 @@ Command="{Binding BtnLastPageCommand}"/> - diff --git a/货架标准上位机/Views/InterfaceRecordView.xaml.cs b/货架标准上位机/Views/InterfaceRecordView.xaml.cs index 2f0e7b3..91465b9 100644 --- a/货架标准上位机/Views/InterfaceRecordView.xaml.cs +++ b/货架标准上位机/Views/InterfaceRecordView.xaml.cs @@ -41,6 +41,7 @@ namespace 货架标准上位机 private void LoadedVisible(object sender, EventArgs e) { viewModel.BtnReset(); + viewModel.BtnSearchReset(); } } } diff --git a/货架标准上位机/Views/MainWindows/MainWindow1.xaml b/货架标准上位机/Views/MainWindows/MainWindow1.xaml index 5fc7e20..8081593 100644 --- a/货架标准上位机/Views/MainWindows/MainWindow1.xaml +++ b/货架标准上位机/Views/MainWindows/MainWindow1.xaml @@ -186,12 +186,12 @@ - + - + diff --git a/货架标准上位机/Views/MatBaseInfoView.xaml b/货架标准上位机/Views/MatBaseInfoView.xaml index 27c5b35..5d33da3 100644 --- a/货架标准上位机/Views/MatBaseInfoView.xaml +++ b/货架标准上位机/Views/MatBaseInfoView.xaml @@ -184,15 +184,26 @@ - - - - - - - - - + + + + + + + + + + + + + + + 10条/页 + 20条/页 + 50条/页 + 100条/页 + 500条/页 + diff --git a/货架标准上位机/Views/MatBaseInfoView.xaml.cs b/货架标准上位机/Views/MatBaseInfoView.xaml.cs index b67582b..fcdd7cd 100644 --- a/货架标准上位机/Views/MatBaseInfoView.xaml.cs +++ b/货架标准上位机/Views/MatBaseInfoView.xaml.cs @@ -28,6 +28,7 @@ namespace 货架标准上位机 private void LoadedVisible(object sender, EventArgs e) { viewModel.BtnReset(); + viewModel.BtnSearchReset(); } private void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) diff --git a/货架标准上位机/Views/MatBaseInoGenarateMatInfoView.xaml.cs b/货架标准上位机/Views/MatBaseInoGenarateMatInfoView.xaml.cs index e5223c8..cd5b191 100644 --- a/货架标准上位机/Views/MatBaseInoGenarateMatInfoView.xaml.cs +++ b/货架标准上位机/Views/MatBaseInoGenarateMatInfoView.xaml.cs @@ -1,15 +1,21 @@ using HandyControl.Controls; +using HandyControl.Tools.Extension; using SqlSugar; using System; using System.Collections.Generic; +using System.Linq; using System.Text.RegularExpressions; +using System.Threading.Tasks; using System.Windows; +using System.Windows.Controls; using System.Windows.Input; using WCS.BLL.DbModels; using WCS.Model; using WCS.Model.ApiModel.MatBaseInfo; using 货架标准上位机.Api; +using 货架标准上位机.Tool; using 货架标准上位机.ViewModel; +using 货架标准上位机.Views.Controls; namespace 货架标准上位机 { @@ -36,6 +42,7 @@ namespace 货架标准上位机 private void btnOk_Click(object sender, RoutedEventArgs e) { + var button = sender as Button; #region 数据校验 if (string.IsNullOrEmpty(txtMatBatch.Text.Trim())) { @@ -88,6 +95,69 @@ namespace 货架标准上位机 var Result = ApiHelp.GetDataFromHttp>>(LocalFile.Config.ApiIpHost + "matBaseInfo/generateMatInfo", body, "POST"); if (Result != null && Result.Data != null && Result.Data.Count > 0) { + if (button != null && button.Content.ToString().Contains("打印")) + //批量打印 + { + Task.Run(() => + { + ProcessDialog process = null; + Dialog dia = null; + var totalCount = Result.Data.Count; + int currentCount = 0; + + App.Current.Dispatcher.Invoke(() => + { + process = new ProcessDialog(); + dia = Dialog.Show(process); + }); + Result.Data.ForEach(t => + { + PrintTender.PrintTag(new PrintClass() + { + MatSn = t.MatSN, + MatName = t.MatName, + MatCode = t.MatCode, + MatBatch = t.MatBatch, + MatQty = t.MatQty.ToString(), + MatSpec = t.MatSpec, + }); + currentCount++; + if (process != null) + process.viewModel.ProcessValue = Convert.ToInt32(((decimal)currentCount / totalCount) * 100); + }); + App.Current.Dispatcher.Invoke(() => + { + dia.Close(); + dia.Collapse(); + }); + + #region 回传后端打印成功 + try + { + var body = new PrintedMatInfoRequest() + { + PrintedMatInfoIds = Result.Data.Select(t => t.Id).ToList(), + UserName = LocalStatic.CurrentUser, + DeviceType = LocalFile.Config.DeviceType, + }; + var Result11 = ApiHelp.GetDataFromHttp(LocalFile.Config.ApiIpHost + "matBaseInfo/printedMatInfo", body, "POST"); + if (Result11 != null && Result11.Code == 200) + { + //回传成功 + } + else + { + //回传失败 + Logs.Write("回传“打印成功”失败"); + } + } + catch (Exception ex) + { + Logs.Write("回传“打印成功”失败:" + ex.Message); + } + #endregion + }); + } Growl.Success("生成成功!"); } } diff --git a/货架标准上位机/Views/MatInfoView.xaml b/货架标准上位机/Views/MatInfoView.xaml index 87e801d..735ee95 100644 --- a/货架标准上位机/Views/MatInfoView.xaml +++ b/货架标准上位机/Views/MatInfoView.xaml @@ -11,7 +11,8 @@ - + + @@ -58,7 +59,6 @@ VerticalAlignment="Center" HorizontalAlignment="Stretch" FontSize="18" MinWidth="90" Text="{Binding MatSN}"> - + + + + + + + + + + + + - + + + + + + + + + + + + + @@ -79,26 +115,12 @@ - - - - - - - - - + + @@ -151,15 +174,26 @@ - - - - - - - - - + + + + + + + + + + + + + + + 10条/页 + 20条/页 + 50条/页 + 100条/页 + 500条/页 + diff --git a/货架标准上位机/Views/MatInfoView.xaml.cs b/货架标准上位机/Views/MatInfoView.xaml.cs index 19a7e21..42a51d7 100644 --- a/货架标准上位机/Views/MatInfoView.xaml.cs +++ b/货架标准上位机/Views/MatInfoView.xaml.cs @@ -29,6 +29,7 @@ namespace 货架标准上位机 private void LoadedVisible(object sender, EventArgs e) { viewModel.BtnReset(); + viewModel.BtnSearchReset(); } private void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) diff --git a/货架标准上位机/Views/MatInventoryDetailView.xaml b/货架标准上位机/Views/MatInventoryDetailView.xaml index 59c53f0..c87a5a1 100644 --- a/货架标准上位机/Views/MatInventoryDetailView.xaml +++ b/货架标准上位机/Views/MatInventoryDetailView.xaml @@ -161,15 +161,26 @@ - - - - - - - - - + + + + + + + + + + + + + + + 10条/页 + 20条/页 + 50条/页 + 100条/页 + 500条/页 + diff --git a/货架标准上位机/Views/MatInventoryDetailView.xaml.cs b/货架标准上位机/Views/MatInventoryDetailView.xaml.cs index 0f82bb5..2c3da08 100644 --- a/货架标准上位机/Views/MatInventoryDetailView.xaml.cs +++ b/货架标准上位机/Views/MatInventoryDetailView.xaml.cs @@ -34,6 +34,7 @@ namespace 货架标准上位机 { viewModel.InitMatCode(); viewModel.BtnReset(); + viewModel.BtnSearchReset(); } } } diff --git a/货架标准上位机/Views/ModuleInfoView.xaml b/货架标准上位机/Views/ModuleInfoView.xaml new file mode 100644 index 0000000..19b669e --- /dev/null +++ b/货架标准上位机/Views/ModuleInfoView.xaml @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10条/页 + 20条/页 + 50条/页 + 100条/页 + 500条/页 + + + + + + + + + + + + + + + + + - + --> - + @@ -136,15 +136,26 @@ - - - - - - - - - + + + + + + + + + + + + + + + 10条/页 + 20条/页 + 50条/页 + 100条/页 + 500条/页 + diff --git a/货架标准上位机/Views/ShelfInfoView.xaml.cs b/货架标准上位机/Views/ShelfInfoView.xaml.cs index de008f1..82b9efa 100644 --- a/货架标准上位机/Views/ShelfInfoView.xaml.cs +++ b/货架标准上位机/Views/ShelfInfoView.xaml.cs @@ -31,6 +31,7 @@ namespace 货架标准上位机 { viewModel.BtnReset(); viewModel.InitShelfTypeItems(); + viewModel.BtnSearchReset(); } private void allChecked_Checked(object sender, RoutedEventArgs e) @@ -66,7 +67,7 @@ namespace 货架标准上位机 dataGrid.UnselectAllCells(); // 取消选中所有单元格 } } - catch(Exception ex) + catch (Exception ex) { Debug.WriteLine("SelectionChanged event handler failed: " + ex.Message); } diff --git a/货架标准上位机/Views/StockTakingView.xaml b/货架标准上位机/Views/StockTakingView.xaml index 09ed70a..914cc5d 100644 --- a/货架标准上位机/Views/StockTakingView.xaml +++ b/货架标准上位机/Views/StockTakingView.xaml @@ -8,7 +8,7 @@ xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:货架标准上位机="clr-namespace:货架标准上位机" mc:Ignorable="d" - d:DesignHeight="737" d:DesignWidth="1192"> + d:DesignHeight="737" d:DesignWidth="1192" LoadedVisible="UserControlBase_LoadedVisible" > diff --git a/货架标准上位机/Views/StockTakingView.xaml.cs b/货架标准上位机/Views/StockTakingView.xaml.cs index bb38269..1a80b2f 100644 --- a/货架标准上位机/Views/StockTakingView.xaml.cs +++ b/货架标准上位机/Views/StockTakingView.xaml.cs @@ -65,5 +65,10 @@ namespace 货架标准上位机 { viewModel.RefreshStockTakingOrderList(viewModel.SelectedOutOrderNumber); } + + private void UserControlBase_LoadedVisible(object sender, EventArgs e) + { + viewModel.RefreshStockTakingOrderList(); + } } } diff --git a/货架标准上位机/Views/StocktakingDocumentView.xaml b/货架标准上位机/Views/StocktakingDocumentView.xaml index dfaaba5..51a3cbb 100644 --- a/货架标准上位机/Views/StocktakingDocumentView.xaml +++ b/货架标准上位机/Views/StocktakingDocumentView.xaml @@ -93,7 +93,7 @@ - - - - - - - - - + + + + + + + + + + + + + + + 10条/页 + 20条/页 + 50条/页 + 100条/页 + 500条/页 + + diff --git a/货架标准上位机/Views/StoreInfoView.xaml b/货架标准上位机/Views/StoreInfoView.xaml new file mode 100644 index 0000000..7a14c5a --- /dev/null +++ b/货架标准上位机/Views/StoreInfoView.xaml @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +