diff --git a/WCS.BLL/Config/JsConfig.cs b/WCS.BLL/Config/JsConfig.cs new file mode 100644 index 0000000..4b475a2 --- /dev/null +++ b/WCS.BLL/Config/JsConfig.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WCS.BLL.Config +{ + /// + /// json配置文件 + /// + public class JsConfig + { + public List ModuleCodePatterns { get; set; } + } +} diff --git a/WCS.BLL/Config/LocalFile.cs b/WCS.BLL/Config/LocalFile.cs index 5c07427..22b8550 100644 --- a/WCS.BLL/Config/LocalFile.cs +++ b/WCS.BLL/Config/LocalFile.cs @@ -11,17 +11,15 @@ namespace WCS.BLL.Config /// /// 本地文件 /// - public class LocalFile + public static class LocalFile { + + public static readonly string AppDir = AppDomain.CurrentDomain.BaseDirectory; /// /// 程序运行名称(BaseUi.exe) /// public static readonly string AppName = AppDomain.CurrentDomain.FriendlyName; /// - /// 程序运行目录 - /// - public static readonly string AppDir = AppDomain.CurrentDomain.BaseDirectory; - /// /// 数据目录 /// public static readonly string DataDir = Path.Combine(AppDir, "data"); @@ -30,76 +28,72 @@ namespace WCS.BLL.Config /// public static readonly string LogDir = Path.Combine(AppDir, "logs"); /// - /// 运行主程序 - /// - public static readonly string AppPath = Path.Combine(AppDir, AppDomain.CurrentDomain.FriendlyName); - /// /// 配置文件路径 /// public static readonly string ConfigPath = Path.Combine(DataDir, "jsconfig.json"); /// /// 货架模组编码正则表达式 /// - public static readonly string ModuleCodePattern = "^[ABCD][0-9]{1,2}-R[0-9]{1,2}C[0-9]{1,2}$"; + public static readonly string DefaultModuleCodePattern = "^[ABCD][0-9]{1,2}-R[0-9]{1,2}C[0-9]{1,2}$"; static object lockConfig = new object(); - //static JsConfig config; - ///// - ///// 配置信息 - ///// - //public static JsConfig Config - //{ - // get - // { - // if (config != null) - // return config; - // else - // { - // try - // { - // if (File.Exists(ConfigPath)) - // lock (lockConfig) - // config = JsonConvert.DeserializeObject(File.ReadAllText(ConfigPath, Encoding.UTF8)); - // else - // config = null; - // } - // catch (Exception) - // { - // config = null; - // } - // } - // return config ?? new JsConfig(); - // } - //} + static JsConfig config; + /// + /// 配置信息 + /// + public static JsConfig Config + { + get + { + if (config != null) + return config; + else + { + try + { + if (File.Exists(ConfigPath)) + lock (lockConfig) + config = JsonConvert.DeserializeObject(File.ReadAllText(ConfigPath, Encoding.UTF8)); + else + config = null; + } + catch (Exception) + { + config = null; + } + } + return config ?? new JsConfig(); + } + } - ///// - ///// 刷新配置信息。将本地的配置信息重新加载到内存中 - ///// - //public static void UpdateConfig() - //{ - // if (File.Exists(ConfigPath)) - // lock (lockConfig) - // config = JsonConvert.DeserializeObject(File.ReadAllText(ConfigPath, Encoding.UTF8)); - // else - // config = null; - //} + /// + /// 刷新配置信息。将本地的配置信息重新加载到内存中 + /// + public static void UpdateConfig() + { + if (File.Exists(ConfigPath)) + lock (lockConfig) + config = JsonConvert.DeserializeObject(File.ReadAllText(ConfigPath, Encoding.UTF8)); + else + config = null; + } - ///// - ///// 保存配置信息。将内存中的配置信息保存到本地 - ///// - //public static void SaveConfig() - //{ - // try - // { - // lock (lockConfig) - // File.WriteAllText(ConfigPath, JsonConvert.SerializeObject(Config, Formatting.Indented), Encoding.UTF8); - // } - // catch (Exception ex) - // { - // UpdateConfig(); - // throw ex; - // } - //} + /// + /// 保存配置信息。将内存中的配置信息保存到本地 + /// + public static void SaveConfig() + { + try + { + lock (lockConfig) + File.WriteAllText(ConfigPath, JsonConvert.SerializeObject(Config, Formatting.Indented), Encoding.UTF8); + } + catch (Exception ex) + { + UpdateConfig(); + throw ex; + } + } } } diff --git a/WCS.BLL/HardWare/SmartShelf.cs b/WCS.BLL/HardWare/SmartShelf.cs index 3f25da2..2d4de35 100644 --- a/WCS.BLL/HardWare/SmartShelf.cs +++ b/WCS.BLL/HardWare/SmartShelf.cs @@ -116,7 +116,8 @@ namespace WCS.BLL.HardWare /// 过程中异常 入库过程中异常/出库过程中异常 /// public List ProcessingExceptions { get; set; } = new List(); - public string? InstoreIpAddress { get; set; } = string.Empty; + public string? CurrentCom { get; set; } = string.Empty; + //TODO 退出入库清除 public MatInfoResponse InStoreData { get; set; } @@ -137,7 +138,7 @@ namespace WCS.BLL.HardWare { if (this.CurentMode == Mode.入库模式) { - InstoreIpAddress = IPAddress; + CurrentCom = IPAddress; return; } //判断当前模式是否为待机模式 @@ -181,7 +182,6 @@ namespace WCS.BLL.HardWare if (deficientTime > 0) Thread.Sleep(deficientTime); //出现异常的未进入入库模式,有红灯进行指引 - this.CurentMode = Mode.待机模式; break; } @@ -195,7 +195,7 @@ namespace WCS.BLL.HardWare if (notInstoreList.Count > 0) { - CurentMode = Mode.待机模式; + foreach (var item in notInstoreList) { ExceptionMessages.Add($"模组{item.ModuleCode}未进入入库模式!"); @@ -205,7 +205,7 @@ namespace WCS.BLL.HardWare //警示灯亮起 WarningLight.BlueLight(TcpCleint); //绑定当前进入入库PDA/WCS前端的IP - InstoreIpAddress = IPAddress; + CurrentCom = IPAddress; //返回成功 return; } @@ -356,7 +356,7 @@ namespace WCS.BLL.HardWare #region 协议返回处理 public void ProtocolProcess(byte[] data, int boardId, int lightNumber) { - Logs.Write("协议处理中的数据" + BitConverter.ToString(data) + $"板子id{boardId}"); + Logs.Write("协议处理4"); //协议处理 判断功能位 switch (data[TcpCleint.PreFixLength + 2]) { @@ -381,13 +381,18 @@ namespace WCS.BLL.HardWare case 0x07://正常出库返回信号 OutstoreReturnProcess(data, boardId, lightNumber); break; + case 0x08://出库模式中异常信号 + OutstoreExceptionReturnProcess(data, boardId, lightNumber); + break; case 0x13://复位的返回信号 ResetReturnProcess(data, boardId, lightNumber); break; default: ; break; + } + Logs.Write("协议处理5"); } /// /// 进入入库模式返回信号处理 @@ -510,7 +515,7 @@ namespace WCS.BLL.HardWare //库位未配置、返回数据异常 else { - //Logs.Write($"[进入入库模式异常]板Id{boardIds},库位号{index + 1}找不到对应库位!"); + Logs.Write($"[进入入库模式异常]板Id{boardId},库位号{index + 1}找不到对应库位!"); } } else if (dataTemp[2 * index] == '0') @@ -556,22 +561,26 @@ namespace WCS.BLL.HardWare /// public void InStoreReturnProcess(byte[] data) { + Logs.Write("协议处理5.1"); 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 && t.LightNumber == number).First(); + Logs.Write("协议处理5.2"); if (storeInfo == null) { - //TO DO 报错 + //TODO 报错 return; } + Logs.Write("协议处理5.3"); var module = this.Modules.Where(t => t.BoardId == boardId) .FirstOrDefault(); if (module == null) { - //TO DO 报错 + //TODO 报错 return; } + Logs.Write("协议处理5.4"); #region 判断是否扫码获取物料信息 //物料未扫码 if (this.InStoreData == null) @@ -580,18 +589,17 @@ namespace WCS.BLL.HardWare if (!string.IsNullOrEmpty(storeInfo.CurrentMatSn)) { module.ComfirmInstore(TcpCleint); - //TO DO Logs.Write($"[{guid}]CAN给了多次正常入库信号,防止硬件异常,返回了确认入库"); + Logs.Write($"CAN给了多次正常入库信号,防止硬件异常,返回了确认入库"); return; } else { + Logs.Write("协议处理5.5"); var exceptionMessage = storeInfo.StoreCode + "入库过程中存在物料未扫描上架!"; WebSoceketManager.TrySendMessage("127.0.0.1", exceptionMessage); - + Logs.Write("协议处理5.4"); module.ComfirmErrInstore(TcpCleint); - WarningLight.WaringLightBlueEnd(TcpCleint); - //WaringLightBlueEnd(shelfStatus.ClientIp, shelfStatus.LightId); - //TO DO Logs.Write($"[{guid}]当前物料信息不存在,请取出后重新扫码进行入库!"); + WarningLight.WaringLightAlwaysRed(TcpCleint); return; } } @@ -664,7 +672,6 @@ namespace WCS.BLL.HardWare this.InStoreData = null; //实际入库位置亮灯1S,报警灯同时进行亮绿灯并鸣叫一次提示。 - Thread.Sleep(20); Task.Run(() => { //确认入库(硬件入库位置亮灯1秒) @@ -694,50 +701,56 @@ namespace WCS.BLL.HardWare /// public void InStoreExceptionReturnProcess(byte[] data, int boardId, int lightNumber) { + Logs.Write("协议处理5.1"); lightNumber = (int)data[TcpCleint.PreFixLength + 4]; var store = DbHelp.db.Queryable() .Where(t => t.BoardId == boardId && t.LightNumber == lightNumber) .First(); + Logs.Write("协议处理5.2"); if (store == null) { //TO DO 库位未找到 return; } + Logs.Write("协议处理5.3"); //已放物料丢失了 物料多放了 储位恢复正常 switch (data[TcpCleint.PreFixLength + 3]) { case 0x00: { + Logs.Write("协议处理5.4"); var exceptionMessage = store.StoreCode + "恢复正常!"; WebSoceketManager.TrySendMessage("127.0.0.1", exceptionMessage); - ProcessingExceptions.RemoveAll(t => t.BoardId == boardId); + Logs.Write("协议处理5.5"); } break; case 0x01: { + Logs.Write("协议处理5.4"); var exceptionMessage = store.StoreCode + "入库过程中存在物料未扫描上架!"; WebSoceketManager.TrySendMessage("127.0.0.1", exceptionMessage); - ProcessingExceptions.Add(new ProcessingExceptionType() { BoardId = boardId, LightNumber = lightNumber, ExceptionMessage = store.StoreCode + "入库过程中存在物料未扫描上架!" }); + Logs.Write("协议处理5.5"); } break; case 0x02: { + Logs.Write("协议处理5.4"); var exceptionMessage = store.StoreCode + "物料被取出!"; WebSoceketManager.TrySendMessage("127.0.0.1", exceptionMessage); - ProcessingExceptions.Add(new ProcessingExceptionType() { BoardId = boardId, LightNumber = lightNumber, ExceptionMessage = store.StoreCode + "入库过程中物料丢失!" }); + Logs.Write("协议处理5.5"); } break; default: @@ -896,7 +909,7 @@ namespace WCS.BLL.HardWare if (CurentMode != Mode.出库模式) { //TO DO 未在出库模式 要报错 - //Logs.Write($"[{guid}]出库错误:该货架模式不是出库模式或盘点模式{storeInfo.ShelfCode}!"); + Logs.Write($"出库错误:{ShelfCode}该货架模式不是出库模式或盘点模式!"); return; } lightNumber = Convert.ToInt32(data[TcpCleint.PreFixLength + 3]); @@ -927,7 +940,7 @@ namespace WCS.BLL.HardWare //不是本次出库需要出的物料 if (!CurrentOutStoreMatSNs.Contains(storeInfo.CurrentMatSn)) { - //Logs.Write($"{storeInfo.CurrentMatSN}不是本次需要出库的物料"); + Logs.Write($"{storeInfo.CurrentMatSn}不是本次需要出库的物料"); //报警灯报警 WarningLight.WaringLightAlwaysRed(TcpCleint); return; @@ -937,7 +950,7 @@ namespace WCS.BLL.HardWare var inventoryDetail = DbHelp.db.Queryable().Where(t => t.MatSN == storeInfo.CurrentMatSn).First(); if (inventoryDetail == null) { - //Logs.Write($"{storeInfo.CurrentMatSN}库存信息不存在"); + Logs.Write($"{storeInfo.CurrentMatSn}库存信息不存在"); //报警灯报警 WarningLight.WaringLightAlwaysRed(TcpCleint); return; @@ -949,7 +962,7 @@ namespace WCS.BLL.HardWare .ToList(); if (orderOrderDetails == null || orderOrderDetails.Count == 0) { - //Logs.Write($"{storeInfo.CurrentMatSN},OrderDetail出库明细信息不存在"); + Logs.Write($"{storeInfo.CurrentMatSn},OrderDetail出库明细信息不存在"); //报警灯报警 WarningLight.WaringLightAlwaysRed(TcpCleint); return; @@ -1003,27 +1016,24 @@ namespace WCS.BLL.HardWare //确认本次出库 module.ComfirmOutstore(TcpCleint, data[TcpCleint.PreFixLength + 3]); - //shelfStatus.SetCurrentModeTime = DateTime.Now; - //LocalStatic.IsRefreshOrderDetail = true; + Task.Run(() => + { + //给信号通知出库页面更新页面的状态 + }); //当前柜子是否还存在未出库的 CurrentOutStoreMatSNs.RemoveAll(t => t == matSN);//删除本次已出的物料SN + var isExsistOut = CurrentOutStoreMatSNs.Any(); + //本批次出库已完成 if (!isExsistOut) { - //Logs.Write($"货架[{shelfStatus.ShelfCode}]:不存在待出物料,退出出库模式"); //退出出库模式 GoOutOutstore(); WarningLight.CloseLight(TcpCleint); - var currentPickBillNumber = CurrentOutOrder.OrderNumber; CurrentOutOrder = null; - Task.Run(() => - { - //LocalStatic.UpdatOutOrderStatus(currentPickBillNumber); - //给信号通知出库页面更新页面的状态 - }); } } catch (Exception ex) @@ -1052,6 +1062,63 @@ namespace WCS.BLL.HardWare } } + /// + /// 出库模式中异常处理 + /// + /// + /// + /// + public void OutstoreExceptionReturnProcess(byte[] data, int boardId, int lightNumber) + { + lightNumber = (int)data[TcpCleint.PreFixLength + 4]; + var store = DbHelp.db.Queryable() + .Where(t => t.BoardId == boardId && t.LightNumber == lightNumber) + .First(); + if (store == null) + { + //TO DO 库位未找到 + return; + } + //已放物料丢失了 物料多放了 储位恢复正常 + switch (data[TcpCleint.PreFixLength + 3]) + { + case 0x00: + { + var exceptionMessage = store.StoreCode + "恢复正常!"; + WebSoceketManager.TrySendMessage("127.0.0.1", exceptionMessage); + ProcessingExceptions.RemoveAll(t => t.BoardId == boardId); + } + break; + case 0x01: + { + var exceptionMessage = store.StoreCode + "出库过程中存在物料上架!"; + WebSoceketManager.TrySendMessage("127.0.0.1", exceptionMessage); + ProcessingExceptions.Add(new ProcessingExceptionType() + { + BoardId = boardId, + LightNumber = lightNumber, + ExceptionMessage = store.StoreCode + "出库过程中存在物料上架!" + }); + } + break; + case 0x02: + { + var exceptionMessage = store.StoreCode + "物料被取出!"; + WebSoceketManager.TrySendMessage("127.0.0.1", exceptionMessage); + ProcessingExceptions.Add(new ProcessingExceptionType() + { + BoardId = boardId, + LightNumber = lightNumber, + ExceptionMessage = store.StoreCode + "出库过程中物料被异常取出!" + }); + } + break; + default: + break; + } + } + + public void ResetReturnProcess(byte[] data, int boardId, int lightNumber) { var module = this.Modules.Where(t => t.BoardId == boardId && t.CurrentMode == Mode.入库模式).FirstOrDefault(); @@ -1065,7 +1132,6 @@ namespace WCS.BLL.HardWare } } - #endregion } diff --git a/WCS.BLL/Manager/TCPClientManager.cs b/WCS.BLL/Manager/TCPClientManager.cs index 5cecb13..9e4ac1d 100644 --- a/WCS.BLL/Manager/TCPClientManager.cs +++ b/WCS.BLL/Manager/TCPClientManager.cs @@ -20,10 +20,10 @@ namespace WCS.BLL.Manager public static List TCPClients = new List(); public static void InitTcpClient() { - var ips = DbHelp.db.Queryable().Where(t => t.ShelfCode.Contains("A")).Select(t => t.ClientIp).ToList(); + var ips = DbHelp.db.Queryable().Where(t => t.ShelfCode.Contains("C")).Select(t => t.ClientIp).ToList(); foreach (var ip in ips) { - var tcpCleint = new TCPClient(ip, "192.168.0.183:20003"); + var tcpCleint = new TCPClient(ip, "192.168.9.183:20003"); //var tcpCleint = new TCPClient("192.168.0.183:20002", "192.168.0.183:20003"); @@ -31,6 +31,7 @@ namespace WCS.BLL.Manager tcpCleint.tcpClient.Received += (client, e) => { + var clientIpHost = client.IP + ":" + client.Port; var TcpCleint = TCPClientManager.GetTCPClientByIPHost(clientIpHost); if (TcpCleint == null) @@ -49,8 +50,8 @@ namespace WCS.BLL.Manager var isEqual = prefixInData.SequenceEqual(TcpCleint.Prefix); if (isEqual) { + Logs.Write("协议处理1!"); var dataTemp = data.Skip(index).Take(TcpCleint.PreFixLength + TcpCleint.DataLength).ToArray(); - Logs.Write($"接受到数据:{BitConverter.ToString(dataTemp)}"); if (dataTemp.Length < TcpCleint.PreFixLength + TcpCleint.DataLength)//拆包后不满足一条指令的长度 { continue; @@ -60,6 +61,7 @@ namespace WCS.BLL.Manager var boardId = (dataTemp[TcpCleint.PreFixLength + 0] << 8) + dataTemp[TcpCleint.PreFixLength + 1]; var lightNumber = Convert.ToInt32(dataTemp[TcpCleint.PreFixLength + 3]); + Logs.Write("协议处理2!"); //报警灯 if (dataTemp[TcpCleint.PreFixLength + 2] == 0x20) { @@ -69,9 +71,10 @@ namespace WCS.BLL.Manager var smartShelf = shelf as SmartShelf; smartShelf?.ProtocolProcess(dataTemp, boardId, lightNumber); } - //货架类型协议返回 + //!= 0x20 货架类型协议返回 else { + Logs.Write("协议处理3!"); var shelf = ShelfManager.Shelves .Where(t => t.ClientIp == clientIpHost) .Where(t => t.ModuleIds.Contains(boardId)) @@ -96,6 +99,7 @@ namespace WCS.BLL.Manager //} } } + Logs.Write("协议处理完毕!"); return EasyTask.CompletedTask; }; diff --git a/WCS.BLL/Services/IService/IGenerateService.cs b/WCS.BLL/Services/IService/IGenerateService.cs index c2f5e61..e73a90a 100644 --- a/WCS.BLL/Services/IService/IGenerateService.cs +++ b/WCS.BLL/Services/IService/IGenerateService.cs @@ -1,6 +1,5 @@  using WCS.BLL.DbModels; -using WCS.DAL.AuthDbModel; using WCS.Model; using WCS.Model.ApiModel; using WCS.Model.ApiModel.MatBaseInfo; diff --git a/WCS.BLL/Services/IService/IInterfaceRecordService.cs b/WCS.BLL/Services/IService/IInterfaceRecordService.cs index 24fab4d..9eb6ec8 100644 --- a/WCS.BLL/Services/IService/IInterfaceRecordService.cs +++ b/WCS.BLL/Services/IService/IInterfaceRecordService.cs @@ -1,6 +1,5 @@  using WCS.BLL.DbModels; -using WCS.DAL.AuthDbModel; using WCS.Model; using WCS.Model.ApiModel; using WCS.Model.ApiModel.User; diff --git a/WCS.BLL/Services/IService/IMatBaseInfoService.cs b/WCS.BLL/Services/IService/IMatBaseInfoService.cs index 674cc61..3529c84 100644 --- a/WCS.BLL/Services/IService/IMatBaseInfoService.cs +++ b/WCS.BLL/Services/IService/IMatBaseInfoService.cs @@ -1,6 +1,5 @@  using WCS.BLL.DbModels; -using WCS.DAL.AuthDbModel; using WCS.Model; using WCS.Model.ApiModel; using WCS.Model.ApiModel.MatBaseInfo; diff --git a/WCS.BLL/Services/IService/IMatInventoryDetailService.cs b/WCS.BLL/Services/IService/IMatInventoryDetailService.cs index 6d54543..87024f8 100644 --- a/WCS.BLL/Services/IService/IMatInventoryDetailService.cs +++ b/WCS.BLL/Services/IService/IMatInventoryDetailService.cs @@ -1,6 +1,5 @@  using WCS.BLL.DbModels; -using WCS.DAL.AuthDbModel; using WCS.Model; using WCS.Model.ApiModel; using WCS.Model.ApiModel.MatInventoryDetail; diff --git a/WCS.BLL/Services/IService/IOutstoreService.cs b/WCS.BLL/Services/IService/IOutstoreService.cs index faca2dc..c8ca3c8 100644 --- a/WCS.BLL/Services/IService/IOutstoreService.cs +++ b/WCS.BLL/Services/IService/IOutstoreService.cs @@ -15,6 +15,8 @@ namespace WCS.BLL.Services.IService public Task GetOutOrderList(GetOutOrderListRequest request); + public Task GetOutOrderListByStatus(GetOutOrderListByStatusRequest request); + public Task GetOutOrderDetail(GetOutOrderDetailRequest request); public Task GetOutOrderMatDetail(GetOutOrderDetailRequest request); diff --git a/WCS.BLL/Services/IService/IStockTakingService.cs b/WCS.BLL/Services/IService/IStockTakingService.cs index b35785f..5dcb24c 100644 --- a/WCS.BLL/Services/IService/IStockTakingService.cs +++ b/WCS.BLL/Services/IService/IStockTakingService.cs @@ -27,7 +27,7 @@ namespace WCS.BLL.Services.IService public Task queryMatInfoInStocktakingOrder(QueryMatInfoInStocktakingOrderRequest request); - public Task comfirmStocktakingOrder(ComfirmStocktakingOrderRequest request); + public Task confirmStocktakingOrder(ConfirmStocktakingOrderRequest request); public Task commitStockTakingOrder(GetStockTakingOrderMatDetailRequest request); } diff --git a/WCS.BLL/Services/IService/IStoreInfoService.cs b/WCS.BLL/Services/IService/IStoreInfoService.cs index 78f4ed3..b871fd3 100644 --- a/WCS.BLL/Services/IService/IStoreInfoService.cs +++ b/WCS.BLL/Services/IService/IStoreInfoService.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using WCS.DAL.AuthDbModel; using WCS.Model.ApiModel.User; using WCS.Model; using WCS.DAL.DbModels; diff --git a/WCS.BLL/Services/IService/IUserService.cs b/WCS.BLL/Services/IService/IUserService.cs index 0c64920..a4730e9 100644 --- a/WCS.BLL/Services/IService/IUserService.cs +++ b/WCS.BLL/Services/IService/IUserService.cs @@ -1,5 +1,4 @@ - -using WCS.DAL.AuthDbModel; +using WCS.DAL.Db.AuthDb; using WCS.Model; using WCS.Model.ApiModel; using WCS.Model.ApiModel.User; diff --git a/WCS.BLL/Services/Service/GenerateService.cs b/WCS.BLL/Services/Service/GenerateService.cs index cffa305..d20624f 100644 --- a/WCS.BLL/Services/Service/GenerateService.cs +++ b/WCS.BLL/Services/Service/GenerateService.cs @@ -11,7 +11,6 @@ using TouchSocket.Core; using WCS.BLL.DbModels; using WCS.BLL.Services.IService; using WCS.DAL; -using WCS.DAL.AuthDbModel; using WCS.DAL.Db; using WCS.Model; using WCS.Model.ApiModel; diff --git a/WCS.BLL/Services/Service/InstoreService.cs b/WCS.BLL/Services/Service/InstoreService.cs index f7b71b0..f6ba428 100644 --- a/WCS.BLL/Services/Service/InstoreService.cs +++ b/WCS.BLL/Services/Service/InstoreService.cs @@ -23,7 +23,25 @@ namespace WCS.BLL.Services.Service public ResponseBase shelfGoInInStore(ShelfGoInInstoreRequest request) { //校验货架编码规则 - bool isValid = Regex.IsMatch(request.ModuleCode, LocalFile.ModuleCodePattern); + //取配置文件中得货架编码规则 + bool isValid = false; + var patterns = LocalFile.Config.ModuleCodePatterns; + if (patterns != null && patterns.Count > 0) + { + foreach (var pattern in patterns) + { + isValid = Regex.IsMatch(request.ModuleCode, pattern); + //匹配到第一个符合条件的货架码 就直接退出循环 认为匹配成功 + if (isValid) + break; + } + } + //如果配置文件缺失 使用默认正则进行匹配 + else + { + isValid = Regex.IsMatch(request.ModuleCode, LocalFile.DefaultModuleCodePattern); + } + if (!isValid) { return new ResponseBase() @@ -50,7 +68,7 @@ namespace WCS.BLL.Services.Service return new ShelfGoInInstoreResponse() { Code = 200, - Message = "货架进入入库模式成功!", + Message = $"货架进入入库模式成功!{string.Join(",", shelf.ExceptionMessages)}", Data = new ShelfGoInInstoreDto() { ShelfCode = shelf.ShelfCode, @@ -130,7 +148,7 @@ namespace WCS.BLL.Services.Service }; } #region 获取物料数据 //调用接口或者直接查询数据库 - //调用接口 + //TODO做成配置 调用接口 if (1 != 1) { @@ -141,7 +159,7 @@ namespace WCS.BLL.Services.Service var matInfo = await DbHelp.db.Queryable().Where(t => t.MatSn == request.MatSn).FirstAsync(); if (matInfo != null) { - + //TODO 改成wcs的实体 shelf.InStoreData = new MatInfoResponse() { materialBar = matInfo.MatSn, @@ -198,7 +216,7 @@ namespace WCS.BLL.Services.Service }; } - //这个时间相当于需要入库扫码后需要等待的时间 + //TODO 配置这个时间相当于需要入库扫码后需要等待的时间 var timeOut = 5000; var timeSpan = TimeSpan.FromMilliseconds(0); var beginTime = DateTime.Now; diff --git a/WCS.BLL/Services/Service/InterfaceRecordService.cs b/WCS.BLL/Services/Service/InterfaceRecordService.cs index cab7205..09a4578 100644 --- a/WCS.BLL/Services/Service/InterfaceRecordService.cs +++ b/WCS.BLL/Services/Service/InterfaceRecordService.cs @@ -9,7 +9,6 @@ using TouchSocket.Core; using WCS.BLL.DbModels; using WCS.BLL.Services.IService; using WCS.DAL; -using WCS.DAL.AuthDbModel; using WCS.DAL.Db; using WCS.Model; using WCS.Model.ApiModel; diff --git a/WCS.BLL/Services/Service/MatBaseInfoService.cs b/WCS.BLL/Services/Service/MatBaseInfoService.cs index b6acc77..29df460 100644 --- a/WCS.BLL/Services/Service/MatBaseInfoService.cs +++ b/WCS.BLL/Services/Service/MatBaseInfoService.cs @@ -10,7 +10,6 @@ using TouchSocket.Core; using WCS.BLL.DbModels; using WCS.BLL.Services.IService; using WCS.DAL; -using WCS.DAL.AuthDbModel; using WCS.DAL.Db; using WCS.Model; using WCS.Model.ApiModel; diff --git a/WCS.BLL/Services/Service/MatInventoryDetailService.cs b/WCS.BLL/Services/Service/MatInventoryDetailService.cs index c1e226a..126c1b1 100644 --- a/WCS.BLL/Services/Service/MatInventoryDetailService.cs +++ b/WCS.BLL/Services/Service/MatInventoryDetailService.cs @@ -8,8 +8,6 @@ using System.Threading.Tasks; using TouchSocket.Core; using WCS.BLL.DbModels; using WCS.BLL.Services.IService; -using WCS.DAL; -using WCS.DAL.AuthDbModel; using WCS.DAL.Db; using WCS.DAL.DbModels; using WCS.Model; diff --git a/WCS.BLL/Services/Service/OutstoreService.cs b/WCS.BLL/Services/Service/OutstoreService.cs index 3c37eb3..087638b 100644 --- a/WCS.BLL/Services/Service/OutstoreService.cs +++ b/WCS.BLL/Services/Service/OutstoreService.cs @@ -204,6 +204,7 @@ namespace WCS.BLL.Services.Service } + public async Task GetOutOrderList(GetOutOrderListRequest request) { //直接查询 @@ -236,6 +237,43 @@ namespace WCS.BLL.Services.Service }; } + public async Task GetOutOrderListByStatus(GetOutOrderListByStatusRequest request) + { + if (request.OrderExeStatus == null || request.OrderExeStatus.Count == 0) + { + //不传入状态不显示 + return new PageQueryResponse() + { + Code = 200, + Message = $"success", + Data = new PageQueryResponseData() + { + Lists = new List() + } + }; + } + //直接查询 + var recordsQueryable = DbHelp.db.Queryable(); + + var totalCount = await recordsQueryable.CountAsync(); + var records = await recordsQueryable + .OrderByDescending(t => t.CreateTime) + //.Take(request.PageSize) + .ToListAsync(); + + 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() + } + }; + } public async Task GetOutOrderDetail(GetOutOrderDetailRequest request) { OutOrder outOrder = null; @@ -288,7 +326,6 @@ namespace WCS.BLL.Services.Service } #endregion - return new ResponseCommon>() { Code = 200, @@ -428,7 +465,7 @@ namespace WCS.BLL.Services.Service var matDetails = outOrderMatDetails.Where(t => t.StoreInfo.ShelfCode == shelf.ShelfCode) .Distinct() .ToList(); - shelf.GoInOutstore(matDetails,order); + shelf.GoInOutstore(matDetails, order); }); //返回 diff --git a/WCS.BLL/Services/Service/StockTakingService.cs b/WCS.BLL/Services/Service/StockTakingService.cs index 65283cb..8253385 100644 --- a/WCS.BLL/Services/Service/StockTakingService.cs +++ b/WCS.BLL/Services/Service/StockTakingService.cs @@ -606,7 +606,7 @@ namespace WCS.BLL.Services.Service } - public async Task comfirmStocktakingOrder(ComfirmStocktakingOrderRequest request) + public async Task confirmStocktakingOrder(ConfirmStocktakingOrderRequest request) { //获取盘点物料明细 var stockTakingMatDetail =await DbHelp.db.Queryable() diff --git a/WCS.BLL/Services/Service/StoreInfoService.cs b/WCS.BLL/Services/Service/StoreInfoService.cs index dc6b8d6..d5aad9b 100644 --- a/WCS.BLL/Services/Service/StoreInfoService.cs +++ b/WCS.BLL/Services/Service/StoreInfoService.cs @@ -8,7 +8,6 @@ using TouchSocket.Core; using WCS.BLL.DbModels; using WCS.BLL.Services.IService; using WCS.DAL; -using WCS.DAL.AuthDbModel; using WCS.DAL.Db; using WCS.DAL.DbModels; using WCS.Model; diff --git a/WCS.BLL/Services/Service/UserService.cs b/WCS.BLL/Services/Service/UserService.cs index 66a4ae0..8fa5916 100644 --- a/WCS.BLL/Services/Service/UserService.cs +++ b/WCS.BLL/Services/Service/UserService.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; using TouchSocket.Core; using WCS.BLL.Services.IService; using WCS.DAL; -using WCS.DAL.AuthDbModel; +using WCS.DAL.Db.AuthDb; using WCS.Model; using WCS.Model.ApiModel; using WCS.Model.ApiModel.User; diff --git a/WCS.BLL/Tool/TCPClient.cs b/WCS.BLL/Tool/TCPClient.cs index 86064ee..def1083 100644 --- a/WCS.BLL/Tool/TCPClient.cs +++ b/WCS.BLL/Tool/TCPClient.cs @@ -77,6 +77,7 @@ namespace WCS.BLL { 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++) { @@ -103,7 +104,9 @@ namespace WCS.BLL index += (PreFixLength + DataLength - 1);//每次循环index会+1 所以这里-1 } } + Logs.Write($"校验发送接收处理完毕" + BitConverter.ToString(data)); return null; + }; tcpClient.Connected += (client, e) => @@ -125,15 +128,23 @@ namespace WCS.BLL { try { - //TO DO如果指令未回应n次 则取消重发 + //TODO如果指令未回应n次 则取消重发 Console.WriteLine(Thread.CurrentThread.ManagedThreadId); - await Task.Delay(3000); + await Task.Delay(100); if (MessageList.Count > 0) { + var failedMessage = MessageList.Where(t => t.Value.SendTimes >= 3).ToList(); + foreach (var message in failedMessage) + { + Logs.Write(BitConverter.ToString(message.Value.Message) + + "指令未响应"); + } + MessageList.RemoveWhen(t => t.Value.SendTimes >= 3); + Console.WriteLine(Thread.CurrentThread.ManagedThreadId); foreach (var item in MessageList) { - if (item.Value.LastSendTime < DateTime.Now.AddSeconds(3)) + if (item.Value.LastSendTime < DateTime.Now.AddSeconds(-1)) { tcpClient.Send(item.Value.Message); item.Value.SendTimes++; @@ -141,6 +152,7 @@ namespace WCS.BLL await Task.Delay(10); } } + } } catch @@ -170,6 +182,7 @@ namespace WCS.BLL lock (sendLockObject) { tcpClient.Send(message); + //TODO MessageList.AddOrUpdate(new Mes) //发送自带10ms间隔 Thread.Sleep(10); } @@ -225,6 +238,7 @@ namespace WCS.BLL /// public byte[] Message { get; set; } + public bool IsWating { get; set; } /// /// 发送次数 /// diff --git a/WCS.DAL/Db/AuthEnum/AuthDbHelp.cs b/WCS.DAL/Db/AuthDb/AuthDbHelp.cs similarity index 96% rename from WCS.DAL/Db/AuthEnum/AuthDbHelp.cs rename to WCS.DAL/Db/AuthDb/AuthDbHelp.cs index 1c3ed7c..bacaadb 100644 --- a/WCS.DAL/Db/AuthEnum/AuthDbHelp.cs +++ b/WCS.DAL/Db/AuthDb/AuthDbHelp.cs @@ -5,7 +5,7 @@ using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; -using WCS.DAL.AuthDbModel; +using WCS.DAL.Db.AuthDb; namespace WCS.DAL { @@ -14,9 +14,11 @@ namespace WCS.DAL /// public static class AuthDbHelp { + + public static SqlSugarScope db = new SqlSugarScope(new ConnectionConfig() { - ConnectionString = $"Data Source={LocalFile.AuthDbPath};", + ConnectionString = $"Data Source={DbPath.AuthDbPath};", DbType = DbType.Sqlite,//[Sqlite]安装[System.Data.SQLite.Core]; IsAutoCloseConnection = true }, db => diff --git a/WCS.DAL/Db/AuthEnum/AuthEnum.cs b/WCS.DAL/Db/AuthDb/AuthEnum.cs similarity index 100% rename from WCS.DAL/Db/AuthEnum/AuthEnum.cs rename to WCS.DAL/Db/AuthDb/AuthEnum.cs diff --git a/WCS.DAL/AuthDbModel/AuthModels.cs b/WCS.DAL/Db/AuthDb/AuthModels.cs similarity index 82% rename from WCS.DAL/AuthDbModel/AuthModels.cs rename to WCS.DAL/Db/AuthDb/AuthModels.cs index 6bab81f..813a026 100644 --- a/WCS.DAL/AuthDbModel/AuthModels.cs +++ b/WCS.DAL/Db/AuthDb/AuthModels.cs @@ -5,7 +5,7 @@ using System.Text; using WCS.DAL.Db; using WCS.Model; -namespace WCS.DAL.AuthDbModel +namespace WCS.DAL.Db.AuthDb { /// /// 用户 @@ -32,7 +32,7 @@ namespace WCS.DAL.AuthDbModel /// 角色名称 /// [SugarColumn(IsIgnore = true)] - public List RoleNames { get => (RoleIds == null || !RoleIds.Any()) ? new List() : AuthDbHelp.db.Queryable().Where(o => RoleIds.Contains(o.Id)).Select(o => o.Name).ToList(); } + public List RoleNames { get => RoleIds == null || !RoleIds.Any() ? new List() : AuthDbHelp.db.Queryable().Where(o => RoleIds.Contains(o.Id)).Select(o => o.Name).ToList(); } /// /// 是否最大权限 /// @@ -70,7 +70,7 @@ namespace WCS.DAL.AuthDbModel /// 认证模块名称 /// [SugarColumn(IsIgnore = true)] - public List AuthNames { get => (Auths == null || !Auths.Any()) ? new List() : EnumHelps.GetEnumDescriptionList(typeof(AuthEnum), true).Where(o => Auths.Contains(o.Item1)).Select(o => o.Item3).ToList(); } + public List AuthNames { get => Auths == null || !Auths.Any() ? new List() : EnumHelps.GetEnumDescriptionList(typeof(AuthEnum), true).Where(o => Auths.Contains(o.Item1)).Select(o => o.Item3).ToList(); } /// /// 是否最大权限 /// diff --git a/WCS.DAL/Db/AuthEnum/EnumHelps.cs b/WCS.DAL/Db/AuthDb/EnumHelps.cs similarity index 100% rename from WCS.DAL/Db/AuthEnum/EnumHelps.cs rename to WCS.DAL/Db/AuthDb/EnumHelps.cs diff --git a/WCS.DAL/Db/DbHelp.cs b/WCS.DAL/Db/DbHelp.cs index d47ba96..d8a842f 100644 --- a/WCS.DAL/Db/DbHelp.cs +++ b/WCS.DAL/Db/DbHelp.cs @@ -14,7 +14,7 @@ namespace WCS.DAL.Db /// public static SqlSugarScope db = new SqlSugarScope(new ConnectionConfig() { - ConnectionString = $"Data Source={LocalFile.DataDbPath};", + ConnectionString = $"Data Source={DbPath.DataDbPath};", DbType = DbType.Sqlite,//[Sqlite]安装[System.Data.SQLite]; IsAutoCloseConnection = true }, db => @@ -31,7 +31,7 @@ namespace WCS.DAL.Db /// public static SqlSugarScope dbLog = new SqlSugarScope(new ConnectionConfig() { - ConnectionString = $"Data Source={LocalFile.LogDbPath};", + ConnectionString = $"Data Source={DbPath.LogDbPath};", DbType = DbType.Sqlite,//[Sqlite]安装[System.Data.SQLite]; IsAutoCloseConnection = true }, db => diff --git a/WCS.DAL/LocalFile.cs b/WCS.DAL/DbPath.cs similarity index 93% rename from WCS.DAL/LocalFile.cs rename to WCS.DAL/DbPath.cs index 448c96d..d699ef6 100644 --- a/WCS.DAL/LocalFile.cs +++ b/WCS.DAL/DbPath.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace WCS.DAL { - public static class LocalFile + public static class DbPath { public static readonly string AppDir = AppDomain.CurrentDomain.BaseDirectory; diff --git a/WCS.Model/ApiModel/MatInventoryDetail/MatInventoryDetailModel.cs b/WCS.Model/ApiModel/MatInventoryDetail/MatInventoryDetailModel.cs index 8c8c4e7..293f55d 100644 --- a/WCS.Model/ApiModel/MatInventoryDetail/MatInventoryDetailModel.cs +++ b/WCS.Model/ApiModel/MatInventoryDetail/MatInventoryDetailModel.cs @@ -27,7 +27,15 @@ namespace WCS.Model.ApiModel.MatInventoryDetail public DateTime InstoreTime { get; set; } = DateTime.Now; public string InstoreUser { get; set; } - public bool IsLocked { get; set; } = false; + public bool IsLocked { get; set; } + + public string IsLockedStr + { + get + { + return IsLocked ? "是" : "否"; + } + } public int RowNumber { get; set; } public bool IsSelected { get; set; } } diff --git a/WCS.Model/ApiModel/OutStore/GetOutOrderListByStatusRequest.cs b/WCS.Model/ApiModel/OutStore/GetOutOrderListByStatusRequest.cs new file mode 100644 index 0000000..bfedf5d --- /dev/null +++ b/WCS.Model/ApiModel/OutStore/GetOutOrderListByStatusRequest.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using WCS.Model.ApiModel.OutStore; + +namespace WCS.Model +{ + public class GetOutOrderListByStatusRequest : PageQueryRequestBase + { + public List OrderExeStatus { get; set; } + } +} diff --git a/WCS.Model/ApiModel/OutStore/OutOrderMatDetailModel.cs b/WCS.Model/ApiModel/OutStore/OutOrderMatDetailModel.cs index 0d2ab85..d1ef1dc 100644 --- a/WCS.Model/ApiModel/OutStore/OutOrderMatDetailModel.cs +++ b/WCS.Model/ApiModel/OutStore/OutOrderMatDetailModel.cs @@ -40,9 +40,17 @@ namespace WCS.Model.ApiModel.OutStore public string? MatCustomer { get; set; } #endregion - public bool IsSended { get; set; } = false; + public bool IsSended { get; set; } - public DateTime CreateTime { get; set; } + public string IsSendedStr + { + get + { + return IsSended ? "是" : "否"; + } + } + + public DateTime CreateTime { get; set; } public string CreateUser { get; set; } diff --git a/WCS.Model/ApiModel/Stocktaking/ComfirmStocktakingOrderRequest.cs b/WCS.Model/ApiModel/Stocktaking/ConfirmStocktakingOrderRequest.cs similarity index 86% rename from WCS.Model/ApiModel/Stocktaking/ComfirmStocktakingOrderRequest.cs rename to WCS.Model/ApiModel/Stocktaking/ConfirmStocktakingOrderRequest.cs index 20ce1c9..ebf9055 100644 --- a/WCS.Model/ApiModel/Stocktaking/ComfirmStocktakingOrderRequest.cs +++ b/WCS.Model/ApiModel/Stocktaking/ConfirmStocktakingOrderRequest.cs @@ -4,7 +4,7 @@ using System.Text; namespace WCS.Model.ApiModel.Stocktaking { - public class ComfirmStocktakingOrderRequest + public class ConfirmStocktakingOrderRequest { public int Id { get; set; } public string StocktakingOrderNumber { get; set; } diff --git a/WCS.WebApi/Controllers/OutstoreController.cs b/WCS.WebApi/Controllers/OutstoreController.cs index 3e752a5..d99a880 100644 --- a/WCS.WebApi/Controllers/OutstoreController.cs +++ b/WCS.WebApi/Controllers/OutstoreController.cs @@ -90,6 +90,29 @@ namespace WebApi.Controllers } } + /// + /// ״̬ѯⵥ + /// + /// + /// + [Route("getOutOrderListByStatus")] + [HttpPost(Name = "getOutOrderListByStatus")] + public async Task getOutOrderListByStatus(GetOutOrderListByStatusRequest request) + { + try + { + return await _outstoreService.GetOutOrderListByStatus(request); + } + catch (Exception ex) + { + return new ResponseBase() + { + Code = 300, + Message = "ѯʧܣ" + ex.Message, + }; + } + } + /// /// ȡⵥijϸ /// diff --git a/WCS.WebApi/Controllers/StockTakingController.cs b/WCS.WebApi/Controllers/StockTakingController.cs index 9687d65..7364088 100644 --- a/WCS.WebApi/Controllers/StockTakingController.cs +++ b/WCS.WebApi/Controllers/StockTakingController.cs @@ -71,11 +71,11 @@ namespace WCS.WebApi.Controllers return await _stockTakingService.queryMatInfoInStocktakingOrder(request); } - [Route("comfirmStocktakingOrder")] - [HttpPost(Name = "comfirmStocktakingOrder")] - public async Task comfirmStocktakingOrder(ComfirmStocktakingOrderRequest request) + [Route("confirmStocktakingOrder")] + [HttpPost(Name = "confirmStocktakingOrder")] + public async Task confirmStocktakingOrder(ConfirmStocktakingOrderRequest request) { - return await _stockTakingService.comfirmStocktakingOrder(request); + return await _stockTakingService.confirmStocktakingOrder(request); } [Route("commitStocktakingOrder")] diff --git a/WCS.WebApi/Program.cs b/WCS.WebApi/Program.cs index b387403..d892f1e 100644 --- a/WCS.WebApi/Program.cs +++ b/WCS.WebApi/Program.cs @@ -1,10 +1,12 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Server.Kestrel.Core; +using System.Configuration; using System.Net; using System.Net.Http; using System.Net.Sockets; using System.Text; +using WCS.BLL.Config; using WCS.BLL.Manager; using WCS.BLL.Services.IService; using WCS.BLL.Services.Service; @@ -24,6 +26,8 @@ namespace WebApi DbInit.InitDb(); + LocalFile.SaveConfig(); + ShelfManager.InitShelves(); TCPClientManager.InitTcpClient(); diff --git a/货架标准上位机/Api/ApiHelp.cs b/货架标准上位机/Api/ApiHelp.cs index 625d944..aa9e2d8 100644 --- a/货架标准上位机/Api/ApiHelp.cs +++ b/货架标准上位机/Api/ApiHelp.cs @@ -278,11 +278,11 @@ namespace 货架标准上位机.Api try { if (isSaveLog) - Logs.Write($"【{guid}】开始请求调用接口 url:{url} 请求方式:{httpMethod} 数据:{data}"); + Logs.Write($"【{guid}】开始请求调用接口 url:{url} 请求方式:{httpMethod} 数据:{data}",LogsType.Api); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = httpMethod; request.ContentType = "application/json"; - request.Timeout = 100000; + request.Timeout = 10000; if (!string.IsNullOrEmpty(data)) { @@ -303,7 +303,7 @@ namespace 货架标准上位机.Api StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(encoding)); string retString = reader.ReadToEnd(); if (isSaveLog) - Logs.Write($"【{guid}】请求调用接口结束 返回数据为{retString}"); + Logs.Write($"【{guid}】请求调用接口结束 返回数据为{retString}", LogsType.Api); return JsonConvert.DeserializeObject(retString); } catch (Exception ex) diff --git a/货架标准上位机/ScannerManager.cs b/货架标准上位机/ScannerManager.cs index 37d712e..e1a700f 100644 --- a/货架标准上位机/ScannerManager.cs +++ b/货架标准上位机/ScannerManager.cs @@ -40,10 +40,6 @@ namespace 货架标准上位机 Scanners.Add(Scanner); return EasyTask.CompletedTask; }; - client.Received = async (c, e) => - { - ; - }; client.Setup(new TouchSocket.Core.TouchSocketConfig() .SetSerialPortOption(new SerialPortOption() { diff --git a/货架标准上位机/Tool/Logs.cs b/货架标准上位机/Tool/Logs.cs index d9f23b1..d75bbfb 100644 --- a/货架标准上位机/Tool/Logs.cs +++ b/货架标准上位机/Tool/Logs.cs @@ -35,7 +35,11 @@ namespace 货架标准上位机 /// /// 扫码枪 /// - Scanner + Scanner, + /// + /// Api接口调用 + /// + Api } /// diff --git a/货架标准上位机/ViewModels/InInventoryViewModel.cs b/货架标准上位机/ViewModels/InInventoryViewModel.cs index 30ebb7a..15be6d5 100644 --- a/货架标准上位机/ViewModels/InInventoryViewModel.cs +++ b/货架标准上位机/ViewModels/InInventoryViewModel.cs @@ -90,7 +90,7 @@ namespace 货架标准上位机.ViewModel { ModuleCodeProcess(scanner); } - //TO DO 增加正则表达式进行判断是否扫到的是物料码 + //TODO 增加正则表达式进行判断是否扫到的是物料码 else { MatSnProcess(scanner); @@ -168,6 +168,14 @@ namespace 货架标准上位机.ViewModel scanner.IsInstoreMode = true; scanner.ShelfCode = Result.Data.ShelfCode; scanner.ModulesStr = Result.Data.ModulesStr; + //TODO 清除其他扫码枪的占用 + var sacnners = ScannerManager.Scanners + .Where(t => ShelfCode == Result.Data.ShelfCode) + .ToList(); + foreach (var item in sacnners) + { + item.ShelfCode = string.Empty; + } } else if (Result != null && !string.IsNullOrEmpty(Result.Message)) { diff --git a/货架标准上位机/ViewModels/MatInventoryDetailViewModel.cs b/货架标准上位机/ViewModels/MatInventoryDetailViewModel.cs index ae81bec..b9c6c8a 100644 --- a/货架标准上位机/ViewModels/MatInventoryDetailViewModel.cs +++ b/货架标准上位机/ViewModels/MatInventoryDetailViewModel.cs @@ -24,6 +24,8 @@ using WCS.Model.ApiModel.InterfaceRecord; using HandyControl.Collections; using WCS.Model.ApiModel.MatBaseInfo; using WCS.Model.ApiModel.MatInventoryDetail; +using HandyControl.Tools.Extension; +using WCS.Model.ApiModel.Stocktaking; namespace 货架标准上位机.ViewModel { @@ -39,7 +41,6 @@ namespace 货架标准上位机.ViewModel // }) // .Distinct() // .ToList(); - } public void InitMatCode() @@ -270,6 +271,192 @@ namespace 货架标准上位机.ViewModel Growl.Error("导出失败:" + ex.Message); } } + + public ICommand BtnGenerateOutstoreCommand { get => new DelegateCommand(BtnGenerateOutstore); } + public async void BtnGenerateOutstore() + { + try + { + #region 调用接口获取物料SN + try + { + var body = new GetMatInventoryDetailRequest() + { + MatName = MatName, + MatSN = MatSN, + MatBatch = MatBatch, + MatCode = MatCode, + StoreCode = StoreCode, + + UserName = LocalStatic.CurrentUser, + DeviceType = LocalFile.Config.DeviceType, + PageNumber = CurrentPage, + PageSize = 10000, + }; + 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 (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) + { + Growl.Success(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); + } + } + + 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, + + UserName = LocalStatic.CurrentUser, + DeviceType = LocalFile.Config.DeviceType, + PageNumber = CurrentPage, + PageSize = 10000, + }; + 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 (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) + { + Growl.Success(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 #region PageOperation 分页操作 diff --git a/货架标准上位机/ViewModels/OutInventoryAddDucumentViewModel.cs b/货架标准上位机/ViewModels/OutInventoryAddDucumentViewModel.cs index 47d2ac0..c77150a 100644 --- a/货架标准上位机/ViewModels/OutInventoryAddDucumentViewModel.cs +++ b/货架标准上位机/ViewModels/OutInventoryAddDucumentViewModel.cs @@ -122,28 +122,28 @@ namespace 货架标准上位机.ViewModels }).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(); + }; + var Result = ApiHelp.GetDataFromHttp(LocalFile.Config.ApiIpHost + "outstore/sysOutOrderByMatCode", body, "POST"); + if (Result != null && Result.Code == 200) + { + Growl.Success(Result.Message); + OnRequestClose(); + } + else if (Result != null) + { + Growl.Warning(Result.Message); + } } - else if (Result != null) - { - Growl.Warning(Result.Message); - } - } catch (Exception ex) { - Growl.Error("加载数据失败:" + ex.Message); - } + Growl.Error("加载数据失败:" + ex.Message); + } finally { + } + #endregion } - #endregion } + #endregion } - #endregion -} } diff --git a/货架标准上位机/ViewModels/OutInventoryDocumentViewModel.cs b/货架标准上位机/ViewModels/OutInventoryDocumentViewModel.cs index ba27c69..905694e 100644 --- a/货架标准上位机/ViewModels/OutInventoryDocumentViewModel.cs +++ b/货架标准上位机/ViewModels/OutInventoryDocumentViewModel.cs @@ -123,14 +123,16 @@ namespace 货架标准上位机.ViewModels public ICommand BtnResetCommand { get => new DelegateCommand(BtnReset); } public void BtnReset() { - + OrderNumber = string.Empty; + OrderType = string.Empty; + OrderSource = string.Empty; } - public ICommand BtnDeleteCommand { get => new DelegateCommand(BtnDelete); } - public void BtnDelete() - { + //public ICommand BtnDeleteCommand { get => new DelegateCommand(BtnDelete); } + //public void BtnDelete() + //{ - } + //} public ICommand BtnOrderDetailCommand { get => new DelegateCommand(BtnOrderDetail); } public void BtnOrderDetail() diff --git a/货架标准上位机/ViewModels/OutInventoryViewModel.cs b/货架标准上位机/ViewModels/OutInventoryViewModel.cs index 9122f59..d34d490 100644 --- a/货架标准上位机/ViewModels/OutInventoryViewModel.cs +++ b/货架标准上位机/ViewModels/OutInventoryViewModel.cs @@ -4,18 +4,25 @@ using MiniExcelLibs; using Ping9719.WpfEx.Mvvm; using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Data.SqlClient; using System.IO; using System.Linq; using System.Net; +using System.Security.Cryptography.X509Certificates; using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; +using System.Web.UI.WebControls; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using TouchSocket.Core; +using WCS.Model; +using WCS.Model.ApiModel.OutStore; +using WCS.Model.ApiModel.Stocktaking; +using 货架标准上位机.Api; using 货架标准上位机.ViewModel; namespace 货架标准上位机.ViewModel @@ -44,169 +51,78 @@ namespace 货架标准上位机.ViewModel // } // } //}); - } - public System.Windows.Controls.TextBox textBox { get; set; } + RefreshOutOrderList(); + } #region Property - private string number; - public string Number + private OutOrderModel selectedOutOrder; + public OutOrderModel SelectedOutOrder { - get { return number; } + get { return selectedOutOrder; } set { - SetProperty(ref number, value); + SetProperty(ref selectedOutOrder, value); + if (selectedOutOrder != null) + { + SelectedOutOrderNumber = selectedOutOrder.OrderNumber; + RefreshDataGridItemSource(); + } + else + { + DataGridItemSource?.Clear(); + } } } - private bool isOrderOut; - public bool IsOrderOut + private string selectedOutOrderNumber; + public string SelectedOutOrderNumber { - get { return isOrderOut; } + get => selectedOutOrderNumber; set { - SetProperty(ref isOrderOut, value); - //LocalStatic.IsOrderOut = value; + SetProperty(ref selectedOutOrderNumber, value); } } - private string matCode1; - public string MatCode1 + + private ObservableCollection outOrderList; + public ObservableCollection OutOrderList { - get { return matCode1; } + get => outOrderList; set { - SetProperty(ref matCode1, value); + SetProperty(ref outOrderList, value); } } - private int matQty1; - public int MatQty1 + private ObservableCollection dataGridItemSource; + public ObservableCollection DataGridItemSource { - get { return matQty1; } + get { return dataGridItemSource; } set { - SetProperty(ref matQty1, value); + SetProperty(ref dataGridItemSource, value); + RefreshCount(); } } - private string order_prod_number; - public string Order_prod_number + //单据总盘数 + private int totalPan; + public int TotalPan { - get { return order_prod_number; } - set + get => totalPan; set { - SetProperty(ref order_prod_number, value); + SetProperty(ref totalPan, value); } } - private string material_code; - public string Material_code + private int sendedPan; + public int SendedPan { - get { return material_code; } - set + get => sendedPan; set { - SetProperty(ref material_code, value); - } - } - - private string material_name; - public string Material_name - { - get { return material_name; } - set - { - SetProperty(ref material_name, value); - } - } - - private string material_spec; - public string Material_spec - { - get { return material_spec; } - set - { - SetProperty(ref material_spec, value); - } - } - - private string matCode; - public string MatCode - { - get { return matCode; } - set - { - SetProperty(ref matCode, value); - } - } - - private string matName; - public string MatName - { - get { return matName; } - set - { - SetProperty(ref matName, value); - } - } - - private string matCode3; - public string MatCode3 - { - get { return matCode3; } - set - { - SetProperty(ref matCode3, value); - } - } - - private string matName3; - public string MatName3 - { - get { return matName3; } - set - { - SetProperty(ref matName3, value); - } - } - - private string matSpec3; - public string MatSpec3 - { - get { return matSpec3; } - set - { - SetProperty(ref matSpec3, value); - } - } - - private string matBatch3; - public string MatBatch3 - { - get { return matBatch3; } - set - { - SetProperty(ref matBatch3, value); - } - } - - private string selectedPickBillNumber; - public string SelectedPickBillNumber - { - get { return selectedPickBillNumber; } - set - { - SetProperty(ref selectedPickBillNumber, value); - } - } - - private string orderProdNumber; - public string OrderProdNumber - { - get { return orderProdNumber; } - set - { - SetProperty(ref orderProdNumber, value); + SetProperty(ref sendedPan, value); } } @@ -220,88 +136,17 @@ namespace 货架标准上位机.ViewModel } } - private List dataGridItemSource; - public List DataGridItemSource - { - get { return dataGridItemSource; } - set - { - SetProperty(ref dataGridItemSource, value); - RefreshCount(); - } - } - - //领料单号列表 - private List pickBillNumberList; - public List PickBillNumberList - { - get { return pickBillNumberList; } - set - { - SetProperty(ref pickBillNumberList, value); - } - } - - - public void RefreshCount() { Task.Run(() => { + SendedPan = dataGridItemSource.Where(t => t.IsSended).Count(); TotalPan = dataGridItemSource.Count(); - //SendedPan = dataGridItemSource.Where(t => t.IsSend == true).Count(); - //UnSendedPan = dataGridItemSource.Where(t => t.IsSend == false).Count(); }); } #endregion #region Command - //public ICommand BtnSearchCommand { get => new DelegateCommand(BtnSearch); } - //public void BtnSearch() - //{ - // if (string.IsNullOrEmpty(MatCode1)) - // { - // Growl.Warning("请输入料号进行筛选!"); - // return; - // } - // else if (MatQty1 == 0) - // { - // Growl.Warning("请输入需要的数量!"); - // return; - // } - - - // var inventoryDetails = DbHelp.db.Queryable(); - // if (!string.IsNullOrEmpty(MatCode1)) - // { - // inventoryDetails = inventoryDetails - // .Where(t => t.MatCode.Contains(MatCode1)) - // .Includes(t => t.StoreInfo) - // .OrderBy(t => t.MatQty); - // } - // else - // { - - // } - - // var inventorys = inventoryDetails.ToList(); - // int totalMatQty = 0; - // //List dataSourceTemp = new List(); - // foreach (var item in inventorys) - // { - // if (totalMatQty < MatQty1) - // { - // totalMatQty += item.MatQty; - // item.IsSelected = true; - // } - // else - // { - // break; - // } - // } - // DataGridItemSource = inventorys; - //} - public ICommand BtnOutOrderCommand { get => new DelegateCommand(BtnOutOrder); } public void BtnOutOrder() { @@ -310,69 +155,164 @@ namespace 货架标准上位机.ViewModel window.ShowDialog(); } - //public ICommand BtnTempOutCommand { get => new DelegateCommand(BtnTempOut); } - //public void BtnTempOut() - //{ - // var window = new OutInventoryDocumentDetailView(); - // window.ShowDialog(); - // if (window.DialogResult == true) - // { - // DataGridItemSource = window.DataGridItemSource; - - // } - //} - - public ICommand BtnReset3Command { get => new DelegateCommand(BtnReset3); } - public void BtnReset3() - { - MatCode3 = string.Empty; - MatName3 = string.Empty; - MatSpec3 = string.Empty; - MatBatch3 = string.Empty; - } - public ICommand BtnStartCommand { get => new DelegateCommand(BtnStart); } public void BtnStart() { - return; + try + { + //判断是否选择单据 + if (SelectedOutOrder == null) + { + Growl.Warning("未选择单据!"); + } + + #region 调用接口开始出库 + var body = new GetOutOrderDetailRequest() + { + OrderId = selectedOutOrder.Id, + OrderNumber = selectedOutOrder.OrderNumber, + UserName = LocalStatic.CurrentUser, + DeviceType = LocalFile.Config.DeviceType, + }; + var Result = ApiHelp.GetDataFromHttp(LocalFile.Config.ApiIpHost + "outStore/goInOutstore", body, "POST"); + if (Result != null && Result.Code == 200) + { + Growl.Warning("已成功开始入库!"); + } + else if (Result != null) + { + Growl.Warning(Result.Message); + } + else + { + Growl.Warning("调用接口失败!"); + } + #endregion + } + catch (Exception ex) + { + Growl.Error("出现异常:" + ex.Message); + } + finally + { + } } public ICommand BtnPauseCommand { get => new DelegateCommand(BtnPause); } public void BtnPause() { + try + { + //判断是否选择单据 + if (SelectedOutOrder == null) + { + Growl.Warning("未选择单据!"); + } - } - #endregion - - - #region PageOperation - private int totalPan; - public int TotalPan - { - get { return totalPan; } - set { SetProperty(ref totalPan, value); } + #region 调用接口结束出库 + var body = new GetOutOrderDetailRequest() + { + OrderId = selectedOutOrder.Id, + OrderNumber = selectedOutOrder.OrderNumber, + UserName = LocalStatic.CurrentUser, + DeviceType = LocalFile.Config.DeviceType, + }; + var Result = ApiHelp.GetDataFromHttp(LocalFile.Config.ApiIpHost + "outStore/goOutOutstore", body, "POST"); + if (Result != null && Result.Code == 200) + { + Growl.Warning("已成功结束入库!"); + } + else if (Result != null) + { + Growl.Warning(Result.Message); + } + else + { + Growl.Warning("调用接口失败!"); + } + #endregion + } + catch (Exception ex) + { + Growl.Error("出现异常:" + ex.Message); + } + finally + { + } } - private int sendedPan; - public int SendedPan + public void RefreshOutOrderList() { - get { return sendedPan; } - set { SetProperty(ref sendedPan, value); } + #region 调用接口获取发料单 + try + { + var body = new GetOutOrderListByStatusRequest() + { + OrderExeStatus = new List() { OutOrderExeStatus.开始发料, OutOrderExeStatus.发料完成 } + }; + var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "outstore/getOutOrderListByStatus", body, "POST"); + if (Result != null && Result.Code == 200) + { + OutOrderList = new ObservableCollection(Result.Data.Lists); + } + else if (Result != null && !string.IsNullOrEmpty(Result.Message)) + { + Growl.Warning(Result.Message); + } + } + catch (Exception ex) + { + Growl.Warning(ex.Message); + } + #endregion } - private int unSendedPan; - public int UnSendedPan + public void RefreshDataGridItemSource() { - get { return unSendedPan; } - set { SetProperty(ref unSendedPan, value); } - } - #endregion + if (SelectedOutOrder == null) + { + //选择的单据为空无法进行查询 + return; + } + #region 调用接口获取出库单物料明细 + Task.Run(() => + { + var body = new GetOutOrderDetailRequest() + { + OrderId = selectedOutOrder.Id, + OrderNumber = selectedOutOrder.OrderNumber, + UserName = LocalStatic.CurrentUser, + DeviceType = LocalFile.Config.DeviceType, - #region private method - public bool GrowlCallBack(bool aaa) - { - return true; + }; + var Result = ApiHelp.GetDataFromHttp>>(LocalFile.Config.ApiIpHost + "outStore/getOutOrderMatDetail", body, "POST"); + if (Result != null && Result.Code == 200) + { + if (Result.Data.Count > 0) + { + DataGridItemSource = new ObservableCollection(Result.Data); + } + else + { + App.Current.Dispatcher.Invoke(() => + { + DataGridItemSource?.Clear(); + }); + + Growl.Warning("该单据未查询到发料明细!"); + } + } + else if (Result != null) + { + Growl.Warning(Result.Message); + } + else + { + Growl.Warning("调用接口失败!"); + } + }); + #endregion } #endregion } diff --git a/货架标准上位机/Views/MatInventoryDetailView.xaml b/货架标准上位机/Views/MatInventoryDetailView.xaml index b8650be..db90403 100644 --- a/货架标准上位机/Views/MatInventoryDetailView.xaml +++ b/货架标准上位机/Views/MatInventoryDetailView.xaml @@ -108,8 +108,21 @@ Content=" 导 出" FontFamily="{StaticResource IconFont}" Style="{StaticResource ButtonWarning}" Background="DarkOrange"> + + + + + + + - + diff --git a/货架标准上位机/Views/OutInventoryView.xaml b/货架标准上位机/Views/OutInventoryView.xaml index 24935e4..44a8ea6 100644 --- a/货架标准上位机/Views/OutInventoryView.xaml +++ b/货架标准上位机/Views/OutInventoryView.xaml @@ -31,12 +31,12 @@ @@ -64,7 +64,7 @@ - + @@ -88,12 +88,21 @@ - - - + + + + + + + + + + @@ -102,18 +111,18 @@ - + - - + - <货架标准上位机:WorkItemBackgroundConverter x:Key="converter"/> - - - + - - - + + diff --git a/货架标准上位机/Views/OutInventoryView.xaml.cs b/货架标准上位机/Views/OutInventoryView.xaml.cs index c27c703..14c57c3 100644 --- a/货架标准上位机/Views/OutInventoryView.xaml.cs +++ b/货架标准上位机/Views/OutInventoryView.xaml.cs @@ -19,10 +19,11 @@ namespace 货架标准上位机 { public partial class OutVentoryView : UserControlBase { + public static OutInventoryViewModel viewModel = new OutInventoryViewModel(); public OutVentoryView() { InitializeComponent(); - this.DataContext = new OutInventoryViewModel(); + this.DataContext = viewModel; } private void DataGrid_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e) @@ -34,12 +35,7 @@ namespace 货架标准上位机 var index = datagrid.SelectedIndex; if (index >= 0) { - //if (viewModel.DataGridItemSource != null && viewModel.DataGridItemSource.Count() > index) - //{ - // var data = viewModel.DataGridItemSource.ElementAt(index); - // //data.IsSelected = !data.IsSelected; - // viewModel.DataGridItemSource = viewModel.DataGridItemSource.ToList(); - //} + } datagrid.UnselectAllCells(); } @@ -49,46 +45,6 @@ namespace 货架标准上位机 } } - private void allChecked_Checked(object sender, RoutedEventArgs e) - { - //var viewMode = this.DataContext as OutInventoryViewModel; - //if (viewMode != null && viewMode.DataGridItemSource != null && viewMode.DataGridItemSource.Count() > 0) - //{ - // foreach (var item in viewMode.DataGridItemSource) - // { - // //item.IsSelected = true; - // } - // viewMode.DataGridItemSource = viewMode.DataGridItemSource.ToList(); - //} - } - - private void allChecked_Unchecked(object sender, RoutedEventArgs e) - { - //var viewMode = this.DataContext as OutInventoryViewModel; - //if (viewMode != null && viewMode.DataGridItemSource != null && viewMode.DataGridItemSource.Count() > 0) - //{ - // foreach (var item in viewMode.DataGridItemSource) - // { - // //item.IsSelected = false; - // } - // viewMode.DataGridItemSource = viewMode.DataGridItemSource.ToList(); - //} - } - - private void CheckBox_Checked(object sender, RoutedEventArgs e) - { - //var viewMode = this.DataContext as OutInventoryViewModel; - //viewMode.RefreshCount(); - } - - private void txtMatQty1_PreviewTextInput(object sender, TextCompositionEventArgs e) - { - if (!Regex.IsMatch(e.Text, "^[0-9]")) - { - e.Handled = true; - } - } - private void ListView_PreviewMouseWheel(object sender, MouseWheelEventArgs e) { if (!e.Handled) diff --git a/货架标准上位机/Views/Windows/UserLoginView.xaml.cs b/货架标准上位机/Views/Windows/UserLoginView.xaml.cs index 8bdcade..f8c5671 100644 --- a/货架标准上位机/Views/Windows/UserLoginView.xaml.cs +++ b/货架标准上位机/Views/Windows/UserLoginView.xaml.cs @@ -74,14 +74,14 @@ namespace 货架标准上位机 }; var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "user/userLogin", body, "POST"); - if (Result.Code != 200 || Result.Data == null) + if (Result!= null && Result.Code != 200) { HandyControl.Controls.MessageBox.Warning(Result.Message, "提示"); return; } else { - viewModel.User = Result.Data; + viewModel.User = Result?.Data; } } catch (Exception ex) diff --git a/货架标准上位机/WebSocket.cs b/货架标准上位机/WebSocket.cs index cb5bc79..53e105d 100644 --- a/货架标准上位机/WebSocket.cs +++ b/货架标准上位机/WebSocket.cs @@ -56,13 +56,12 @@ namespace 货架标准上位机 m_logger.Info(e.DataFrame.ToText()); if (!client.Client.IsClient) { - client.Send("我已收到"); + client.Send("已收到"); } //返回的报警信息 出入库盘点等日志信息 else { - TextBoxLog.AddLog(e.DataFrame.ToText(), "123", DateTime.Now); - //Growl.Error(e.DataFrame.ToText()); + TextBoxLog.AddLog(e.DataFrame.ToText(), "InstoreLog", DateTime.Now); } return;