diff --git a/WCS.BLL/Manager/TCPClientManager.cs b/WCS.BLL/Manager/TCPClientManager.cs index 29040e8..955ca1a 100644 --- a/WCS.BLL/Manager/TCPClientManager.cs +++ b/WCS.BLL/Manager/TCPClientManager.cs @@ -22,6 +22,7 @@ namespace WCS.BLL.Manager /// 货架类型的TCP连接管理 /// public static List TCPClients = new List(); + public static void InitTcpClient() { Logs.Write("【InitTcpClient】开始", LogsType.StartBoot); @@ -114,21 +115,26 @@ namespace WCS.BLL.Manager if (TcpCleint.IsFirstConnected == false) { Logs.Write($"【InitTcpClient】{clientIpHost}完成首次连接", LogsType.StartBoot); - //获取剩余未完成连接的tcp - var noFirstConnectedTcps = TCPClientManager.TCPClients.Where(t => t.IsFirstConnected == false) - .Select(t => t.RemoteIPHost) - .ToList(); + - Logs.Write($"【InitTcpClient】剩余未完成连接的TCP为{string.Join(";", noFirstConnectedTcps)}", LogsType.StartBoot); Console.WriteLine($"【InitTcpClient】{clientIpHost}完成首次连接"); InitStatus(TcpCleint); TcpCleint.IsFirstConnected = true; + //获取剩余未完成连接的tcp + var noFirstConnectedTcps = TCPClientManager.TCPClients.Where(t => t.IsFirstConnected == false) + .Select(t => t.RemoteIPHost) + .ToList(); + Logs.Write($"【InitTcpClient】剩余未完成连接的TCP为{string.Join(";", noFirstConnectedTcps)}", LogsType.StartBoot); } return EasyTask.CompletedTask; }; - TCPClients.Add(tcpCleint); + lock(TCPClients)//避免添加失败的情况 + { + TCPClients.Add(tcpCleint); + } + tcpCleint.Connect(); }); } diff --git a/WCS.BLL/Services/Service/InOutRecordService.cs b/WCS.BLL/Services/Service/InOutRecordService.cs index 285660e..016a82b 100644 --- a/WCS.BLL/Services/Service/InOutRecordService.cs +++ b/WCS.BLL/Services/Service/InOutRecordService.cs @@ -35,7 +35,7 @@ namespace WCS.BLL.Services.Service .WhereIF(!string.IsNullOrEmpty(request.MatSupplier), (id, si) => id.MatSpec.Contains(request.MatSupplier)) .WhereIF(!string.IsNullOrEmpty(request.MatCustomer), (id, si) => id.MatSpec.Contains(request.MatCustomer)) .WhereIF(request.Direction != null, (id, si) => id.Direction == request.Direction) - + .WhereIF(request.ShelfTypeId != 0, (id, si) => si.ShelfTypeId == request.ShelfTypeId) .WhereIF(request.StoreId != 0, (id, si) => id.StoreId == request.StoreId) .WhereIF(!string.IsNullOrEmpty(request.StoreCode), (id, si) => id.StoreCode.Contains(request.StoreCode)) @@ -43,6 +43,7 @@ namespace WCS.BLL.Services.Service var totalCount = await recordsQueryable.CountAsync(); var records = await recordsQueryable + .OrderByDescending((id, si) => id.Id) .Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize) .Select() .ToListAsync(); @@ -89,12 +90,11 @@ namespace WCS.BLL.Services.Service .WhereIF(!string.IsNullOrEmpty(request.MatSpec), (id, si) => id.MatSpec.Contains(request.MatSpec)) .WhereIF(!string.IsNullOrEmpty(request.MatSupplier), (id, si) => id.MatSpec.Contains(request.MatSupplier)) .WhereIF(!string.IsNullOrEmpty(request.MatCustomer), (id, si) => id.MatSpec.Contains(request.MatCustomer)) - - .WhereIF(request.StoreId != 0, (id, si) => id.StoreId == request.StoreId) .WhereIF(!string.IsNullOrEmpty(request.StoreCode), (id, si) => id.StoreCode.Contains(request.StoreCode)) ; var records = await recordsQueryable + .OrderByDescending((id, si) => id.Id) .Select() .ToListAsync(); //生成序号 diff --git a/WCS.BLL/Services/Service/InterfaceRecordService.cs b/WCS.BLL/Services/Service/InterfaceRecordService.cs index 34ab7ed..0251674 100644 --- a/WCS.BLL/Services/Service/InterfaceRecordService.cs +++ b/WCS.BLL/Services/Service/InterfaceRecordService.cs @@ -40,6 +40,7 @@ namespace WCS.BLL.Services.Service } var totalCount = await recordsQueryable.CountAsync(); var records = await recordsQueryable + .OrderByDescending(t => t.Id) .Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize) .ToListAsync(); //生成序号 @@ -94,7 +95,7 @@ namespace WCS.BLL.Services.Service recordsQueryable = recordsQueryable.WhereIF(request.StartTime != null, t => request.StartTime <= t.ResponseTime); recordsQueryable = recordsQueryable.WhereIF(request.StartTime != null, t => request.EndTime >= t.ResponseTime); } - var records = await recordsQueryable.ToListAsync(); + var records = await recordsQueryable.OrderByDescending(t => t.Id).ToListAsync(); //生成序号 var index = 1; records.ForEach(r => diff --git a/WCS.BLL/Services/Service/MatBaseInfoService.cs b/WCS.BLL/Services/Service/MatBaseInfoService.cs index c61ce62..56ff8bb 100644 --- a/WCS.BLL/Services/Service/MatBaseInfoService.cs +++ b/WCS.BLL/Services/Service/MatBaseInfoService.cs @@ -40,6 +40,7 @@ namespace WCS.BLL.Services.Service var totalCount = await recordsQueryable.CountAsync(); var records = await recordsQueryable + .OrderByDescending(t => t.Id) .Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize) .ToListAsync(); //生成序号 @@ -81,7 +82,7 @@ namespace WCS.BLL.Services.Service .WhereIF(!string.IsNullOrEmpty(request.MatName), t => t.MatName.Contains(request.MatName)) .WhereIF(!string.IsNullOrEmpty(request.MatSpec), t => t.MatSpec.Contains(request.MatSpec)) .WhereIF(request.IsEnable != null, t => t.IsEnable == request.IsEnable.GetValueOrDefault()); - var records = await recordsQueryable.ToListAsync(); + var records = await recordsQueryable.OrderByDescending(t => t.Id).ToListAsync(); //生成序号 var index = 1; records.ForEach(r => @@ -387,6 +388,7 @@ namespace WCS.BLL.Services.Service matCodeList = await DbHelp.db.Queryable() .Select(t => t.MatCode) .Distinct() + .OrderBy(t => t) .ToListAsync(); } else @@ -394,6 +396,7 @@ namespace WCS.BLL.Services.Service matCodeList = await DbHelp.db.Queryable() .Select(t => t.MatCode) .Distinct() + .OrderBy(t => t) .ToListAsync(); } return new ResponseCommon>() @@ -426,7 +429,7 @@ namespace WCS.BLL.Services.Service .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 + var records = await recordsQueryable.OrderByDescending(t => t.Id) .Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize) .ToListAsync(); //生成序号 diff --git a/WCS.BLL/Services/Service/MatInventoryDetailService.cs b/WCS.BLL/Services/Service/MatInventoryDetailService.cs index 5896341..31c0c4c 100644 --- a/WCS.BLL/Services/Service/MatInventoryDetailService.cs +++ b/WCS.BLL/Services/Service/MatInventoryDetailService.cs @@ -33,7 +33,7 @@ namespace WCS.BLL.Services.Service .WhereIF(!string.IsNullOrEmpty(request.MatSpec), (id, si) => id.MatSpec.Contains(request.MatSpec)) .WhereIF(!string.IsNullOrEmpty(request.MatSupplier), (id, si) => id.MatSpec.Contains(request.MatSupplier)) .WhereIF(!string.IsNullOrEmpty(request.MatCustomer), (id, si) => id.MatSpec.Contains(request.MatCustomer)) - + .WhereIF(request.ShelfTypeId != 0, (id, si) => si.ShelfTypeId == request.ShelfTypeId) .WhereIF(request.StoreId != 0, (id, si) => id.StoreId == request.StoreId) .WhereIF(!string.IsNullOrEmpty(request.StoreCode), (id, si) => id.StoreCode.Contains(request.StoreCode)) @@ -42,6 +42,7 @@ namespace WCS.BLL.Services.Service var totalCount = await recordsQueryable.CountAsync(); var records = await recordsQueryable + .OrderByDescending((id, si) => id.Id) .Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize) .Select() .ToListAsync(); @@ -84,17 +85,18 @@ namespace WCS.BLL.Services.Service .WhereIF(!string.IsNullOrEmpty(request.MatSN), (id, si) => id.MatSN.Contains(request.MatSN)) .WhereIF(!string.IsNullOrEmpty(request.MatCode), (id, si) => id.MatCode.Contains(request.MatCode)) .WhereIF(!string.IsNullOrEmpty(request.MatName), (id, si) => id.MatName.Contains(request.MatName)) - .WhereIF(!string.IsNullOrEmpty(request.MatBatch), (id, si) => id.MatBatch.Contains(request.MatBatch)) + .WhereIF(!string.IsNullOrEmpty(request.MatBatch), (id, si) => id.MatBatch.Contains(request.MatBatch)) .WhereIF(!string.IsNullOrEmpty(request.MatSpec), (id, si) => id.MatSpec.Contains(request.MatSpec)) .WhereIF(!string.IsNullOrEmpty(request.MatSupplier), (id, si) => id.MatSpec.Contains(request.MatSupplier)) .WhereIF(!string.IsNullOrEmpty(request.MatCustomer), (id, si) => id.MatSpec.Contains(request.MatCustomer)) - + .WhereIF(request.ShelfTypeId != 0, (id, si) => si.ShelfTypeId == request.ShelfTypeId) .WhereIF(request.StoreId != 0, (id, si) => id.StoreId == request.StoreId) .WhereIF(!string.IsNullOrEmpty(request.StoreCode), (id, si) => id.StoreCode.Contains(request.StoreCode)) .WhereIF(!string.IsNullOrEmpty(request.ShelfCode), (id, si) => si.ShelfCode.Contains(request.ShelfCode)) ; var records = await recordsQueryable + .OrderByDescending((id, si) => id.Id) .Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize) .Select() .ToListAsync(); diff --git a/WCS.BLL/Services/Service/SelfCheckService.cs b/WCS.BLL/Services/Service/SelfCheckService.cs index 8088fe1..01b476d 100644 --- a/WCS.BLL/Services/Service/SelfCheckService.cs +++ b/WCS.BLL/Services/Service/SelfCheckService.cs @@ -88,6 +88,8 @@ namespace WCS.BLL.Services.Service shelf.ShelfCheck(); + //Thread.Sleep(8); + Task.Run(() => { var warningModel = new WebSocketMessageModel() @@ -100,11 +102,11 @@ namespace WCS.BLL.Services.Service ShelfCode = shelf.ShelfCode, ShelfId = shelf.ShelfId, ClientIp = shelf.WebSocketIpAddress, - WarningMessage = $"货架【{shelf.ShelfCode}】已完成自检" + WarningMessage = $"货架【{shelf.ShelfCode}】自检命令发送完毕" }; WarningManager.SendWarning(warningModel); }); - Thread.Sleep(10); + Thread.Sleep(8); } }); } diff --git a/WCS.BLL/Services/Service/StockTakingService.cs b/WCS.BLL/Services/Service/StockTakingService.cs index b9821db..74e71a9 100644 --- a/WCS.BLL/Services/Service/StockTakingService.cs +++ b/WCS.BLL/Services/Service/StockTakingService.cs @@ -339,6 +339,7 @@ namespace WCS.BLL.Services.Service var totalCount = await recordsQueryable.CountAsync(); var records = await recordsQueryable + .OrderByDescending(t => t.Id) .Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize) .Select() .ToListAsync(); diff --git a/WCS.BLL/Tool/Helper.cs.orig b/WCS.BLL/Tool/Helper.cs.orig new file mode 100644 index 0000000..0e36724 --- /dev/null +++ b/WCS.BLL/Tool/Helper.cs.orig @@ -0,0 +1,409 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading.Tasks; + +namespace WCS.BLL.Tool +{ + public class Helper + { + private static byte[] auchCRCHi = {0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, + 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, + 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, + 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, + 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, + 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, + 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, + 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, + 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, + 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, + 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, + 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, + 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, + 0x40}; + private static byte[] auchCRCLo = {0x00, 0xC0, 0xC1, 0x01, 0xC3, 0x03, 0x02, 0xC2, 0xC6, 0x06, 0x07, 0xC7, 0x05, 0xC5, 0xC4, + 0x04, 0xCC, 0x0C, 0x0D, 0xCD, 0x0F, 0xCF, 0xCE, 0x0E, 0x0A, 0xCA, 0xCB, 0x0B, 0xC9, 0x09, + 0x08, 0xC8, 0xD8, 0x18, 0x19, 0xD9, 0x1B, 0xDB, 0xDA, 0x1A, 0x1E, 0xDE, 0xDF, 0x1F, 0xDD, + 0x1D, 0x1C, 0xDC, 0x14, 0xD4, 0xD5, 0x15, 0xD7, 0x17, 0x16, 0xD6, 0xD2, 0x12, 0x13, 0xD3, + 0x11, 0xD1, 0xD0, 0x10, 0xF0, 0x30, 0x31, 0xF1, 0x33, 0xF3, 0xF2, 0x32, 0x36, 0xF6, 0xF7, + 0x37, 0xF5, 0x35, 0x34, 0xF4, 0x3C, 0xFC, 0xFD, 0x3D, 0xFF, 0x3F, 0x3E, 0xFE, 0xFA, 0x3A, + 0x3B, 0xFB, 0x39, 0xF9, 0xF8, 0x38, 0x28, 0xE8, 0xE9, 0x29, 0xEB, 0x2B, 0x2A, 0xEA, 0xEE, + 0x2E, 0x2F, 0xEF, 0x2D, 0xED, 0xEC, 0x2C, 0xE4, 0x24, 0x25, 0xE5, 0x27, 0xE7, 0xE6, 0x26, + 0x22, 0xE2, 0xE3, 0x23, 0xE1, 0x21, 0x20, 0xE0, 0xA0, 0x60, 0x61, 0xA1, 0x63, 0xA3, 0xA2, + 0x62, 0x66, 0xA6, 0xA7, 0x67, 0xA5, 0x65, 0x64, 0xA4, 0x6C, 0xAC, 0xAD, 0x6D, 0xAF, 0x6F, + 0x6E, 0xAE, 0xAA, 0x6A, 0x6B, 0xAB, 0x69, 0xA9, 0xA8, 0x68, 0x78, 0xB8, 0xB9, 0x79, 0xBB, + 0x7B, 0x7A, 0xBA, 0xBE, 0x7E, 0x7F, 0xBF, 0x7D, 0xBD, 0xBC, 0x7C, 0xB4, 0x74, 0x75, 0xB5, + 0x77, 0xB7, 0xB6, 0x76, 0x72, 0xB2, 0xB3, 0x73, 0xB1, 0x71, 0x70, 0xB0, 0x50, 0x90, 0x91, + 0x51, 0x93, 0x53, 0x52, 0x92, 0x96, 0x56, 0x57, 0x97, 0x55, 0x95, 0x94, 0x54, 0x9C, 0x5C, + 0x5D, 0x9D, 0x5F, 0x9F, 0x9E, 0x5E, 0x5A, 0x9A, 0x9B, 0x5B, 0x99, 0x59, 0x58, 0x98, 0x88, + 0x48, 0x49, 0x89, 0x4B, 0x8B, 0x8A, 0x4A, 0x4E, 0x8E, 0x8F, 0x4F, 0x8D, 0x4D, 0x4C, 0x8C, + 0x44, 0x84, 0x85, 0x45, 0x87, 0x47, 0x46, 0x86, 0x82, 0x42, 0x43, 0x83, 0x41, 0x81, 0x80, + 0x40}; + public static byte[] Crc16(byte[] buffer, int DataLen, bool isHiLo = true) + { + byte uchCRCHi = 0xFF; /* CRC 的高字节初始化 */ + byte uchCRCLo = 0xFF; /* CRC 的低字节初始化 */ + byte uIndex = 0; /* CRC 查询表索引 */ + ushort i = 0; /* buffer 数组下标 */ + while (true) /* 完成整个报文缓冲区 */ + { + if (DataLen == 0) + { + break; + } + else + { + DataLen--; + } + uIndex = (byte)(uchCRCLo ^ buffer[i++]); + uchCRCLo = (byte)(uchCRCHi ^ auchCRCHi[uIndex]); + uchCRCHi = auchCRCLo[uIndex]; + } + List data = new List() { }; + foreach (var item in buffer) + { + data.Add(item); + } + if (isHiLo) + { + data.Add(uchCRCHi); + data.Add(uchCRCLo); + } + else + { + data.Add(uchCRCLo); + data.Add(uchCRCHi); + } + return data.ToArray(); + } + + public static byte[] Query() + { + byte[] data2 = new byte[4]; + data2[0] = 0xff; + data2[1] = 0x03; + data2[2] = 0x00; + data2[3] = 0x06; + byte[] senddata2 = Tool.Helper.Crc16(data2, data2.Length, true); + return senddata2; + } + + public static byte[] SetId() + { + byte[] data2 = new byte[6]; + data2[0] = 0xff; + data2[1] = 0x04; + data2[2] = 0x00; + data2[3] = 0x08; + data2[4] = 0x03; + data2[5] = 0x01; + byte[] senddata2 = Tool.Helper.Crc16(data2, data2.Length, true); + return senddata2; + } + + //出库库位灯亮灯 + public static byte[] OutstoreLight(List board_id, string lightcolor, int status) + { + byte color = 0x00; + switch (lightcolor) + { + case "红": + color = 0x01; + break; + case "绿": + color = 0x02; + break; + case "黄": + color = 0x03; + break; + case "蓝": + color = 0x04; + break; + case "紫": + color = 0x05; + break; + case "青": + color = 0x06; + break; + case "白": + color = 0x07; + break; + case "无": + color = 0x00; + break; + } + byte[] data1 = new byte[3 * board_id.Count + 5]; + data1[0] = 0xff; + data1[1] = 0x01; + byte[] length_base = BitConverter.GetBytes(data1.Length + 2); + data1[2] = length_base[1]; + data1[3] = length_base[0]; + data1[4] = (byte)board_id.Count; + for (int i = 0; i < board_id.Count; i++) + { + data1[5 + i * 3] = (byte)board_id[i]; + data1[5 + i * 3 + 1] = (byte)status; + data1[5 + i * 3 + 2] = color; + } + byte[] data = Crc16(data1, data1.Length, true); + return data; + } + + //出库警示灯亮灯 + public static byte[] OutstoreWarnLight(int lightid, string lightcolor, int status, int beestatus) + { + byte color = 0x00; + switch (lightcolor) + { + case "红": + color = 0x01; + break; + case "绿": + color = 0x02; + break; + case "黄": + color = 0x03; + break; + case "蓝": + color = 0x04; + break; + case "紫": + color = 0x05; + break; + case "青": + color = 0x06; + break; + case "白": + color = 0x07; + break; + case "无": + color = 0x00; + break; + } + byte[] data1 = new byte[5 + 3 * 6]; + data1[0] = 0xff; + data1[1] = 0x01; + data1[2] = 0x00; + data1[3] = (byte)(data1.Length + 2); + data1[4] = 0x06; + for (int i = 0; i < 6; i++) + { + data1[5 + i * 3] = (byte)(lightid + i); + data1[6 + i * 3] = (byte)status; + data1[7 + i * 3] = color; + } + + byte[] data2 = Crc16(data1, data1.Length, true); + return data2; + } + + //入库库位灯短亮(绿色) + public static byte[] InstoreLight(int board_id) + { + byte[] data2 = new byte[8]; + data2[0] = 0xff; + data2[1] = 0x01; + data2[2] = 0x00; + data2[3] = 0x0a; + data2[4] = 0x01; + data2[5] = (byte)board_id; + data2[6] = 0x03; + data2[7] = 0x02; + byte[] senddata2 = Tool.Helper.Crc16(data2, data2.Length, true); + return senddata2; + } + + //入库警示灯短亮(绿色),蜂鸣器鸣叫一次 + public static byte[] InstoreWarnLight(int lightid) + { + byte[] data1 = new byte[5 + 3 * 7]; + data1[0] = 0xff; + data1[1] = 0x01; + data1[2] = 0x00; + data1[3] = (byte)(data1.Length + 2); + data1[4] = 0x07; + //7就是带的有蜂鸣器 + for (int i = 0; i < 7; i++) + { + data1[5 + i * 3] = (byte)(lightid + i); + data1[6 + i * 3] = 0x03; + data1[7 + i * 3] = 0x02; + } + + byte[] senddata1 = Tool.Helper.Crc16(data1, data1.Length, true); + return senddata1; + } + + + public static byte[] InstoreLightAndWarnLight(int board_id, int lightid) + { + byte[] data1 = new byte[8 + 3 * 7]; + data1[0] = 0xff; + data1[1] = 0x01; + data1[2] = 0x00; + data1[3] = (byte)(data1.Length + 2); + data1[4] = 0x08; + + //库位灯 + data1[5] = (byte)board_id; + data1[6] = 0x03; + data1[7] = 0x02; + + //7就是带的有蜂鸣器 + for (int i = 0; i < 7; i++) + { + data1[8 + i * 3] = (byte)(lightid + i); + data1[9 + i * 3] = 0x03; + data1[10 + i * 3] = 0x02; + } + + byte[] senddata1 = Tool.Helper.Crc16(data1, data1.Length, true); + return senddata1; + } + + //出库确认 蜂鸣器鸣叫一次 + public static byte[] CommitOutstoreBee(int lightid) + { + byte[] data1 = new byte[5 + 3 * 1]; + data1[0] = 0xff; + data1[1] = 0x01; + data1[2] = 0x00; + data1[3] = (byte)(data1.Length + 2); + data1[4] = 0x01; + + data1[5] = (byte)(lightid + 6); + data1[6] = 0x03; + data1[7] = 0x02; + + byte[] sendData = Tool.Helper.Crc16(data1, data1.Length, true); + return sendData; + } + + + /// + /// 库位灯常亮/关闭 + /// + /// + /// + /// 0X00 关闭 0X01 常亮 0X02 闪烁 0X03 短亮一次 + /// + public static byte[] StoreLightOnOff(int board_id, string lightcolor, int status) + { + byte color = 0x00; + switch (lightcolor) + { + case "红": + color = 0x01; + break; + case "绿": + color = 0x02; + break; + case "黄": + color = 0x03; + break; + case "蓝": + color = 0x04; + break; + case "紫": + color = 0x05; + break; + case "青": + color = 0x06; + break; + case "白": + color = 0x07; + break; + case "无": + color = 0x00; + break; + } + byte[] data1 = new byte[3 + 5]; + data1[0] = 0xff; + data1[1] = 0x01; + byte[] length_base = BitConverter.GetBytes(data1.Length + 2); + data1[2] = length_base[1]; + data1[3] = length_base[0]; + data1[4] = 0x01; + + data1[5] = (byte)board_id; + data1[5 + 1] = (byte)status; + data1[5 + 2] = color; + + byte[] data = Crc16(data1, data1.Length, true); + return data; + } + + /// + /// 返回数据处理 + /// + public static void ReturnDataProcess(TCPClient tcpClient, byte[] returnData) + { + if (returnData[0] == 0xFF && returnData[1] == 0x00 && returnData[3] == 0x08 + && returnData[4] == 0x01 && returnData[5] == 0x06) + { + var sendData = Query(); + tcpClient.Send(sendData); + return; + } + } + +<<<<<<< HEAD +======= + public static byte[] OutstoreWarnLight_1(int lightid, string lightcolor, int status, int beestatus) + { + byte color = 0x00; + switch (lightcolor) + { + case "红": + color = 0x01; + break; + case "绿": + color = 0x02; + break; + case "黄": + color = 0x03; + break; + case "蓝": + color = 0x04; + break; + case "紫": + color = 0x05; + break; + case "青": + color = 0x06; + break; + case "白": + color = 0x07; + break; + case "无": + color = 0x00; + break; + } + byte[] data1 = new byte[5 + 3 * 6]; + data1[0] = 0xff; + data1[1] = 0x01; + data1[2] = 0x00; + data1[3] = (byte)(data1.Length + 2); + data1[4] = 0x06; + for (int i = 0; i < 6; i++) + { + data1[5 + i * 3] = (byte)(lightid + i); + data1[6 + i * 3] = (byte)status; + data1[7 + i * 3] = color; + } + //data1[5 + 3 * 7 - 3] = (byte)(lightid + 6); + //data1[5 + 3 * 7 - 2] =(byte)beestatus; + //data1[5 + 3 * 7 - 1] = 0x00; + byte[] data2 = Crc16(data1, data1.Length, true); + return data2; + } +>>>>>>> origin/master + } +} diff --git a/WCS.BLL/Tool/TCPClient.cs b/WCS.BLL/Tool/TCPClient.cs index 52c5532..697d01f 100644 --- a/WCS.BLL/Tool/TCPClient.cs +++ b/WCS.BLL/Tool/TCPClient.cs @@ -1,4 +1,6 @@ -using System.Collections.Concurrent; +using System; +using System.Collections.Concurrent; +using System.ComponentModel.Design; using System.Text; using TouchSocket.Core; using TouchSocket.Sockets; @@ -54,7 +56,7 @@ namespace WCS.BLL /// 初始化配置连接 /// /// - public TCPClient(string remoteIPHost, string bindIPHost,string shelfTypeName) + public TCPClient(string remoteIPHost, string bindIPHost, string shelfTypeName) { try { @@ -86,34 +88,60 @@ namespace WCS.BLL var data = e.ByteBlock.Buffer.Take((int)e.ByteBlock.Length).ToArray(); Task.Run(() => { - Logs.Write($"【校验发送接收 开始】" + BitConverter.ToString(data), LogsType.InstructionResend); - var len = data.Length; - for (int index = 0; index < data.Length - PreFixLength; index++) + Logs.Write($"【校验发送接收 开始】{ShelfTypeName}" + BitConverter.ToString(data), LogsType.InstructionResend); + if (ShelfTypeName == "信息化货架") { - //协议拆包 通过前缀校验是否为完整数据包 - var prefixInData = data.Skip(index).Take(PreFixLength); - var isEqual = prefixInData.SequenceEqual(Prefix); - if (isEqual) + //协议拆包 + var len = data.Length; + //灯控制统一返回的是 FF-00-00-0A-00-02-D7-B5 + if (len == 8) { - var dataTemp = data.Skip(index).Take(PreFixLength + DataLength).ToArray(); - if (dataTemp.Length < PreFixLength + DataLength)//拆包后不满足一条指令的长度 + if (data[4] == 0x00 && data[0] == 0xFF && data[1] == 0x00 && (data[4] == 0x01 && data[4] == 0x02)) { - continue; + //查询当前板子是否有待验证的指令 + var message = new MessageDto(); + var firstMessage = MessageList.Select(t => new { Id = t.Key ,Value = t.Value }) + .OrderBy(t => t.Value.CreateTime) + .First(); + if (firstMessage != null) + { + MessageList.TryRemove(firstMessage.Id, out message); + Logs.Write($"【信息化货架】以下指令已不重发:{BitConverter.ToString(firstMessage.Value.Message)}"); + } } - //获取返回指令的板子ID - var boardId = (dataTemp[PreFixLength + 0] << 8) + dataTemp[PreFixLength + 1]; - //查询当前板子是否有待验证的指令 - var message = new MessageDto(); - MessageList.TryGetValue(boardId, out message); - //功能位校验 功能位相同视为已响应指令 删除对应的指令 - if (message?.Message[PreFixLength + 2] == dataTemp[PreFixLength + 2]) - { - MessageList.TryRemove(boardId, out message); - } - index += (PreFixLength + DataLength - 2);//每次循环index会+1 所以这里-1 } } - Logs.Write($"【校验发送接收 结束】" + BitConverter.ToString(data), LogsType.InstructionResend); + //智能货架 + else + { + var len = data.Length; + for (int index = 0; index < data.Length - PreFixLength; index++) + { + //协议拆包 通过前缀校验是否为完整数据包 + var prefixInData = data.Skip(index).Take(PreFixLength); + var isEqual = prefixInData.SequenceEqual(Prefix); + if (isEqual) + { + var dataTemp = data.Skip(index).Take(PreFixLength + DataLength).ToArray(); + if (dataTemp.Length < PreFixLength + DataLength)//拆包后不满足一条指令的长度 + { + continue; + } + //获取返回指令的板子ID + var boardId = (dataTemp[PreFixLength + 0] << 8) + dataTemp[PreFixLength + 1]; + //查询当前板子是否有待验证的指令 + var message = new MessageDto(); + MessageList.TryGetValue(boardId, out message); + //功能位校验 功能位相同视为已响应指令 删除对应的指令 + if (message?.Message[PreFixLength + 2] == dataTemp[PreFixLength + 2]) + { + MessageList.TryRemove(boardId, out message); + } + index += (PreFixLength + DataLength - 2);//每次循环index会+1 所以这里-1 + } + } + } + Logs.Write($"【校验发送接收 结束】{ShelfTypeName}" + BitConverter.ToString(data), LogsType.InstructionResend); }); return null; }; @@ -207,6 +235,7 @@ namespace WCS.BLL } catch (Exception ex) { + Logs.Write("【发送指令时发生异常】" + ex.Message , LogsType.Instructions); //因异常断连时(网线已经被断了) 手动重连一次 if (ex is NotConnectedException) { @@ -249,6 +278,8 @@ namespace WCS.BLL /// 最后一次发送时间 /// public DateTime LastSendTime { get; set; } = DateTime.Now; + + public DateTime CreateTime { get; set; } = DateTime.Now; /// /// 发送内容 /// diff --git a/WCS.Model/ApiModel/InOutRecord/GetInOutRecordRequest.cs b/WCS.Model/ApiModel/InOutRecord/GetInOutRecordRequest.cs index 7641434..0395151 100644 --- a/WCS.Model/ApiModel/InOutRecord/GetInOutRecordRequest.cs +++ b/WCS.Model/ApiModel/InOutRecord/GetInOutRecordRequest.cs @@ -25,7 +25,7 @@ namespace WCS.Model.ApiModel.InOutRecord #endregion #region 库位属性 - public List ShelfTypeId { get; set; } + public int ShelfTypeId { get; set; } public List ShelfId { get; set; } public int StoreId { get; set; } public string StoreCode { get; set; } diff --git a/WCS.Model/ApiModel/MatInventoryDetail/GetMatInventoryDetailRequest.cs b/WCS.Model/ApiModel/MatInventoryDetail/GetMatInventoryDetailRequest.cs index 47d85e4..392e605 100644 --- a/WCS.Model/ApiModel/MatInventoryDetail/GetMatInventoryDetailRequest.cs +++ b/WCS.Model/ApiModel/MatInventoryDetail/GetMatInventoryDetailRequest.cs @@ -23,7 +23,7 @@ namespace WCS.Model.ApiModel.MatInventoryDetail #endregion #region 库位属性 - public List ShelfTypeId { get; set; } + public int ShelfTypeId { get; set; } public List ShelfId { get; set; } public string ShelfCode { get; set; } public int StoreId { get; set; } diff --git a/WCS.WebApi/Controllers/DIYController.cs b/WCS.WebApi/Controllers/DIYController.cs new file mode 100644 index 0000000..7ad6997 --- /dev/null +++ b/WCS.WebApi/Controllers/DIYController.cs @@ -0,0 +1,31 @@ +using Microsoft.AspNetCore.Mvc; +using WCS.BLL.Services.IService; +using WCS.BLL.Services.Service; +using WCS.Model; +using WCS.Model.ApiModel; +using WCS.Model.ApiModel.Stocktaking; +using WCS.Model.ApiModel.User; +using WCS.Model.WebSocketModel; + +namespace WCS.WebApi.Controllers +{ + /// + /// 本地化Controller + /// + [ApiController] + [Route("[controller]")] + public class DIYController : ControllerBase + { + public DIYController() + { + + } + + [Route("getStockTakingOrders")] + [HttpPost(Name = "getStockTakingOrders")] + public async Task getStockTakingOrders(GetStockTakingOrdersRequest request) + { + return await _stockTakingService.getStockTakingOrders(request); + } + } +} diff --git a/WCS.WebApi/Controllers/HomeController.cs b/WCS.WebApi/Controllers/HomeController.cs index 89137e0..5c6aac3 100644 --- a/WCS.WebApi/Controllers/HomeController.cs +++ b/WCS.WebApi/Controllers/HomeController.cs @@ -1,4 +1,5 @@ using Microsoft.AspNetCore.Mvc; +using NPOI.SS.Formula.Functions; using SqlSugar; using WCS.BLL.DbModels; using WCS.BLL.HardWare; @@ -8,6 +9,7 @@ using WCS.BLL.Services.Service; using WCS.DAL.Db; using WCS.Model; using WCS.Model.ApiModel.Home; +using Mode = WCS.BLL.HardWare.Mode; namespace WCS.WebApi.Controllers { @@ -97,6 +99,65 @@ namespace WCS.WebApi.Controllers } } + [Route("getShelfStatusDetails")] + [HttpPost(Name = "getShelfStatusDetails")] + public async Task getShelfStatusDetails(GetShelfStatusRequest request) + { + try + { + var shelfs = ShelfManager.Shelves + .WhereIF(request.GroupNames?.Count > 0, t => request.GroupNames!.Contains(t.GroupName)) + .ToList(); + //直接返回当前内存中缓存的货架和状态 + return new ResponseBase() + { + Code = 200, + Message = "success", + Data = shelfs, + }; + } + catch (Exception ex) + { + return new ResponseBase() + { + Code = 300, + Message = "获取失败:" + ex.Message, + }; + } + } + + [Route("getTCPClientsDetails")] + [HttpPost(Name = "getTCPClientsDetails")] + public async Task getTCPClientsDetails(GetShelfStatusRequest request) + { + try + { + var tcpClients = TCPClientManager.TCPClients.Select(t => new + { + RemoteIPHost = t.RemoteIPHost, + IsOnline = t.IsOnline, + IsFirstConnected = t.IsFirstConnected, + tcpClientIsNull = t.tcpClient == null, + tcpClientIsOnLine = t.tcpClient?.Online, + + }).ToList(); + //直接返回当前内存中缓存的货架和状态 + return new ResponseBase() + { + Code = 200, + Message = $"success!连接数量:{tcpClients.Count}", + Data = tcpClients, + }; + } + catch (Exception ex) + { + return new ResponseBase() + { + Code = 300, + Message = "获取失败:" + ex.Message, + }; + } + } [Route("shelfCheckAll")] [HttpPost(Name = "shelfCheckAll")] diff --git a/货架标准上位机/Models/AuthEnum.cs b/货架标准上位机/Models/AuthEnum.cs index 727a7ad..ac4edeb 100644 --- a/货架标准上位机/Models/AuthEnum.cs +++ b/货架标准上位机/Models/AuthEnum.cs @@ -13,11 +13,21 @@ namespace 货架标准上位机 /// public enum AuthEnum { - 查询 = 1000, - 权限 = 2000, - 设置 = 3000, - 调试 = 4000, - 主页 = 5000, + //主页 = 1000, + 物料入库 = 2000, + 出库单据 = 3000, + 物料出库 = 4000, + 盘点单据 = 5000, + 物料盘点 = 6000, + 库存查询 = 7000, + 出入记录 = 8000, + 库位管理 = 9000, + 物料维护 = 10000, + 物料明细 = 11000, + 接口记录 = 12000, + 权限 = 13000, + 调试 = 14000, + 设置 = 15000, } public class EnumTreeAttribute : Attribute diff --git a/货架标准上位机/ViewModels/InOutRecordViewModel.cs b/货架标准上位机/ViewModels/InOutRecordViewModel.cs index ba44761..f04f396 100644 --- a/货架标准上位机/ViewModels/InOutRecordViewModel.cs +++ b/货架标准上位机/ViewModels/InOutRecordViewModel.cs @@ -29,6 +29,7 @@ using WCS.Model.ApiModel.Stocktaking; using WCS.Model.ApiModel.InOutRecord; using System.Collections.ObjectModel; using static 货架标准上位机.ViewModel.InOutRecordViewModel; +using WCS.Model.ApiModel.Home; namespace 货架标准上位机.ViewModel { @@ -36,7 +37,46 @@ namespace 货架标准上位机.ViewModel { public InOutRecordViewModel() { + InitShelfTypeItems(); + } + private List shelfTypeItems; + public List ShelfTypeItems + { + get { return shelfTypeItems; } + set + { + SetProperty(ref shelfTypeItems, value); + } + } + + private ShelfTypeModel selectedShelfTypeItem; + public ShelfTypeModel SelectedShelfTypeItem + { + get { return selectedShelfTypeItem; } + set + { + SetProperty(ref selectedShelfTypeItem, value); + } + } + + public void InitShelfTypeItems() + { + //调用接口更新! + Task.Run(() => + { + var body = new RequestBase() + { + UserName = LocalStatic.CurrentUser, + DeviceType = LocalFile.Config.DeviceType, + }; + + var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "home/getShelfTypes", body, "POST"); + if (Result != null && Result.Data != null && Result.Data.Lists.Count() > 0) + { + ShelfTypeItems = Result.Data.Lists; + } + }); } public void InitMatCode() @@ -195,7 +235,7 @@ namespace 货架标准上位机.ViewModel public class DirectionItem { public string Text { get; set; } - public object Value { get; set; } + public object Value { get; set; } public override string ToString() { @@ -240,6 +280,8 @@ namespace 货架标准上位机.ViewModel StoreCode = StoreCode, Direction = SelectedDirection, + ShelfTypeId = SelectedShelfTypeItem == null ? 0 : SelectedShelfTypeItem.Id, + UserName = LocalStatic.CurrentUser, DeviceType = LocalFile.Config.DeviceType, PageNumber = CurrentPage, diff --git a/货架标准上位机/ViewModels/MatBaseInoScanGenarateMatInfoViewModel.cs b/货架标准上位机/ViewModels/MatBaseInoScanGenarateMatInfoViewModel.cs index 2d1eb25..73ad2d7 100644 --- a/货架标准上位机/ViewModels/MatBaseInoScanGenarateMatInfoViewModel.cs +++ b/货架标准上位机/ViewModels/MatBaseInoScanGenarateMatInfoViewModel.cs @@ -275,6 +275,8 @@ namespace 货架标准上位机.ViewModel //string secondField = Regex.Match(input, @"{[1-9][0]{2,5}[ ]{").Value; string secondField = Regex.Match(input, LocalFile.Config.RegexMatQty).Value; MatQty = Convert.ToInt32(secondField.Replace("{", "").Replace(" ", "")); + + input = input.Replace(secondField, string.Empty); } catch { @@ -326,28 +328,35 @@ namespace 货架标准上位机.ViewModel public void UpdateMatSN() { - if (MatSNs != null && totalPan > 1) + try { - MatSNs.Clear(); - for (int i = 0; i < TotalPan; i++) + if (MatSNs != null && MatSNs.Count > 0 && totalPan >= 1) { - var newMatSn = ChangelessCode + MatCode + ReservedCode + MatBatch + (MatBaseInfo.SerialNumber + i).ToString("000"); - MatSNs.Add(newMatSn); - } + MatSNs.Clear(); + for (int i = 0; i < TotalPan; i++) + { + var newMatSn = ChangelessCode + MatCode + ReservedCode + MatBatch + (MatBaseInfo.SerialNumber + i).ToString("000"); + MatSNs.Add(newMatSn); + } - if (MatSNs == null || MatSNs.Count == 0) - { - MatSNsStr = string.Empty; - } - else if (MatSNs.Count == 1) - { - MatSNsStr = MatSNs[0].ToString(); - } - else - { - MatSNsStr = MatSNs[0].ToString() + "\r\n~" + MatSNs[MatSNs.Count - 1].ToString(); + if (MatSNs == null || MatSNs.Count == 0) + { + MatSNsStr = string.Empty; + } + else if (MatSNs.Count == 1) + { + MatSNsStr = MatSNs[0].ToString(); + } + else + { + MatSNsStr = MatSNs[0].ToString() + "~\r\n" + MatSNs[MatSNs.Count - 1].ToString(); + } } } + catch + { + } + } public void GenerateMatSN() diff --git a/货架标准上位机/ViewModels/MatInventoryDetailViewModel.cs b/货架标准上位机/ViewModels/MatInventoryDetailViewModel.cs index 1cfa65e..f8954cf 100644 --- a/货架标准上位机/ViewModels/MatInventoryDetailViewModel.cs +++ b/货架标准上位机/ViewModels/MatInventoryDetailViewModel.cs @@ -26,6 +26,7 @@ using WCS.Model.ApiModel.MatBaseInfo; using WCS.Model.ApiModel.MatInventoryDetail; using HandyControl.Tools.Extension; using WCS.Model.ApiModel.Stocktaking; +using WCS.Model.ApiModel.Home; namespace 货架标准上位机.ViewModel { @@ -33,7 +34,7 @@ namespace 货架标准上位机.ViewModel { public MatInventoryDetailViewModel() { - + InitShelfTypeItems(); } public void InitMatCode() @@ -171,6 +172,44 @@ namespace 货架标准上位机.ViewModel SetProperty(ref matSN, value); } } + + private List shelfTypeItems; + public List ShelfTypeItems + { + get { return shelfTypeItems; } + set + { + SetProperty(ref shelfTypeItems, value); + } + } + public void InitShelfTypeItems() + { + //调用接口更新! + Task.Run(() => + { + var body = new RequestBase() + { + UserName = LocalStatic.CurrentUser, + DeviceType = LocalFile.Config.DeviceType, + }; + + var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "home/getShelfTypes", body, "POST"); + if (Result != null && Result.Data != null && Result.Data.Lists.Count() > 0) + { + ShelfTypeItems = Result.Data.Lists; + } + }); + } + + private ShelfTypeModel selectedShelfTypeItem; + public ShelfTypeModel SelectedShelfTypeItem + { + get { return selectedShelfTypeItem; } + set + { + SetProperty(ref selectedShelfTypeItem, value); + } + } #endregion #region Command @@ -208,6 +247,7 @@ namespace 货架标准上位机.ViewModel MatCode = MatCode, StoreCode = StoreCode, + ShelfTypeId = SelectedShelfTypeItem == null ? 0 : SelectedShelfTypeItem.Id, ShelfCode = ShelfCode, UserName = LocalStatic.CurrentUser, diff --git a/货架标准上位机/ViewModels/OutInventoryAddDucumentViewModel.cs b/货架标准上位机/ViewModels/OutInventoryAddDucumentViewModel.cs index 66ad7fa..40a3743 100644 --- a/货架标准上位机/ViewModels/OutInventoryAddDucumentViewModel.cs +++ b/货架标准上位机/ViewModels/OutInventoryAddDucumentViewModel.cs @@ -117,6 +117,8 @@ namespace 货架标准上位机.ViewModels } var window = new OutInventoryAddMatView(SelectedShelfTypeItem.Id); window.Owner = Application.Current.MainWindow; + window.Topmost = true; + var result = window.ShowDialog(); if (result == true) { diff --git a/货架标准上位机/ViewModels/OutInventoryDocumentViewModel.cs b/货架标准上位机/ViewModels/OutInventoryDocumentViewModel.cs index 810938a..dd9c295 100644 --- a/货架标准上位机/ViewModels/OutInventoryDocumentViewModel.cs +++ b/货架标准上位机/ViewModels/OutInventoryDocumentViewModel.cs @@ -145,6 +145,7 @@ namespace 货架标准上位机.ViewModels { var window = new OutInventoryAddDucumentView(); window.Owner = Application.Current.MainWindow; + window.Topmost = true; var result = window.ShowDialog(); if (result == true) BtnSearch(true); diff --git a/货架标准上位机/ViewModels/SetViewModel.cs b/货架标准上位机/ViewModels/SetViewModel.cs index 1309d78..509e7f5 100644 --- a/货架标准上位机/ViewModels/SetViewModel.cs +++ b/货架标准上位机/ViewModels/SetViewModel.cs @@ -10,6 +10,7 @@ using System.Drawing.Imaging; using System.IO; using System.IO.Ports; using System.Linq; +using System.Net; using System.Reflection.Emit; using System.Text; using System.Threading.Tasks; @@ -26,6 +27,20 @@ namespace 货架标准上位机.ViewModel { public class SetViewModel : BindableBase { + public SetViewModel() + { + IPHostEntry host = Dns.GetHostEntry(Dns.GetHostName()); + + IPList = host.AddressList + .Where(ipAddress => ipAddress.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork && !IPAddress.IsLoopback(ipAddress)) + .Select(t => t.ToString()).ToList(); + if (IPList != null && IPList.Count > 0) + { + SelectedIP = IPList[0]; + } + } + + private List SaveLoginCountData_ = new List { 3, 5, 7, 10 }; //记忆最大数量下拉框 public List SaveLoginCountData { get => SaveLoginCountData_; set { SetProperty(ref SaveLoginCountData_, value); } } @@ -39,6 +54,22 @@ namespace 货架标准上位机.ViewModel #region 页面输入信息 + private List ipList; + public List IPList + { + get => ipList; + set { SetProperty(ref ipList, value); } + } + + private string selectedIP; + public string SelectedIP + { + get => selectedIP; + set { SetProperty(ref selectedIP, value); } + } + + + private List scannerComList; public List ScannerComList { @@ -238,7 +269,7 @@ namespace 货架标准上位机.ViewModel if (Result != null && Result.Code == 200) { //拼凑url - var downLoadUrl = LocalFile.Config.ApiIpHost + $"fileDownload/downloadApp?fileName={Result.Data}"; + var downLoadUrl = $"http://{SelectedIP}:8888/" + $"fileDownload/downloadApp?fileName={Result.Data}"; //生成二维码 var qrCodeImage = GenerateQRCode(downLoadUrl); //展示二维码 diff --git a/货架标准上位机/Views/InOutRecordView.xaml b/货架标准上位机/Views/InOutRecordView.xaml index 01a83b2..4778637 100644 --- a/货架标准上位机/Views/InOutRecordView.xaml +++ b/货架标准上位机/Views/InOutRecordView.xaml @@ -45,7 +45,7 @@ SelectedItem="{Binding SelectedShelfTypeItem}" FontSize="18" Height="20" - IsEditable="True"/> + IsEditable="False"/> - + @@ -99,7 +99,7 @@ - - - + + @@ -123,7 +123,7 @@ - + @@ -135,7 +135,7 @@ - + @@ -147,7 +147,7 @@ - + @@ -159,7 +159,7 @@ - + @@ -171,7 +171,7 @@ - + @@ -183,7 +183,7 @@ - + @@ -233,7 +233,7 @@ --> - + @@ -245,7 +245,7 @@ - + diff --git a/货架标准上位机/Views/MainWindows/MainWindow1.xaml b/货架标准上位机/Views/MainWindows/MainWindow1.xaml index 82dc3e0..1dbcd50 100644 --- a/货架标准上位机/Views/MainWindows/MainWindow1.xaml +++ b/货架标准上位机/Views/MainWindows/MainWindow1.xaml @@ -88,7 +88,7 @@ - + @@ -100,7 +100,7 @@ - + @@ -111,8 +111,8 @@ - - + + @@ -124,7 +124,7 @@ - + @@ -136,7 +136,7 @@ - + @@ -148,7 +148,7 @@ - + @@ -160,7 +160,7 @@ - + @@ -172,7 +172,7 @@ - + @@ -198,7 +198,7 @@ - + @@ -210,7 +210,7 @@ - + @@ -222,7 +222,7 @@ - + @@ -234,7 +234,7 @@ - + diff --git a/货架标准上位机/Views/MatInventoryDetailView.xaml b/货架标准上位机/Views/MatInventoryDetailView.xaml index c87a5a1..1ea47be 100644 --- a/货架标准上位机/Views/MatInventoryDetailView.xaml +++ b/货架标准上位机/Views/MatInventoryDetailView.xaml @@ -36,12 +36,11 @@ - + FontSize="18" /> - + + + + diff --git a/货架标准上位机/Views/StocktakingDocumentView.xaml b/货架标准上位机/Views/StocktakingDocumentView.xaml index 51a3cbb..36b8f2d 100644 --- a/货架标准上位机/Views/StocktakingDocumentView.xaml +++ b/货架标准上位机/Views/StocktakingDocumentView.xaml @@ -89,7 +89,7 @@ Content="开始盘点" FontFamily="{StaticResource IconFont}" Background="CadetBlue" Foreground="White">