提交代码
@ -39,6 +39,8 @@ namespace WCS.BLL.Config
|
||||
public string? WMSUrl { get; set; }
|
||||
|
||||
public bool IsResetDBOrTable { get; set; }
|
||||
|
||||
public int InstoreTimeOut { get; set; } = 5000;
|
||||
#region 盟讯公司后台配置
|
||||
public bool IsMx { get; set; }
|
||||
/// <summary>
|
||||
|
46
WCS.BLL/DbModels/AppVersion.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WCS.Model.ApiModel.OutStore;
|
||||
|
||||
namespace WCS.BLL.DbModels
|
||||
{
|
||||
[SugarTable("wcs_app_version")]
|
||||
public class AppVersion
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键 自增Id
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// APP文件名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "app_name", Length = 100, IsNullable = false, ColumnDescription = "APP文件名称")]
|
||||
public string AppName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 版本号
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "version", Length = 100, IsNullable = false, ColumnDescription = "版本号")]
|
||||
public string Version { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 更新内容
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "content", Length = 250, IsNullable = true, ColumnDescription = "更新内容")]
|
||||
public string Content { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 操作时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "operate_time", IsNullable = false, ColumnDescription = "操作时间")]
|
||||
public DateTime OperateTime { get; set; } = DateTime.Now;
|
||||
}
|
||||
}
|
@ -72,6 +72,18 @@ namespace WCS.DAL.DbModels
|
||||
[SugarColumn(ColumnName = "client_ip", Length = 50, IsNullable = false, ColumnDescription = "货架对应Can模块的Ip")]
|
||||
public string ClientIp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 连接Can模块的端口号
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "port", Length = 50, IsNullable = true, ColumnDescription = "连接Can模块的端口号")]
|
||||
public string Port { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货架对应后端的Ip
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "server_ip", Length = 50, IsNullable = false, ColumnDescription = "货架对应后端服务的Ip")]
|
||||
public string ServerIp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货架的组别、区域(区分单个软件管哪些货架的,前端的配置文件配置一个组别,查询时只显示当前组别的货架)
|
||||
/// </summary>
|
||||
|
@ -66,6 +66,8 @@ namespace WCS.BLL.HardWare
|
||||
public string GroupName { get; set; }
|
||||
|
||||
public string WebSocketIpAddress { get; set; }
|
||||
|
||||
public string? CurrentCom { get; set; }
|
||||
/// <summary>
|
||||
/// 模组
|
||||
/// </summary>
|
||||
|
@ -4,6 +4,9 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WCS.BLL.DbModels;
|
||||
using WCS.BLL.Manager;
|
||||
using WCS.DAL.Db;
|
||||
using WCS.DAL.DbModels;
|
||||
using WCS.Model;
|
||||
using static WCS.BLL.HardWare.WarningLight;
|
||||
|
||||
@ -11,26 +14,40 @@ namespace WCS.BLL.HardWare
|
||||
{
|
||||
public class SingleLightShelf : IShelfBase
|
||||
{
|
||||
public int ShelfId { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
public string ShelfCode { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
public int RowCounts { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
public int ColumnCounts { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
public Mode CurrentMode { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
public string ModulesStr { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
public string GroupName { get; set; }
|
||||
public MatInfoResponse InStoreData { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
public SingleLightShelf(ShelfInfo shelfInfo)
|
||||
{
|
||||
ShelfId = shelfInfo.Id;
|
||||
ShelfCode = shelfInfo.ShelfCode;
|
||||
RowCounts = shelfInfo.Rowcounts;
|
||||
ColumnCounts = shelfInfo.Columncounts;
|
||||
SetCurrentMode(Mode.待机模式);
|
||||
ClientIp = shelfInfo.ClientIp;
|
||||
LightId = shelfInfo.LightId;
|
||||
}
|
||||
|
||||
public int ShelfId { get; set; }
|
||||
public string ShelfCode { get; set; }
|
||||
public int RowCounts { get; set; }
|
||||
public int ColumnCounts { get; set; }
|
||||
public Mode CurrentMode { get; set; }
|
||||
public string ModulesStr { get; set; }
|
||||
public string GroupName { get; set; }
|
||||
public MatInfoResponse InStoreData { get; set; }
|
||||
public string? CurrentCom { get; set; } = string.Empty;
|
||||
public string OrderNumber { get; set; }
|
||||
public int LightId { get; set; }
|
||||
public LightColorEnum LightColor { get; set; }
|
||||
public List<int> ModuleIds { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
public string ClientIp { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
public List<string> ExceptionMessages { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
public bool IsWarning { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
public string WebSocketIpAddress { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
public List<SmartShelfModule> Modules { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
public List<int> ModuleIds { get; set; }
|
||||
public string ClientIp { get; set; }
|
||||
public List<string> ExceptionMessages { get; set; }
|
||||
public bool IsWarning { get; set; }
|
||||
public string WebSocketIpAddress { get; set; }
|
||||
|
||||
public List<SmartShelfModule> Modules { get; set; } = new List<SmartShelfModule>();
|
||||
public DateTime SetCurrentModeTime { get; set; }
|
||||
|
||||
public TCPClient TcpCleint { get { return TCPClientManager.GetTCPClientByIPHost(ClientIp); } }
|
||||
|
||||
public bool ConfirmStocktakingSingle(int BoardId, int LightNumber)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
@ -56,6 +56,7 @@ namespace WCS.BLL.HardWare
|
||||
public int RowCounts { get; set; }
|
||||
public int ColumnCounts { get; set; }
|
||||
public Mode CurrentMode { get; set; }
|
||||
|
||||
public DateTime SetCurrentModeTime { get; set; }
|
||||
public string ModulesStr { get; set; }//当前货架所有模组的Str
|
||||
public string GroupName { get; set; }
|
||||
@ -95,7 +96,6 @@ namespace WCS.BLL.HardWare
|
||||
/// </summary>
|
||||
public List<ProcessingExceptionType> ProcessingExceptions { get; set; } = new List<ProcessingExceptionType>();
|
||||
public string? CurrentCom { get; set; } = string.Empty;
|
||||
//TODO 退出入库清除
|
||||
|
||||
public MatInfoResponse InStoreData { get; set; }
|
||||
|
||||
@ -119,6 +119,7 @@ namespace WCS.BLL.HardWare
|
||||
{
|
||||
try
|
||||
{
|
||||
Logs.Write($"[GoInInstore IPAddress]{IPAddress}", LogsType.Instore);
|
||||
if (this.CurrentMode == Mode.入库模式)
|
||||
{
|
||||
CurrentCom = IPAddress;
|
||||
@ -217,6 +218,7 @@ namespace WCS.BLL.HardWare
|
||||
WarningLight.BlueLight(TcpCleint);
|
||||
//绑定当前进入入库PDA/WCS前端的IP
|
||||
CurrentCom = IPAddress;
|
||||
Logs.Write($"[GoInInstore CurrentCom]{CurrentCom}", LogsType.Instore);
|
||||
//返回成功
|
||||
return;
|
||||
}
|
||||
@ -866,6 +868,15 @@ namespace WCS.BLL.HardWare
|
||||
}
|
||||
}
|
||||
|
||||
public void CalibrationSetOffset(int moduleId, int offSet)
|
||||
{
|
||||
var moudle = Modules.Where(t => t.ModuleId == moduleId).First();
|
||||
if (moudle != null)
|
||||
{
|
||||
moudle.CalibrationSetOffset(offSet, TcpCleint);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetCurrentMode(Mode mode)
|
||||
{
|
||||
this.CurrentMode = mode;
|
||||
@ -891,11 +902,62 @@ namespace WCS.BLL.HardWare
|
||||
{
|
||||
try
|
||||
{
|
||||
if (CurrentMode == Mode.待机模式)
|
||||
OrderNumber = "自检中...";
|
||||
foreach (var module in Modules.Where(t => t.IsEnable).ToList())
|
||||
{
|
||||
module.IsSelfCheck = true;
|
||||
module.ShelfCheck(TcpCleint);
|
||||
}
|
||||
|
||||
//状态校验 自检模式未响应
|
||||
Task.Run(() =>
|
||||
{
|
||||
var timeOut = 3000;
|
||||
var timeSpan = TimeSpan.FromMilliseconds(0);
|
||||
var beginTime = DateTime.Now;
|
||||
while (timeSpan <= TimeSpan.FromMilliseconds(timeOut))
|
||||
{
|
||||
timeSpan = DateTime.Now - beginTime;
|
||||
//所有板子成功进入入库模式 表示进入入库模式成功,跳出循环
|
||||
var isSelfChecking = Modules.Where(t => t.IsSelfCheck)
|
||||
.Where(t => t.IsEnable)
|
||||
.Any();
|
||||
if (!isSelfChecking)
|
||||
{
|
||||
break;
|
||||
}
|
||||
//循环延时处理
|
||||
Thread.Sleep(50);
|
||||
}
|
||||
|
||||
var notReturnList = Modules.Where(t => t.IsSelfCheck)
|
||||
.Where(t => t.IsEnable).ToList();
|
||||
|
||||
if (notReturnList.Count > 0)
|
||||
{
|
||||
Logs.Write($"货架{ShelfCode}存在模组自检未响应:", LogsType.Instore);
|
||||
foreach (var item in notReturnList)
|
||||
{
|
||||
ExceptionMessages.Add($"模组{item.ModuleCode}未响应自检!");
|
||||
}
|
||||
//通信校验
|
||||
var messages = notReturnList.Select(t => $"模组{t.ModuleCode}未响应自检!").ToList();
|
||||
var exceptionMessage = string.Join("\r\n", messages);
|
||||
var warningModel = new WebSocketMessageModel()
|
||||
{
|
||||
IsWarning = false,
|
||||
WarningType = WarningTypeEnum.自检未响应,
|
||||
StoreId = 0,
|
||||
StoreCode = "",
|
||||
ShelfCode = ShelfCode,
|
||||
ShelfId = ShelfId,
|
||||
WarningMessage = exceptionMessage,
|
||||
ClientIp = WebSocketIpAddress,
|
||||
};
|
||||
WarningManager.SendWarning(warningModel);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -903,6 +965,7 @@ namespace WCS.BLL.HardWare
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (CurrentMode == Mode.待机模式)
|
||||
OrderNumber = string.Empty;
|
||||
}
|
||||
}
|
||||
@ -1211,7 +1274,6 @@ namespace WCS.BLL.HardWare
|
||||
|
||||
if (storeInfo == null)
|
||||
{
|
||||
//TODO 报错
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1219,7 +1281,6 @@ namespace WCS.BLL.HardWare
|
||||
.FirstOrDefault();
|
||||
if (module == null)
|
||||
{
|
||||
//TODO 报错
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1261,7 +1322,7 @@ namespace WCS.BLL.HardWare
|
||||
{
|
||||
module.ComfirmErrInstore(TcpCleint);
|
||||
WarningLight.WaringLightBlueEnd(TcpCleint);
|
||||
//TO DO Logs.Write($"[{guid}]该位置已放置物料!");
|
||||
Logs.Write($"{storeInfo.StoreCode}该位置已放置物料!", LogsType.Instore);
|
||||
return;
|
||||
}
|
||||
#endregion
|
||||
@ -1293,7 +1354,7 @@ namespace WCS.BLL.HardWare
|
||||
MatSupplier = this.InStoreData.supplier,
|
||||
|
||||
InstoreTime = DateTime.Now,
|
||||
InstoreUser = ""
|
||||
InstoreUser = this.InStoreData.InstoreUser,
|
||||
};
|
||||
|
||||
//出入库记录表
|
||||
@ -1367,9 +1428,10 @@ namespace WCS.BLL.HardWare
|
||||
.Where(t => t.ShelfId == ShelfId)
|
||||
.Where(t => t.BoardId == boardId && t.LightNumber == lightNumber)
|
||||
.First();
|
||||
//库位未找到
|
||||
if (storeInfo == null)
|
||||
{
|
||||
//TO DO 库位未找到
|
||||
Logs.Write($"【InStoreExceptionReturnProcess】boardId:{boardId},lightNumber{lightNumber},库位未找到 ", LogsType.Instore);
|
||||
return;
|
||||
}
|
||||
//已放物料丢失了 物料多放了 储位恢复正常
|
||||
@ -1421,6 +1483,8 @@ namespace WCS.BLL.HardWare
|
||||
};
|
||||
WarningManager.SendWarning(warningModel);
|
||||
|
||||
WarningLight.WaringLightAlwaysRed(TcpCleint);
|
||||
|
||||
ProcessingExceptions.Add(new ProcessingExceptionType()
|
||||
{
|
||||
BoardId = boardId,
|
||||
@ -1446,6 +1510,8 @@ namespace WCS.BLL.HardWare
|
||||
};
|
||||
WarningManager.SendWarning(warningModel);
|
||||
|
||||
WarningLight.WaringLightAlwaysRed(TcpCleint);
|
||||
|
||||
ProcessingExceptions.Add(new ProcessingExceptionType()
|
||||
{
|
||||
BoardId = boardId,
|
||||
@ -1651,6 +1717,7 @@ namespace WCS.BLL.HardWare
|
||||
var orderMatDetails = DbHelp.db.Queryable<OutOrderMatDetail>()
|
||||
.Where(t => t.OrderId == CurrentOutOrder.Id)
|
||||
.Where(t => t.MatSN == inventoryDetail.MatSN)
|
||||
.Where(t => t.IsSended == false)
|
||||
.First();
|
||||
|
||||
if (orderMatDetails == null)
|
||||
@ -2030,7 +2097,9 @@ namespace WCS.BLL.HardWare
|
||||
WarningMessage = exceptionMessage,
|
||||
ClientIp = WebSocketIpAddress,
|
||||
};
|
||||
|
||||
WarningManager.SendWarning(warningModel);
|
||||
WarningLight.WaringLightAlwaysRed(TcpCleint);
|
||||
|
||||
ProcessingExceptions.Add(new ProcessingExceptionType()
|
||||
{
|
||||
@ -2055,7 +2124,9 @@ namespace WCS.BLL.HardWare
|
||||
WarningMessage = exceptionMessage,
|
||||
ClientIp = WebSocketIpAddress
|
||||
};
|
||||
|
||||
WarningManager.SendWarning(warningModel);
|
||||
WarningLight.WaringLightAlwaysRed(TcpCleint);
|
||||
|
||||
ProcessingExceptions.Add(new ProcessingExceptionType()
|
||||
{
|
||||
@ -2182,6 +2253,16 @@ namespace WCS.BLL.HardWare
|
||||
|
||||
public void SelfCheckProcess(byte[] data, int boardId, int lightNumber)
|
||||
{
|
||||
var module = this.Modules.Where(t => t.BoardId == boardId).FirstOrDefault();
|
||||
if (module == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
module.IsSelfCheck = false;
|
||||
}
|
||||
|
||||
if (data[TcpCleint.PreFixLength + 3] == 0x01)
|
||||
{
|
||||
//比对结果相同
|
||||
|
@ -75,20 +75,33 @@ namespace WCS.BLL.HardWare
|
||||
/// </summary>
|
||||
public byte[] VoltageSingleData = { 0x17, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
/// <summary>
|
||||
/// 电压偏移值
|
||||
/// 查询电压偏移值
|
||||
/// </summary>
|
||||
public byte[] OffsetSingleData = { 0x18, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
/// <summary>
|
||||
/// 电压标准值
|
||||
/// 查询电压标准值
|
||||
/// </summary>
|
||||
public byte[] StandardSingleData = { 0x19, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
|
||||
/// <summary>
|
||||
/// 标定
|
||||
/// </summary>
|
||||
public byte[] CalibrationData = { 0x0D, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
/// <summary>
|
||||
/// 设置偏移量 01 F4 = 500
|
||||
/// </summary>
|
||||
public byte[] SetOffsetData = { 0x0E, 0x0A, 0x01, 0xF4, 0x00, 0x00, 0x00, 0x00 };
|
||||
|
||||
#endregion
|
||||
public int ModuleId { get; set; }
|
||||
public string ModuleCode { get; set; }
|
||||
public int BoardId { get; set; }
|
||||
public bool IsEnable { get; set; }
|
||||
public Mode CurrentMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否已发送自检命令
|
||||
/// </summary>
|
||||
public bool IsSelfCheck { get; set; } = false;
|
||||
public List<string> CurrentOutSns { get; set; }
|
||||
public List<string> CurrentStockTakingSns { get; set; }
|
||||
|
||||
@ -197,7 +210,7 @@ namespace WCS.BLL.HardWare
|
||||
/// <param name="tcpClient"></param>
|
||||
public void GoInOutStoreMode(TCPClient tcpClient, List<string> outSns)
|
||||
{
|
||||
Logs.Write($"模组{ModuleCode},本次亮灯物料{string.Join(",",outSns)}", LogsType.Outstore);
|
||||
Logs.Write($"模组{ModuleCode},本次亮灯物料{string.Join(",", outSns)}", LogsType.Outstore);
|
||||
CurrentOutSns = outSns;
|
||||
var storeInfos = DbHelp.db.Queryable<StoreInfo>().Where(t => t.ModuleId == ModuleId)
|
||||
.Where(t => t.BoardId == BoardId)
|
||||
@ -408,5 +421,25 @@ namespace WCS.BLL.HardWare
|
||||
tcpClient.Send(tcpClient.GenerateMessage(BoardId, OffsetSingleData));
|
||||
});
|
||||
}
|
||||
|
||||
public void CalibrationSetOffset(int offSet, TCPClient tcpClient)
|
||||
{
|
||||
var offSetData = BitConverter.GetBytes(unchecked((short)offSet));
|
||||
// 检查是否需要交换字节
|
||||
if (BitConverter.IsLittleEndian)
|
||||
{
|
||||
// 如果是小端序系统,则交换字节
|
||||
byte temp = offSetData[0];
|
||||
offSetData[0] = offSetData[1];
|
||||
offSetData[1] = temp;
|
||||
}
|
||||
|
||||
SetOffsetData[2] = offSetData[0];
|
||||
SetOffsetData[3] = offSetData[1];
|
||||
|
||||
tcpClient.Send(tcpClient.GenerateMessage(BoardId, CalibrationData));
|
||||
Thread.Sleep(100);
|
||||
tcpClient.Send(tcpClient.GenerateMessage(BoardId, SetOffsetData));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,10 +61,12 @@ namespace WCS.BLL.Manager
|
||||
Logs.Write("【初始化数据库】MX", LogsType.StartBoot);
|
||||
}
|
||||
//手动修改后台配置后再进行CodeFirst 数据库的生成、表的生成
|
||||
//如果不配置此参数 每次启动都会持续几十秒才能成功启动后端
|
||||
if (LocalFile.Config.IsResetDBOrTable)
|
||||
{
|
||||
#region 建库建表 只在表有变动时运行
|
||||
DbHelp.db.DbMaintenance.CreateDatabase();
|
||||
//新部署时 日志需要建表 不然没得接口记录
|
||||
DbHelp.dbLog.DbMaintenance.CreateDatabase();
|
||||
Logs.Write("【初始化数据库】创建数据库", LogsType.StartBoot);
|
||||
|
||||
@ -72,12 +74,13 @@ namespace WCS.BLL.Manager
|
||||
, typeof(InventoryDetail), typeof(OutOrder), typeof(OutOrderDetail), typeof(OutOrderMatDetail)
|
||||
, typeof(ShelfTypeInfo), typeof(MatBaseInfo), typeof(MatInfo)
|
||||
, typeof(StockTakingOrder), typeof(StockTakingOrderMatDetail), typeof(InOutRecord)
|
||||
, typeof(DocumentSerialNumber),typeof(OrderLight),typeof(MatInfoLog)
|
||||
, typeof(DocumentSerialNumber), typeof(OrderLight), typeof(MatInfoLog)
|
||||
, typeof(AppVersion)
|
||||
);
|
||||
Logs.Write("【初始化数据库】db建表", LogsType.StartBoot);
|
||||
|
||||
Logs.Write("【初始化数据库】db(业务数据库)建表", LogsType.StartBoot);
|
||||
DbHelp.dbLog.CodeFirst.InitTables(typeof(SystemApiLogRecord));
|
||||
Logs.Write("【初始化数据库】logdb建表", LogsType.StartBoot);
|
||||
Logs.Write("【初始化数据库】dblog(日志数据库)建表", LogsType.StartBoot);
|
||||
|
||||
//初始化单据序列号数据
|
||||
if (!DbHelp.db.Queryable<DocumentSerialNumber>().Any())
|
||||
@ -88,14 +91,12 @@ namespace WCS.BLL.Manager
|
||||
UpdateDate = DateTime.Now,
|
||||
CurrentSerialNumber = 0
|
||||
};
|
||||
|
||||
var stockTakingDocumentSerialNumber = new DocumentSerialNumber()
|
||||
{
|
||||
DocumentType = DocumentTypeEnum.盘点单据,
|
||||
UpdateDate = DateTime.Now,
|
||||
CurrentSerialNumber = 0
|
||||
};
|
||||
|
||||
DbHelp.db.Insertable(outDocumentSerialNumber).ExecuteCommand();
|
||||
DbHelp.db.Insertable(stockTakingDocumentSerialNumber).ExecuteCommand();
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ namespace WCS.BLL.Manager
|
||||
GroupName = shelfInDb.GroupName,
|
||||
};
|
||||
case 2:
|
||||
return new SmartShelf(shelfInDb)
|
||||
return new SingleLightShelf(shelfInDb)
|
||||
{
|
||||
ShelfId = shelfInDb.Id,
|
||||
ShelfCode = shelfInDb.ShelfCode,
|
||||
|
@ -29,7 +29,12 @@ namespace WCS.BLL.Manager
|
||||
|
||||
var clientsInDB = DbHelp.db.Queryable<ShelfInfo>()
|
||||
.WhereIF(!string.IsNullOrEmpty(LocalFile.Config.GroupName), t => t.GroupName == LocalFile.Config.GroupName)
|
||||
.Select(t => new { IP = t.ClientIp, ShelfTypeName = t.ShelfTypeName })
|
||||
.Select(t => new
|
||||
{
|
||||
IP = t.ClientIp,
|
||||
ShelfTypeName = t.ShelfTypeName,
|
||||
Port = t.Port,
|
||||
})
|
||||
.Distinct()
|
||||
.ToList();
|
||||
Logs.Write($"【InitTcpClient】需要连接的服务端地址如下:\r\n{string.Join(";", clientsInDB)}", LogsType.StartBoot);
|
||||
@ -37,7 +42,7 @@ namespace WCS.BLL.Manager
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
var tcpCleint = new TCPClient(cleientInDB.IP, "",cleientInDB.ShelfTypeName);
|
||||
var tcpCleint = new TCPClient(cleientInDB.IP, cleientInDB.Port, cleientInDB.ShelfTypeName);
|
||||
tcpCleint.tcpClient.Received += (client, e) =>
|
||||
{
|
||||
var clientIpHost = client.IP + ":" + client.Port;
|
||||
@ -138,7 +143,7 @@ namespace WCS.BLL.Manager
|
||||
return EasyTask.CompletedTask;
|
||||
};
|
||||
|
||||
lock(TCPClients)//避免添加失败的情况
|
||||
lock (TCPClients)//避免添加失败的情况
|
||||
{
|
||||
TCPClients.Add(tcpCleint);
|
||||
}
|
||||
|
@ -50,10 +50,12 @@ namespace WCS.BLL.Manager
|
||||
lock (flag)
|
||||
{
|
||||
Warnings.Add(warning);
|
||||
//发送WebSocket记录
|
||||
Logs.Write(JsonConvert.SerializeObject(warning),LogsType.WebSocket);
|
||||
|
||||
WebSoceketManager.TrySendMessage(warning.ClientIp, JsonConvert.SerializeObject(warning));
|
||||
warning.LastSendTime = DateTime.Now;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void ClearWarning(WebSocketMessageModel warning, SolveTypeEnum solveType)
|
||||
@ -66,7 +68,6 @@ namespace WCS.BLL.Manager
|
||||
{
|
||||
if (solveType == SolveTypeEnum.处理)
|
||||
{
|
||||
//TODO 对应报警处理对应的数据
|
||||
switch (warningInManager.WarningType)
|
||||
{
|
||||
case WarningTypeEnum.入库自检丢失:
|
||||
|
@ -48,7 +48,6 @@ namespace WCS.BLL.Manager
|
||||
var warningInManager = WarningManager.Warnings.Where(t => t.Guid == warning.Guid).FirstOrDefault();
|
||||
if (warningInManager != null)
|
||||
{
|
||||
|
||||
warningInManager.ClientIsReceived = true;
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
|
||||
using WCS.Model;
|
||||
|
||||
namespace WCS.BLL.Services.IService
|
||||
{
|
||||
public interface IHomerService
|
||||
{
|
||||
|
||||
public Task<ResponseBase> GetShelfServer(RequestBase request);
|
||||
}
|
||||
}
|
||||
|
@ -14,5 +14,7 @@ namespace WCS.BLL.Services.IService
|
||||
public Task<ResponseBase> StartSelfCheckByShelfCode(StartSelfCheckByShelfCodeRequest request);
|
||||
|
||||
public Task<ResponseBase> StartSelfCheckByGroupName(List<string> GroupNames);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -52,6 +52,12 @@ namespace WCS.BLL.Services.IService
|
||||
/// <returns></returns>
|
||||
public Task<ResponseCommon> queryModuleVoltage(QueryModuleVoltageRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// 标定+设置偏移量
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public Task<ResponseCommon> calibrationSetOffset(CalibrationSetOffsetRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// 查询库位列表
|
||||
|
@ -4,11 +4,35 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WCS.BLL.Services.IService;
|
||||
using WCS.DAL.Db;
|
||||
using WCS.DAL.DbModels;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.Home;
|
||||
|
||||
namespace WCS.BLL.Services.Service
|
||||
{
|
||||
public class HomerService: IHomerService
|
||||
public class HomerService : IHomerService
|
||||
{
|
||||
public HomerService() { }
|
||||
|
||||
public async Task<ResponseBase> GetShelfServer(RequestBase request)
|
||||
{
|
||||
//直接获取数据库数据 分组进行返回
|
||||
var data = await DbHelp.db.Queryable<ShelfInfo>()
|
||||
.Where(t => !string.IsNullOrEmpty(t.BigShelfCode))
|
||||
.Select(t => new GetShelfServerResponseItem()
|
||||
{
|
||||
BigShelfCode = t.BigShelfCode,
|
||||
ServerIp = t.ServerIp,
|
||||
})
|
||||
.Distinct()
|
||||
.ToListAsync();
|
||||
return new GetShelfServerResponse()
|
||||
{
|
||||
Code = 200,
|
||||
Message = "success",
|
||||
Data = data
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ namespace WCS.BLL.Services.Service
|
||||
Message = "success"
|
||||
};
|
||||
}
|
||||
else if (Result != null && Result.Code == 200 && Result.Data == null)
|
||||
else if (Result != null && Result.Code == 200 && (Result.Data == null || Result.Data.Count == 0))
|
||||
{
|
||||
//Mes系统中未获取到物料信息
|
||||
|
||||
@ -295,7 +295,6 @@ namespace WCS.BLL.Services.Service
|
||||
var matInfo = await DbHelp.db.Queryable<MatInfo>().Where(t => t.MatSn == request.MatSn).FirstAsync();
|
||||
if (matInfo != null)
|
||||
{
|
||||
//TODO 改成wcs的实体
|
||||
if (!request.SingleLightIn && shelf != null)
|
||||
shelf.InStoreData = new MatInfoResponse()
|
||||
{
|
||||
@ -391,8 +390,8 @@ namespace WCS.BLL.Services.Service
|
||||
};
|
||||
}
|
||||
|
||||
//TODO 配置这个时间相当于需要入库扫码后需要等待的时间
|
||||
var timeOut = 5000;
|
||||
//配置这个时间相当于需要入库扫码后需要等待的时间
|
||||
var timeOut = LocalFile.Config.InstoreTimeOut;
|
||||
var timeSpan = TimeSpan.FromMilliseconds(0);
|
||||
var beginTime = DateTime.Now;
|
||||
while (timeSpan <= TimeSpan.FromMilliseconds(timeOut))
|
||||
|
@ -52,7 +52,8 @@ namespace WCS.BLL.Services.Service
|
||||
Message = $"操作失败:库位【{string.Join(",", storeCodeList)}】不存在!",
|
||||
};
|
||||
}
|
||||
//第二步 获取当前所有库位任务
|
||||
|
||||
//第二步 获取库位正在进行的任务
|
||||
//模式相同视为可以继续发送任务
|
||||
var currenTasks = DbHelp.db.Queryable<CurrentTask>()
|
||||
.Where(t => storeCodeList.Contains(t.StoreCode))
|
||||
|
@ -5,7 +5,10 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WCS.BLL.Manager;
|
||||
using WCS.BLL.Services.IService;
|
||||
using WCS.DAL.Db;
|
||||
using WCS.DAL.DbModels;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.Home;
|
||||
using WCS.Model.ApiModel.SelfCheck;
|
||||
using WCS.Model.WebSocketModel;
|
||||
|
||||
@ -63,10 +66,11 @@ namespace WCS.BLL.Services.Service
|
||||
foreach (var ip in cleintIps)
|
||||
{
|
||||
var currentIdShelfs = shelfs.Where(t => t.ClientIp == ip)
|
||||
.Where(t => t.CurrentMode == HardWare.Mode.待机模式)
|
||||
.ToList();
|
||||
Task.Run(() =>
|
||||
{
|
||||
foreach(var shelf in currentIdShelfs)
|
||||
foreach (var shelf in currentIdShelfs)
|
||||
{
|
||||
|
||||
Task.Run(() =>
|
||||
@ -116,5 +120,7 @@ namespace WCS.BLL.Services.Service
|
||||
Message = $"已成功开始自检!",
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ namespace WCS.BLL.Services.Service
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TODO HardCode 根据模组信息生成库位
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<ResponseCommon<object>> GenerateStoreInfo()
|
||||
@ -443,6 +443,44 @@ namespace WCS.BLL.Services.Service
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ResponseCommon> calibrationSetOffset(CalibrationSetOffsetRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
var modules = await DbHelp.db.Queryable<ModuleInfo>().Where(t => request.MouduleIds.Contains(t.Id)).ToListAsync();
|
||||
var isSend = false;
|
||||
foreach (var module in modules)
|
||||
{
|
||||
var shelf = ShelfManager.Shelves.Where(t => t.ShelfId == module.ShelfId).FirstOrDefault();
|
||||
if (shelf != null && shelf is SmartShelf)
|
||||
{
|
||||
var smartShelf = (SmartShelf)shelf;
|
||||
smartShelf.CalibrationSetOffset(module.Id, request.OffSet);
|
||||
isSend = true;
|
||||
}
|
||||
}
|
||||
if (isSend)
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 200,
|
||||
Message = "Success"
|
||||
};
|
||||
else
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 201,
|
||||
Message = "操作失败:未找到对应模组"
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 300,
|
||||
Message = "操作失败:" + ex.Message
|
||||
};
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 库位管理
|
||||
@ -580,7 +618,6 @@ namespace WCS.BLL.Services.Service
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -455,6 +455,7 @@ namespace WCS.BLL.Services.Service
|
||||
.FirstAsync();
|
||||
if (user == null)
|
||||
{
|
||||
|
||||
return new ResponseCommon<UserBase>()
|
||||
{
|
||||
Code = 201,
|
||||
@ -497,6 +498,8 @@ namespace WCS.BLL.Services.Service
|
||||
|
||||
//返回字串不返回密码
|
||||
user.Password = "***";
|
||||
request.PassWord = "***";
|
||||
|
||||
var response = new ResponseCommon<UserBase>()
|
||||
{
|
||||
Code = 200,
|
||||
|
@ -45,6 +45,7 @@ namespace WCS.BLL
|
||||
/// 入库流程日志
|
||||
/// </summary>
|
||||
Instore,
|
||||
WebSocket,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -66,9 +66,11 @@ namespace WCS.BLL
|
||||
|
||||
tcpClient = new TcpClient();
|
||||
|
||||
if (string.IsNullOrEmpty(BindIPHost))
|
||||
{
|
||||
//载入配置
|
||||
tcpClient.Setup(new TouchSocketConfig()
|
||||
.SetRemoteIPHost(RemoteIPHost)
|
||||
.SetRemoteIPHost(new IPHost(RemoteIPHost))
|
||||
//.SetBindIPHost(BindIPHost)
|
||||
.ConfigurePlugins(a =>
|
||||
{
|
||||
@ -81,6 +83,25 @@ namespace WCS.BLL
|
||||
//添加控制台日志注入
|
||||
a.AddConsoleLogger();
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
//载入配置
|
||||
tcpClient.Setup(new TouchSocketConfig()
|
||||
.SetRemoteIPHost(new IPHost(RemoteIPHost))
|
||||
.SetBindIPHost(new IPHost(BindIPHost))
|
||||
.ConfigurePlugins(a =>
|
||||
{
|
||||
//配置断线重连
|
||||
a.UseReconnection(-1, true, 1000);
|
||||
a.Add<HeartbeatAndReceivePlugin>();
|
||||
})
|
||||
.ConfigureContainer(a =>
|
||||
{
|
||||
//添加控制台日志注入
|
||||
a.AddConsoleLogger();
|
||||
}));
|
||||
}
|
||||
|
||||
//添加接收事件 匹配已发送的指令
|
||||
tcpClient.Received += (client, e) =>
|
||||
@ -96,7 +117,7 @@ namespace WCS.BLL
|
||||
//灯控制统一返回的是 FF-00-00-0A-00-02-D7-B5
|
||||
if (len == 8)
|
||||
{
|
||||
if (data[4] == 0x00 && data[0] == 0xFF && data[1] == 0x00 && (data[4] == 0x01 && data[4] == 0x02))
|
||||
if (data[4] == 0x00 && data[0] == 0xFF && data[1] == 0x00 && (data[5] == 0x01 || data[5] == 0x02))
|
||||
{
|
||||
//查询当前板子是否有待验证的指令
|
||||
var message = new MessageDto();
|
||||
@ -233,8 +254,8 @@ namespace WCS.BLL
|
||||
{
|
||||
Logs.Write($"【发送】{BitConverter.ToString(message)}", LogsType.Instructions);
|
||||
});
|
||||
//发送自带8ms间隔
|
||||
Thread.Sleep(8);
|
||||
//发送自带15ms间隔
|
||||
Thread.Sleep(15);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -7,7 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="TouchSocket" Version="2.0.3" />
|
||||
<PackageReference Include="TouchSocket" Version="2.0.11" />
|
||||
<PackageReference Include="TouchSocket.Http" Version="2.0.3" />
|
||||
<PackageReference Include="XLParser" Version="1.7.2" />
|
||||
</ItemGroup>
|
||||
|
18
WCS.Model/ApiModel/Home/GetShelfServerResponse.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WCS.Model.ApiModel.Home
|
||||
{
|
||||
public class GetShelfServerResponse : ResponseBase<List<GetShelfServerResponseItem>>
|
||||
{
|
||||
public List<GetShelfServerResponseItem> Data { get; set; }
|
||||
}
|
||||
|
||||
public class GetShelfServerResponseItem
|
||||
{
|
||||
public string BigShelfCode { get; set; }
|
||||
|
||||
public string ServerIp { get; set; }
|
||||
}
|
||||
}
|
@ -29,6 +29,9 @@ namespace WCS.Model
|
||||
|
||||
public string ModulesStr { get; set; }
|
||||
|
||||
public string? CurrentCom { get; set; } = string.Empty;
|
||||
|
||||
public DateTime SetCurrentModeTime { get; set; }
|
||||
/// <summary>
|
||||
/// 货架组别
|
||||
/// </summary>
|
||||
|
13
WCS.Model/ApiModel/StoreInfo/CalibrationSetOffsetRequest.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WCS.Model.ApiModel.StoreInfo
|
||||
{
|
||||
public class CalibrationSetOffsetRequest : RequestBase
|
||||
{
|
||||
public List<int> MouduleIds { get; set; }
|
||||
|
||||
public int OffSet { get; set; }
|
||||
}
|
||||
}
|
@ -21,7 +21,6 @@ namespace WCS.Model.ApiModel.StoreInfo
|
||||
/// 货架当前状态
|
||||
/// </summary>
|
||||
public int CurrentMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货架行数
|
||||
/// </summary>
|
||||
|
@ -21,10 +21,17 @@ namespace WCS.Model.ApiModel
|
||||
public List<int> RoleIds { get; set; } = new List<int>();
|
||||
|
||||
public List<string> RoleNames { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否最大权限
|
||||
/// 是否最大权限管理员
|
||||
/// </summary>
|
||||
public bool IsAdmin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否是工程研发人员
|
||||
/// </summary>
|
||||
public bool IsGCYF { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
|
@ -59,6 +59,7 @@ namespace WCS.Model.WebSocketModel
|
||||
|
||||
自检丢失 = 15,
|
||||
自检未扫描上架 = 16,
|
||||
自检未响应 = 17,
|
||||
|
||||
//通知类
|
||||
恢复正常 = 50,
|
||||
|
@ -1,8 +1,13 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using MiniExcelLibs;
|
||||
using NPOI.HPSF;
|
||||
using WCS.BLL.DbModels;
|
||||
using WCS.BLL.Services.IService;
|
||||
using WCS.BLL.Services.Service;
|
||||
using WCS.DAL.Db;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel;
|
||||
using WCS.Model.ApiModel.MatBaseInfo;
|
||||
using WCS.Model.ApiModel.User;
|
||||
using WCS.Model.WebSocketModel;
|
||||
|
||||
@ -21,6 +26,85 @@ namespace WCS.WebApi.Controllers
|
||||
|
||||
}
|
||||
|
||||
[HttpPost("uploadApp")]
|
||||
public async Task<ResponseBase> uploadApp([FromForm] IFormFile excelFile, [FromForm] string version, [FromForm] string content)
|
||||
{
|
||||
//文件校验
|
||||
if (excelFile == null || excelFile.Length == 0 || !excelFile.FileName.ToUpper().Contains("APK"))
|
||||
{
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 201,
|
||||
Message = "上传失败:文件格式错误或文件为空!"
|
||||
};
|
||||
}
|
||||
//版本号输入参数的校验
|
||||
if (string.IsNullOrEmpty(version))
|
||||
{
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 201,
|
||||
Message = "上传失败:请输入上传文件的版本号version!"
|
||||
};
|
||||
}
|
||||
|
||||
//版本号输入参数的校验
|
||||
if (string.IsNullOrEmpty(content) || content.Length > 250)
|
||||
{
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"上传失败:请输入【更新内容】或者【更新内容】长度{content.Length}过长需要小于250!"
|
||||
};
|
||||
}
|
||||
|
||||
// 定义保存路径
|
||||
var savePath = Path.Combine(Directory.GetCurrentDirectory(), $"Files");
|
||||
// 确保文件夹存在
|
||||
if (!Directory.Exists(savePath))
|
||||
{
|
||||
Directory.CreateDirectory(savePath);
|
||||
}
|
||||
|
||||
// 构造文件完整路径
|
||||
var filePath = Path.Combine(savePath, excelFile.FileName);
|
||||
try
|
||||
{
|
||||
// 保存文件
|
||||
using (var stream = new FileStream(filePath, FileMode.Create))
|
||||
{
|
||||
await excelFile.CopyToAsync(stream);
|
||||
}
|
||||
|
||||
#region 保存数据
|
||||
var appVersion = new AppVersion()
|
||||
{
|
||||
AppName = excelFile.FileName,
|
||||
Version = version,
|
||||
Content = content,
|
||||
};
|
||||
DbHelp.db.Insertable(appVersion).ExecuteCommand();
|
||||
#endregion
|
||||
|
||||
// 文件上传成功,返回成功信息
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 200,
|
||||
Message = "上传成功!"
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 异常处理,返回错误信息
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 300,
|
||||
Message = "上传失败: " + ex.Message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("downloadApp")]
|
||||
public IActionResult downloadApp(string fileName)
|
||||
{
|
||||
@ -79,5 +163,49 @@ namespace WCS.WebApi.Controllers
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取最新的版本
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getLatestAppVersion")]
|
||||
public ResponseBase getLatestAppVersion()
|
||||
{
|
||||
try
|
||||
{
|
||||
var appVersion = DbHelp.db.Queryable<AppVersion>().OrderByDescending(t => t.Id).First(); ;
|
||||
if (appVersion != null)
|
||||
{
|
||||
return new ResponseBase<object>()
|
||||
{
|
||||
Code = 200,
|
||||
Message = "success",
|
||||
Data = new
|
||||
{
|
||||
AppName = appVersion.AppName,
|
||||
Version = appVersion.Version,
|
||||
Content = appVersion.Content,
|
||||
}
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ResponseBase<object>()
|
||||
{
|
||||
Code = 201,
|
||||
Message = "未获取到APK的最新版本",
|
||||
};
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ResponseBase<object>()
|
||||
{
|
||||
Code = 300,
|
||||
Message = $"请求失败:{ex.Message}"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -82,6 +82,8 @@ namespace WCS.WebApi.Controllers
|
||||
{
|
||||
ShelfId = t.ShelfId,
|
||||
ShelfCode = t.ShelfCode,
|
||||
CurrentCom = t.CurrentCom,
|
||||
SetCurrentModeTime = t.SetCurrentModeTime,
|
||||
CurentMode = (int)t.CurrentMode,
|
||||
ModulesStr = t.ModulesStr,
|
||||
GroupName = t.GroupName,
|
||||
@ -236,5 +238,56 @@ namespace WCS.WebApi.Controllers
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取货架对应的服务端的Ip和端口号
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[Route("getShelfServer")]
|
||||
[HttpPost(Name = "getShelfServer")]
|
||||
public async Task<ResponseBase> getShelfServer(RequestBase request)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await _homerService.GetShelfServer(request);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ResponseBase<object>()
|
||||
{
|
||||
Code = 300,
|
||||
Message = "查询失败" + ex.Message,
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Route("getWebSocketWarnings")]
|
||||
[HttpPost(Name = "getWebSocketWarnings")]
|
||||
public async Task<ResponseBase> getWebSocketWarnings(RequestBase request)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new ResponseBase<object>()
|
||||
{
|
||||
Code = 200,
|
||||
Message = "success",
|
||||
Data = WarningManager.Warnings
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ResponseBase<object>()
|
||||
{
|
||||
Code = 300,
|
||||
Message = "查询失败" + ex.Message,
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using WCS.BLL;
|
||||
using WCS.BLL.HardWare;
|
||||
using WCS.BLL.Manager;
|
||||
using WCS.BLL.Services.IService;
|
||||
@ -34,18 +35,22 @@ namespace WebApi.Controllers
|
||||
string content = string.Empty;
|
||||
try
|
||||
{
|
||||
Logs.Write($"[request.IpAdress]{request.IpAdress}", LogsType.Instore);
|
||||
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8>IP<49><50>ַ
|
||||
if (string.IsNullOrEmpty(request.IpAdress))
|
||||
{
|
||||
var IPAdress = HttpContext?.Connection?.RemoteIpAddress?.ToString();
|
||||
if (string.IsNullOrEmpty(IPAdress))
|
||||
{
|
||||
//δ<><CEB4>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8>IP<49><50>ַ
|
||||
//TO DO <20><>¼<EFBFBD><C2BC>־δ<D6BE><CEB4>ȡ<EFBFBD><C8A1>IP
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8>Ip<49><70>ַ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>request
|
||||
request.IpAdress = IPAdress;
|
||||
}
|
||||
}
|
||||
Logs.Write($"[request.IpAdress]{request.IpAdress}", LogsType.Instore);
|
||||
return _instoreService.shelfGoInInStore(request);
|
||||
|
||||
}
|
||||
@ -140,7 +145,6 @@ namespace WebApi.Controllers
|
||||
[HttpPost(Name = "singleLightCommitInstore")]
|
||||
public async Task<ResponseBase> singleLightCommitInstore(QueryByMatSnRequestSingle request)
|
||||
{
|
||||
//TODO:<3A><><EFBFBD><EFBFBD> <20><><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD>
|
||||
try
|
||||
{
|
||||
//var aa = Helper.Query();
|
||||
|
@ -13,7 +13,7 @@ using WCS.Model.WebSocketModel;
|
||||
namespace WCS.WebApi.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 单灯单独控制亮灯接口 煤科院钻探分院项目
|
||||
/// 液晶面板 煤科院钻探分院项目
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
|
@ -294,7 +294,6 @@ namespace WebApi.Controllers
|
||||
[HttpPost(Name = "singleLightGoInOutstore")]
|
||||
public async Task<ResponseBase> singleLightGoInOutstore(GetOutOrderDetailRequest request)
|
||||
{
|
||||
//TODO:<3A><><EFBFBD><EFBFBD>
|
||||
try
|
||||
{
|
||||
return await _outstoreService.GoInOutstoreSingle(request);
|
||||
@ -342,7 +341,6 @@ namespace WebApi.Controllers
|
||||
[HttpPost(Name = "singleLightConfirmOutstore")]
|
||||
public async Task<ResponseBase> singleLightConfirmOutstore(OutOrderMatDetailModelSingle request)
|
||||
{
|
||||
//TODO<44><4F><EFBFBD><EFBFBD>
|
||||
try
|
||||
{
|
||||
return await _outstoreService.SingleLightConfirmOutstore(request);
|
||||
|
@ -66,6 +66,13 @@ namespace WCS.WebApi.Controllers
|
||||
{
|
||||
return await _storeInfoService.queryModuleVoltage(request);
|
||||
}
|
||||
|
||||
[Route("calibrationSetOffset")]
|
||||
[HttpPost(Name = "calibrationSetOffset")]
|
||||
public async Task<ResponseBase> calibrationSetOffset(CalibrationSetOffsetRequest request)
|
||||
{
|
||||
return await _storeInfoService.calibrationSetOffset(request);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 库位管理
|
||||
|
BIN
WCS.WebApi/Files/智能货架.apk
Normal file
@ -28,7 +28,6 @@ namespace WebApi
|
||||
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>
|
||||
DbInit.InitDb();
|
||||
|
||||
|
||||
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
LocalFile.SaveConfig();
|
||||
|
||||
@ -46,9 +45,27 @@ namespace WebApi
|
||||
{
|
||||
MXBackgroundThread.InitBackgroundThread();
|
||||
var str = string.Empty;
|
||||
MXBackgroundThread.SendDingDingMsg("<EFBFBD><EFBFBD>̨<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>", new List<string> { "104379" }, ref str);
|
||||
MXBackgroundThread.SendDingDingMsg($"<22><>{LocalFile.Config.GroupName}<7D><><EFBFBD><EFBFBD>̨<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>", new List<string> { "104379" }, ref str);
|
||||
}
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD>ı<EFBFBD><C4B1><EFBFBD>־
|
||||
Task.Run(async () =>
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
try
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>־
|
||||
WCS.BLL.Logs.Clear(TimeSpan.FromDays(92));
|
||||
//ÿһ<C3BF><D2BB>ִ<EFBFBD><D6B4>һ<EFBFBD><D2BB>
|
||||
await Task.Delay(1000 * 60 * 60 * 24);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
@ -21,7 +21,8 @@
|
||||
<!--字体-->
|
||||
<FontFamily x:Key="IconFont">pack://application,,,/货架标准上位机;component/Fonts/#iconfont</FontFamily>
|
||||
<!--字符串-->
|
||||
<sys:String x:Key="AboutInfo1">金川数智</sys:String>
|
||||
<sys:String x:Key="AboutInfo1">卓越盟讯</sys:String>
|
||||
<!--<sys:String x:Key="AboutInfo1">金川数智</sys:String>-->
|
||||
<sys:String x:Key="AboutInfo2">智造未来</sys:String>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
|
Before Width: | Height: | Size: 264 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 18 KiB |
BIN
货架标准上位机/Resources/LogoJC.ico
Normal file
After Width: | Height: | Size: 264 KiB |
BIN
货架标准上位机/Resources/LogoJC.png
Normal file
After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 18 KiB |
@ -87,5 +87,7 @@ namespace 货架标准上位机
|
||||
public string ModulesStr { get; set; } = string.Empty;
|
||||
|
||||
public string MatSn { get; set; } = string.Empty;
|
||||
|
||||
public string InstoreUser { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,11 @@ namespace 货架标准上位机.ViewModel
|
||||
Result.Data
|
||||
.ForEach(t =>
|
||||
{
|
||||
var shelf = new ShelfStatusControl(t.ShelfCode, t.CurentMode, "");
|
||||
if (t.CurentMode == 0 || t.CurentMode == 1)
|
||||
{
|
||||
t.OrderNumber = string.Empty;
|
||||
}
|
||||
var shelf = new ShelfStatusControl(t.ShelfCode, t.CurentMode, t.OrderNumber);
|
||||
wrapPanel.Children.Add(shelf);
|
||||
});
|
||||
});
|
||||
|
@ -57,11 +57,12 @@ namespace 货架标准上位机.ViewModel
|
||||
scanner.TempCode += currentScanedCode;
|
||||
//校验末尾码
|
||||
CheckDataCompleteness(scanner);
|
||||
scanner.ScannerDisplayControl.RefreshValues(scanner.ShelfCode, scanner.MatSn);
|
||||
scanner.ScannerDisplayControl.RefreshValues(scanner.ShelfCode, scanner.MatSn, scanner.InstoreUser);
|
||||
}
|
||||
return EasyTask.CompletedTask;
|
||||
};
|
||||
}
|
||||
RevertScannerStatus();
|
||||
}
|
||||
|
||||
#region Property
|
||||
@ -77,6 +78,58 @@ namespace 货架标准上位机.ViewModel
|
||||
#endregion
|
||||
|
||||
#region Command
|
||||
/// <summary>
|
||||
/// 第一次加载时 获取服务器对应货架是否在入库模式 是否是扫码枪启动的 还原扫码枪的状态
|
||||
/// </summary>
|
||||
public void RevertScannerStatus()
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
try
|
||||
{
|
||||
var body = new GetShelfStatusRequest()
|
||||
{
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = "WCS前端",
|
||||
GroupNames = LocalFile.Config.GroupName,
|
||||
};
|
||||
var Result = ApiHelp.Post<GetShelfStatusResponse>([LocalFile.Config.ApiIpHost, "home/getShelfStatus"], body).Result;
|
||||
if (Result != null && Result.Data != null && Result.Data?.Count > 0)
|
||||
{
|
||||
var shelfs = Result.Data.Where(t => t.CurentMode == 1 && !string.IsNullOrEmpty(t.CurrentCom)).ToList();
|
||||
if (shelfs == null || shelfs.Count == 0)
|
||||
return;
|
||||
|
||||
Logs.Write($"【启动时发现需要恢复扫码枪状态】{string.Join(",", shelfs.Select(t => t.CurrentCom).ToList())}", LogsType.Scanner);
|
||||
foreach (var shelf in shelfs)
|
||||
{
|
||||
var scanner = ScannerManager.Scanners.Where(t => t.COM == shelf.CurrentCom).FirstOrDefault();
|
||||
if (scanner != null)
|
||||
{
|
||||
|
||||
scanner.IsInstoreMode = true;
|
||||
scanner.IsInstoreModeTime = shelf.SetCurrentModeTime;
|
||||
scanner.ShelfCode = shelf.ShelfCode;
|
||||
scanner.ModulesStr = shelf.ModulesStr;
|
||||
|
||||
scanner.ScannerDisplayControl.RefreshValues(scanner.ShelfCode, scanner.MatSn, scanner.InstoreUser);
|
||||
Logs.Write($"【恢复扫码枪】{scanner.COM}", LogsType.Scanner);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void CheckDataCompleteness(Scanner scanner)
|
||||
{
|
||||
if (scanner.TempCode.EndsWith("\r"))//结束符 TODO结束符是否需要自定义 现场配置
|
||||
@ -118,7 +171,24 @@ namespace 货架标准上位机.ViewModel
|
||||
Logs.Write($"[{scanner.COM}]校验到扫码数据为结束入库码【{scanner.TempCode}】", LogsType.Scanner);
|
||||
ShelfGoOutInstoreProcess(scanner);
|
||||
}
|
||||
//TODO 增加正则表达式进行判断是否扫到的是物料码
|
||||
else if (scanner.TempCode.ToUpper().Contains("MXID") && scanner.TempCode.ToUpper().Contains("NAME"))
|
||||
{
|
||||
string pattern = @"\b\d{6}\b"; // 匹配一个完整的6位数字
|
||||
Match match = Regex.Match(scanner.TempCode, pattern);
|
||||
if (match.Success)
|
||||
{
|
||||
scanner.InstoreUser = match.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
Logs.Write($"扫码枪扫到{scanner.TempCode},无法解析出工号!", LogsType.Scanner);
|
||||
}
|
||||
}
|
||||
else if (Regex.IsMatch(scanner.TempCode, @"^\d{6}$"))
|
||||
{
|
||||
scanner.InstoreUser = scanner.TempCode;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logs.Write($"[{scanner.COM}]校验到扫码数据为物料码【{scanner.TempCode}】", LogsType.Scanner);
|
||||
@ -164,7 +234,7 @@ namespace 货架标准上位机.ViewModel
|
||||
ShelfCode = scanner.ShelfCode,
|
||||
IPAdress = scanner.COM,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
UserName = string.IsNullOrEmpty(scanner.InstoreUser) ? LocalStatic.CurrentUser : scanner.InstoreUser,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseBase>(LocalFile.Config.ApiIpHost + "instore/shelfGoOutInStore", body, "POST", true);
|
||||
if (Result != null && Result.Code == 200)
|
||||
@ -197,7 +267,7 @@ namespace 货架标准上位机.ViewModel
|
||||
{
|
||||
ModuleCode = scanner.TempCode,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
UserName = string.IsNullOrEmpty(scanner.InstoreUser) ? LocalStatic.CurrentUser : scanner.InstoreUser,
|
||||
IpAdress = scanner.COM,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ShelfGoInInstoreResponse>(LocalFile.Config.ApiIpHost + "instore/shelfGoInInStore", body, "POST");
|
||||
@ -247,7 +317,7 @@ namespace 货架标准上位机.ViewModel
|
||||
ShelfCode = scanner.ShelfCode,
|
||||
IPAdress = scanner.COM,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
UserName = string.IsNullOrEmpty(scanner.InstoreUser) ? LocalStatic.CurrentUser : scanner.InstoreUser,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseBase>(LocalFile.Config.ApiIpHost + "instore/shelfGoOutInStore", body, "POST");
|
||||
if (Result != null && Result.Code == 200)
|
||||
@ -277,7 +347,7 @@ namespace 货架标准上位机.ViewModel
|
||||
ShelfCode = scanner.ShelfCode,
|
||||
IpAddress = scanner.COM,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
UserName = string.IsNullOrEmpty(scanner.InstoreUser) ? LocalStatic.CurrentUser : scanner.InstoreUser,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<MatInfoModel>>(LocalFile.Config.ApiIpHost + "instore/queryByMatSn", body, "POST");
|
||||
if (Result != null && Result.Code == 200)
|
||||
@ -294,14 +364,14 @@ namespace 货架标准上位机.ViewModel
|
||||
ShelfCode = scanner.ShelfCode,
|
||||
IpAddress = scanner.COM,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
UserName = string.IsNullOrEmpty(scanner.InstoreUser) ? LocalStatic.CurrentUser : scanner.InstoreUser,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<MatInfoModel>>(LocalFile.Config.ApiIpHost + "instore/queryInstoreStatus", body, "POST");
|
||||
if (Result != null && !string.IsNullOrEmpty(Result.Message))
|
||||
{
|
||||
TextBoxLog.AddLog($"物料[{scanner.MatSn}]" + Result.Message, "InstoreLog", DateTime.Now);
|
||||
scanner.MatSn = string.Empty;
|
||||
scanner.ScannerDisplayControl.RefreshValues(scanner.ShelfCode, scanner.MatSn);
|
||||
scanner.ScannerDisplayControl.RefreshValues(scanner.ShelfCode, scanner.MatSn, scanner.InstoreUser);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -337,7 +407,7 @@ namespace 货架标准上位机.ViewModel
|
||||
{
|
||||
ShelfCode = t.ShelfCode,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
UserName = string.IsNullOrEmpty(t.InstoreUser) ? LocalStatic.CurrentUser : t.InstoreUser,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "instore/shelfGoOutInStore", body, "POST");
|
||||
if (Result != null && Result.Code == 200)
|
||||
@ -346,7 +416,7 @@ namespace 货架标准上位机.ViewModel
|
||||
t.ShelfCode = string.Empty;
|
||||
t.MatSn = string.Empty;
|
||||
|
||||
t.ScannerDisplayControl.RefreshValues(t.ShelfCode, t.MatSn);
|
||||
t.ScannerDisplayControl.RefreshValues(t.ShelfCode, t.MatSn, t.InstoreUser);
|
||||
Growl.Success(Result.Message);
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ namespace 货架标准上位机.ViewModel
|
||||
RefreshOutOrderList();
|
||||
}
|
||||
|
||||
public static object flag { get; set; } = new object();
|
||||
#region Property
|
||||
private OutOrderModel selectedOutOrder;
|
||||
public OutOrderModel SelectedOutOrder
|
||||
@ -42,14 +43,19 @@ namespace 货架标准上位机.ViewModel
|
||||
set
|
||||
{
|
||||
SetProperty(ref selectedOutOrder, value);
|
||||
if (selectedOutOrder != null)
|
||||
|
||||
if (selectedOutOrder != null && selectedOutOrder.OrderNumber != SelectedOutOrderNumber)
|
||||
{
|
||||
SelectedOutOrderNumber = selectedOutOrder.OrderNumber;
|
||||
RefreshDataGridItemSource();
|
||||
}
|
||||
else if (selectedOutOrder != null && selectedOutOrder.OrderNumber == SelectedOutOrderNumber)
|
||||
{
|
||||
RefreshDataGridItemSource();
|
||||
}
|
||||
else
|
||||
{
|
||||
DataGridItemSource?.Clear();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -118,9 +124,19 @@ namespace 货架标准上位机.ViewModel
|
||||
public void RefreshCount()
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
SendedPan = dataGridItemSource.Where(t => t.IsSended).Count();
|
||||
TotalPan = dataGridItemSource.Count();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Thread.Sleep(500);
|
||||
SendedPan = dataGridItemSource.Where(t => t.IsSended).Count();
|
||||
TotalPan = dataGridItemSource.Count();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
@ -131,6 +147,7 @@ namespace 货架标准上位机.ViewModel
|
||||
{
|
||||
var window = new MXOutOrderView();
|
||||
window.Owner = Application.Current.MainWindow;
|
||||
window.Topmost = true;
|
||||
window.ShowDialog();
|
||||
}
|
||||
|
||||
@ -143,22 +160,22 @@ namespace 货架标准上位机.ViewModel
|
||||
//判断是否选择单据
|
||||
if (SelectedOutOrder == null)
|
||||
{
|
||||
Growl.Warning("未选择单据!");
|
||||
Growl.Warning("未选择单据!请选择左侧单据!");
|
||||
return;
|
||||
}
|
||||
|
||||
#region 调用接口开始出库
|
||||
var body = new GetOutOrderDetailRequest()
|
||||
{
|
||||
OrderId = selectedOutOrder.Id,
|
||||
OrderNumber = selectedOutOrder.OrderNumber,
|
||||
OrderId = SelectedOutOrder.Id,
|
||||
OrderNumber = SelectedOutOrder.OrderNumber,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "outStore/goInOutstore", body, "POST");
|
||||
if (Result != null && Result.Code == 200)
|
||||
{
|
||||
Growl.Warning("已成功开始出库!");
|
||||
Growl.Warning("已成功开始发料!");
|
||||
RefreshOutOrderList(SelectedOutOrderNumber);
|
||||
}
|
||||
else if (Result != null)
|
||||
@ -188,23 +205,22 @@ namespace 货架标准上位机.ViewModel
|
||||
//判断是否选择单据
|
||||
if (SelectedOutOrder == null)
|
||||
{
|
||||
Growl.Warning("未选择单据!");
|
||||
Growl.Warning("未选择单据!请选择左侧单据!");
|
||||
return;
|
||||
}
|
||||
#region 调用接口结束出库
|
||||
var body = new GetOutOrderDetailRequest()
|
||||
{
|
||||
OrderId = selectedOutOrder.Id,
|
||||
OrderNumber = selectedOutOrder.OrderNumber,
|
||||
OrderId = SelectedOutOrder.Id,
|
||||
OrderNumber = SelectedOutOrder.OrderNumber,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "outStore/goOutOutstore", body, "POST");
|
||||
if (Result != null && Result.Code == 200)
|
||||
{
|
||||
Growl.Warning("已成功结束出库!");
|
||||
Growl.Warning("已成功取消发料!");
|
||||
RefreshOutOrderList(SelectedOutOrderNumber);
|
||||
//RefreshDataGridItemSource();
|
||||
}
|
||||
else if (Result != null)
|
||||
{
|
||||
@ -227,6 +243,14 @@ namespace 货架标准上位机.ViewModel
|
||||
|
||||
public void RefreshOutOrderList(string OrderNumber = "")
|
||||
{
|
||||
lock (flag)
|
||||
{
|
||||
Logs.Write($"【RefreshOutOrderList1】OrderNumber{OrderNumber}", LogsType.Info);
|
||||
if (string.IsNullOrEmpty(OrderNumber) && !string.IsNullOrEmpty(SelectedOutOrderNumber))
|
||||
{
|
||||
OrderNumber = SelectedOutOrderNumber;
|
||||
Logs.Write($"【RefreshOutOrderList2】OrderNumber{OrderNumber}", LogsType.Info);
|
||||
}
|
||||
#region 调用接口获取发料单
|
||||
try
|
||||
{
|
||||
@ -241,7 +265,17 @@ namespace 货架标准上位机.ViewModel
|
||||
OutOrderList = new ObservableCollection<OutOrderModel>(Result.Data.Lists);
|
||||
if (!string.IsNullOrEmpty(OrderNumber))
|
||||
{
|
||||
SelectedOutOrder = OutOrderList.Where(t => t.OrderNumber == OrderNumber).FirstOrDefault();
|
||||
if (selectedOutOrder == null)
|
||||
{
|
||||
SelectedOutOrder = OutOrderList?.Where(t => t.OrderNumber == OrderNumber).FirstOrDefault();
|
||||
}
|
||||
Logs.Write($"【RefreshOutOrderList3】SelectedOutOrder{SelectedOutOrder?.OrderNumber}", LogsType.Info);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (selectedOutOrder == null)
|
||||
SelectedOutOrder = OutOrderList?.FirstOrDefault();
|
||||
Logs.Write($"【RefreshOutOrderList3】SelectedOutOrder{SelectedOutOrder?.OrderNumber}", LogsType.Info);
|
||||
}
|
||||
}
|
||||
else if (Result != null && !string.IsNullOrEmpty(Result.Message))
|
||||
@ -253,33 +287,45 @@ namespace 货架标准上位机.ViewModel
|
||||
{
|
||||
Growl.Warning(ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public void RefreshDataGridItemSource()
|
||||
{
|
||||
lock (flag)
|
||||
{
|
||||
if (SelectedOutOrder == null)
|
||||
{
|
||||
//选择的单据为空无法进行查询
|
||||
Logs.Write("【RefreshDataGridItemSource】选择的单据为空无法进行查询", LogsType.Info);
|
||||
SelectedOutOrder = OutOrderList?.FirstOrDefault();
|
||||
return;
|
||||
}
|
||||
}
|
||||
#region 调用接口获取出库单物料明细
|
||||
Task.Run(() =>
|
||||
{
|
||||
Logs.Write($"【RefreshDataGridItemSource】{SelectedOutOrder?.OrderNumber}", LogsType.Info);
|
||||
|
||||
var body = new GetOutOrderDetailRequest()
|
||||
{
|
||||
OrderId = selectedOutOrder.Id,
|
||||
OrderNumber = selectedOutOrder.OrderNumber,
|
||||
OrderId = SelectedOutOrder.Id,
|
||||
OrderNumber = SelectedOutOrder.OrderNumber,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<List<OutOrderMatDetailModel>>>(LocalFile.Config.ApiIpHost + "outStore/getOutOrderMatDetail", body, "POST");
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<List<OutOrderMatDetailModel>>>(LocalFile.Config.ApiIpHost + "outStore/getOutOrderMatDetail", body, "POST", true);
|
||||
if (Result != null && Result.Code == 200)
|
||||
{
|
||||
if (Result.Data.Count > 0)
|
||||
{
|
||||
DataGridItemSource = new ObservableCollection<OutOrderMatDetailModel>(Result.Data);
|
||||
var list = Result.Data.OrderBy(t => t.IsSended).ToList();
|
||||
Logs.Write($"【RefreshDataGridItemSource】Result.Data.Count > 0{SelectedOutOrder?.OrderNumber}", LogsType.Info);
|
||||
//App.Current.Dispatcher.Invoke(() =>
|
||||
//{
|
||||
DataGridItemSource = new ObservableCollection<OutOrderMatDetailModel>(list);
|
||||
//});
|
||||
OrderStatus = Result.Message;
|
||||
if (OrderStatus == OutOrderStatus.全部发料.ToString())
|
||||
{
|
||||
@ -288,6 +334,7 @@ namespace 货架标准上位机.ViewModel
|
||||
}
|
||||
else
|
||||
{
|
||||
Logs.Write("【RefreshDataGridItemSource】Result.Data.Count <= 0,清空明细", LogsType.Info);
|
||||
App.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
DataGridItemSource?.Clear();
|
||||
|
@ -15,6 +15,8 @@
|
||||
<TextBlock Name="txtCurrentShelf" HorizontalAlignment="Center"></TextBlock>
|
||||
<TextBlock HorizontalAlignment="Center">当前入库物料</TextBlock>
|
||||
<TextBlock Name="txtCurrentMat" HorizontalAlignment="Center"></TextBlock>
|
||||
<TextBlock HorizontalAlignment="Center">当前入库人</TextBlock>
|
||||
<TextBlock Name="txtInstoreUser" HorizontalAlignment="Center"></TextBlock>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</UserControl>
|
||||
|
@ -28,12 +28,13 @@ namespace 货架标准上位机.Views.Controls
|
||||
txtCom.Text = COM;
|
||||
}
|
||||
|
||||
public void RefreshValues(string shelfCode, string matSn)
|
||||
public void RefreshValues(string shelfCode, string matSn,string instoreUser = "")
|
||||
{
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
txtCurrentShelf.Text = shelfCode;
|
||||
txtCurrentMat.Text = matSn;
|
||||
txtInstoreUser.Text = instoreUser;
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,8 @@ namespace 货架标准上位机
|
||||
|
||||
viewModel.LoadTask();
|
||||
}
|
||||
|
||||
|
||||
private void vis(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (IsInDesignMode)
|
||||
|
@ -24,16 +24,14 @@
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<Button
|
||||
Style="{StaticResource ButtonDanger}"
|
||||
Margin="10"
|
||||
PreviewKeyDown="Button_PreviewKeyDown"
|
||||
hc:BorderElement.CornerRadius="15"
|
||||
MinHeight="40"
|
||||
FontSize="20"
|
||||
MinHeight="42"
|
||||
FontSize="24"
|
||||
Content="结束所有入库"
|
||||
FontFamily="{StaticResource IconFont}"
|
||||
Command="{Binding BtnEndCommand}">
|
||||
|
@ -36,10 +36,7 @@ namespace 货架标准上位机
|
||||
t.ScannerDisplayControl = control;
|
||||
scannersWrapPanel.Children.Add(control);
|
||||
});
|
||||
|
||||
//ImageSource = new BitmapImage(new Uri("/Resources/goOutInstore.png"));
|
||||
}
|
||||
//public BitmapImage ImageSource { get; set; }
|
||||
private void DataGrid_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
|
||||
{
|
||||
DataGrid datagrid = sender as DataGrid;
|
||||
@ -60,7 +57,7 @@ namespace 货架标准上位机
|
||||
{
|
||||
if (IsInDesignMode)
|
||||
return;
|
||||
//viewModel.NewMethod();
|
||||
|
||||
}
|
||||
|
||||
private void UserControlBase_LoadedVisible(object sender, EventArgs e)
|
||||
|
226
货架标准上位机/Views/MainWindows/MainWindow2.xaml
Normal file
@ -0,0 +1,226 @@
|
||||
<hc:Window xmlns:View="clr-namespace:货架标准上位机" x:Class="货架标准上位机.MainWindow2"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:货架标准上位机"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:pi="https://github.com/ping9719/wpfex"
|
||||
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
mc:Ignorable="d"
|
||||
Title="{Binding Title}" NonClientAreaBackground="#FFDCEEFF" Height="800" Width="1280" Icon="/Resources/Logo.ico"
|
||||
Background="#FFDCEEFF" WindowStartupLocation="CenterScreen" Loaded="load">
|
||||
<!--标题栏-->
|
||||
<hc:Window.NonClientAreaContent>
|
||||
<StackPanel HorizontalAlignment="Right">
|
||||
<Menu Height="29" Background="#FFDCEEFF">
|
||||
<!--<MenuItem Height="29" Command="{Binding OpenUserCommand}" Visibility="{Binding IsLogin,Converter={StaticResource Boolean2VisibilityConverter}}">-->
|
||||
<MenuItem Height="29" Command="{Binding OpenUserCommand}">
|
||||
<MenuItem.Header>
|
||||
<TextBlock Text="{Binding LoginName,Source={x:Static local:UserInfoView.viewModel},TargetNullValue=登录}" Foreground="DimGray" Margin="-5,0"></TextBlock>
|
||||
</MenuItem.Header>
|
||||
<MenuItem.Icon>
|
||||
<TextBlock Text="" FontSize="16" FontFamily="{StaticResource IconFont}"></TextBlock>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<!--<MenuItem Height="29" Width="35" Header="">
|
||||
<MenuItem.Icon>
|
||||
<TextBlock Text="" FontSize="15" FontFamily="{StaticResource IconFont}"></TextBlock>
|
||||
</MenuItem.Icon>
|
||||
<MenuItem Width="120" Header="蓝色">
|
||||
<MenuItem.Icon>
|
||||
<TextBlock Text="" Foreground="Blue" FontSize="16" FontFamily="{StaticResource IconFont}"></TextBlock>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Width="120" Header="紫色">
|
||||
<MenuItem.Icon>
|
||||
<TextBlock Text="" Foreground="Purple" FontSize="16" FontFamily="{StaticResource IconFont}"></TextBlock>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Width="120" Header="黑夜">
|
||||
<MenuItem.Icon>
|
||||
<TextBlock Text="" Foreground="Black" FontSize="16" FontFamily="{StaticResource IconFont}"></TextBlock>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>-->
|
||||
<MenuItem Height="29" Width="35" Header="">
|
||||
<MenuItem.Icon>
|
||||
<TextBlock Text="" FontSize="15" FontFamily="{StaticResource IconFont}"></TextBlock>
|
||||
</MenuItem.Icon>
|
||||
<MenuItem Width="120" Header="日志" Command="{Binding OpenLogCommand}">
|
||||
<MenuItem.Icon>
|
||||
<TextBlock Text="" FontSize="16" FontFamily="{StaticResource IconFont}"></TextBlock>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Width="120" Header="帮助" Command="{Binding OpenHelpCommand}">
|
||||
<MenuItem.Icon>
|
||||
<TextBlock Text="" FontSize="16" FontFamily="{StaticResource IconFont}"></TextBlock>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Width="120" Header="关于" Command="{Binding OpenWeCommand}">
|
||||
<MenuItem.Icon>
|
||||
<TextBlock Text="" FontSize="16" FontFamily="{StaticResource IconFont}"></TextBlock>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
</StackPanel>
|
||||
</hc:Window.NonClientAreaContent>
|
||||
<!--内容-->
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
<RowDefinition Height="auto"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<!--菜单、内容-->
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<!--菜单-->
|
||||
<Border Margin="5,3" Style="{StaticResource BorderRegion}" Padding="0" BorderThickness="1">
|
||||
<hc:TransitioningContentControl TransitionMode="Left2Right">
|
||||
<hc:SideMenu ExpandMode="ShowOne" SelectionChanged="menuSelect">
|
||||
<!--内部资源样式-->
|
||||
<hc:SideMenu.Resources>
|
||||
<ResourceDictionary>
|
||||
<Style TargetType="Image">
|
||||
<Setter Property="Width" Value="24"></Setter>
|
||||
<Setter Property="Height" Value="24"></Setter>
|
||||
</Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="FontFamily" Value="{StaticResource IconFont}"></Setter>
|
||||
<Setter Property="FontSize" Value="22"></Setter>
|
||||
<Setter Property="TextAlignment" Value="Center"></Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</hc:SideMenu.Resources>
|
||||
<!--列表-->
|
||||
<hc:SideMenuItem Header="主页" Tag="主页" IsSelected="True" MinWidth="140">
|
||||
<!--<hc:SideMenuItem.Icon>
|
||||
<Image Source="/Resources/主页.png"/>
|
||||
</hc:SideMenuItem.Icon>-->
|
||||
</hc:SideMenuItem>
|
||||
<hc:SideMenuItem Header="设备" Tag="设备" Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.调试},Converter={StaticResource AuthVisConverter}}">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Image Source="/Resources/模式.png"/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
<hc:SideMenuItem Header="PLC手动" Tag="PLC">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<TextBlock Text=""/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
<hc:SideMenuItem Header="扫码枪" Tag="扫码枪">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<TextBlock Text=""/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
</hc:SideMenuItem>
|
||||
<hc:SideMenuItem Header="数据" Tag="数据" Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.调试},Converter={StaticResource AuthVisConverter}}">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Image Source="/Resources/数据.png"/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
<hc:SideMenuItem Header="统计信息" Tag="统计">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<TextBlock Text=""/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
<hc:SideMenuItem Header="详情信息" Tag="详情">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<TextBlock Text=""/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
</hc:SideMenuItem>
|
||||
<hc:SideMenuItem Header="权限" Tag="权限" Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.权限},Converter={StaticResource AuthVisConverter}}">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Image Source="/Resources/权限.png"/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
<hc:SideMenuItem Header="用户" Tag="用户" Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.调试},Converter={StaticResource AuthVisConverter}}">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<TextBlock Text=""/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
<hc:SideMenuItem Header="角色" Tag="角色" Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.调试},Converter={StaticResource AuthVisConverter}}">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<TextBlock Text=""/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
</hc:SideMenuItem>
|
||||
<hc:SideMenuItem Header="设置" Tag="设置" Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.设置},Converter={StaticResource AuthVisConverter}}">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Image Source="/Resources/设置.png"/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
</hc:SideMenu>
|
||||
</hc:TransitioningContentControl>
|
||||
</Border>
|
||||
<!--内容-->
|
||||
<Border Margin="0,3,5,3" Grid.Column="1" Style="{StaticResource BorderRegion}" Padding="0" BorderThickness="1">
|
||||
<TabControl Style="{x:Null}" Margin="1,-3,1,1" BorderThickness="0" SelectedValue="{Binding SelectedValue}" SelectedValuePath="Header" PreviewKeyDown="tabControl_PreviewKeyDown">
|
||||
<TabItem Header="主页" IsSelected="True" Height="{Binding TabItemHeight}">
|
||||
<hc:TransitioningContentControl TransitionMode="Fade">
|
||||
<View:HomeView />
|
||||
</hc:TransitioningContentControl>
|
||||
</TabItem>
|
||||
<TabItem Header="PLC" Height="{Binding TabItemHeight}">
|
||||
<hc:TransitioningContentControl TransitionMode="Fade">
|
||||
<View:DeviceView />
|
||||
</hc:TransitioningContentControl>
|
||||
</TabItem>
|
||||
<TabItem Header="扫码枪" Height="{Binding TabItemHeight}">
|
||||
<hc:TransitioningContentControl TransitionMode="Fade">
|
||||
<pi:TextBoxScanner Style="{StaticResource TextBoxExtend}" hc:InfoElement.Placeholder="鼠标点击此处激活" hc:InfoElement.Title="码信息" hc:InfoElement.TitlePlacement="Top" AutoClear="NextClear" IsAutoFocus="True" VerticalAlignment="Top"></pi:TextBoxScanner>
|
||||
</hc:TransitioningContentControl>
|
||||
</TabItem>
|
||||
<TabItem Header="统计" Height="{Binding TabItemHeight}">
|
||||
<hc:TransitioningContentControl TransitionMode="Fade">
|
||||
<View:DataChartView/>
|
||||
</hc:TransitioningContentControl>
|
||||
</TabItem>
|
||||
<TabItem Header="详情" Height="{Binding TabItemHeight}">
|
||||
<hc:TransitioningContentControl TransitionMode="Fade">
|
||||
<View:DataListView/>
|
||||
</hc:TransitioningContentControl>
|
||||
</TabItem>
|
||||
<TabItem Header="用户" Height="{Binding TabItemHeight}">
|
||||
<hc:TransitioningContentControl TransitionMode="Fade">
|
||||
<View:UserView/>
|
||||
</hc:TransitioningContentControl>
|
||||
</TabItem>
|
||||
<TabItem Header="角色" Height="{Binding TabItemHeight}">
|
||||
<hc:TransitioningContentControl TransitionMode="Fade">
|
||||
<View:RoleView/>
|
||||
</hc:TransitioningContentControl>
|
||||
</TabItem>
|
||||
<TabItem Header="设置" Height="{Binding TabItemHeight}">
|
||||
<hc:TransitioningContentControl TransitionMode="Fade">
|
||||
<View:SetView />
|
||||
</hc:TransitioningContentControl>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</Border>
|
||||
</Grid>
|
||||
<!--状态栏-->
|
||||
<Border Margin="5,3" Grid.Row="1" Grid.ColumnSpan="2" Background="AliceBlue" CornerRadius="3">
|
||||
<hc:TransitioningContentControl TransitionMode="Top2Bottom">
|
||||
<Grid>
|
||||
<StackPanel Margin="5" Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<pi:IotState Content="PLC" IsOk="False" Height="auto" Width="auto" InteriorHeight="13" Foreground="Gray" Background="Transparent"></pi:IotState>
|
||||
<pi:IotState Content="机器人" IsOk="False" Height="auto" Width="auto" InteriorHeight="13" Foreground="Gray" Background="Transparent"></pi:IotState>
|
||||
<pi:IotState Content="数据库" IsOk="False" Height="auto" Width="auto" InteriorHeight="13" Foreground="Gray" Background="Transparent"></pi:IotState>
|
||||
<pi:IotState Content="错误" IsOk="False" Height="auto" Width="auto" InteriorHeight="13" Foreground="Gray" OkBrush="PaleVioletRed" Background="Transparent"></pi:IotState>
|
||||
<pi:SyncProgressBar SyncState="OkVisible" Margin="4,0,0,0" Width="130"></pi:SyncProgressBar>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="5" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<TextBlock Margin="0,0" Text="{Binding Time,StringFormat=yyyy-MM-dd HH:mm:ss,FallbackValue=2000-01-01 00:00:00}" Foreground="#FF3A90C1" VerticalAlignment="Center"></TextBlock>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</hc:TransitioningContentControl>
|
||||
</Border>
|
||||
<!--全局提示-->
|
||||
<ScrollViewer Background="{x:Null}" Grid.Row="0" VerticalScrollBarVisibility="Auto" HorizontalAlignment="Right" VerticalAlignment="Top">
|
||||
<StackPanel Background="{x:Null}" hc:Growl.GrowlParent="True" VerticalAlignment="Top" Margin="0,10,10,10" HorizontalAlignment="Right"/>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</hc:Window>
|
55
货架标准上位机/Views/MainWindows/MainWindow2.xaml.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
using HandyControl.Controls;
|
||||
using 货架标准上位机.ViewModel;
|
||||
|
||||
namespace 货架标准上位机
|
||||
{
|
||||
/// <summary>
|
||||
/// MainWindow2.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class MainWindow2 : HandyControl.Controls.Window
|
||||
{
|
||||
public static MainViewModel viewModel = MainWindow.viewModel;
|
||||
public MainWindow2()
|
||||
{
|
||||
if (!viewModel.InitAgo())
|
||||
this.Close();
|
||||
|
||||
InitializeComponent();
|
||||
this.DataContext = viewModel;
|
||||
}
|
||||
|
||||
private void load(object sender, RoutedEventArgs e)
|
||||
{
|
||||
viewModel.Init(this);
|
||||
}
|
||||
|
||||
private void tabControl_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
//取消tabControl快捷键切换
|
||||
if (e.Key == Key.LeftCtrl || e.Key == Key.LeftCtrl || e.Key == Key.Tab)
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void menuSelect(object sender, HandyControl.Data.FunctionEventArgs<object> e)
|
||||
{
|
||||
viewModel.SelectedValue = ((SideMenuItem)e.Info).Tag.ToString();
|
||||
}
|
||||
}
|
||||
}
|
@ -72,7 +72,7 @@
|
||||
<DataGrid.ContextMenu>
|
||||
<ContextMenu Name="dgmenu1" StaysOpen="true">
|
||||
<MenuItem Header="查询当前标定值/电压值" Click="MenuItem_Click"/>
|
||||
<MenuItem Header="手动标定" Click="MenuItem_Click"/>
|
||||
<MenuItem Header="标定+设置偏移量" Click="CalibrationOffset_Click"/>
|
||||
</ContextMenu>
|
||||
</DataGrid.ContextMenu>
|
||||
<DataGrid.Columns>
|
||||
|
@ -125,5 +125,17 @@ namespace 货架标准上位机
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
private void CalibrationOffset_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//获取选中得模组
|
||||
var module = viewModel.SelectedataGridItem;
|
||||
#region 弹出输入账号密码的窗口 输入偏移量的功能
|
||||
var window = new CalibrationWindow(module.BoardId,module.Id,module.ModuleCode);
|
||||
window.Owner = Application.Current.MainWindow;
|
||||
window.Topmost = true;
|
||||
window.ShowDialog();
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
30
货架标准上位机/Views/Windows/CalibrationWindow.xaml
Normal file
@ -0,0 +1,30 @@
|
||||
<Window x:Class="货架标准上位机.CalibrationWindow"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Title="验证账号密码并标定" Height="440" Width="400" ResizeMode="NoResize" FontSize="25"
|
||||
PreviewKeyDown="Window_PreviewKeyDown" Icon="/Resources/Logo.ico" WindowStartupLocation="CenterScreen" >
|
||||
<Grid Background="AliceBlue">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="200"/>
|
||||
<RowDefinition Height="70"/>
|
||||
<RowDefinition Height="70"/>
|
||||
<RowDefinition Height="70"/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel>
|
||||
<TextBlock Margin="5" Text="PCB板ID:13" Name="tagIdTxt"></TextBlock>
|
||||
<TextBlock Margin="5" Text="模组编码:A01-R1C1" Name="moduleCodeTxt"></TextBlock>
|
||||
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
|
||||
<TextBlock Margin="5" Text="偏差值:" Width="100" ></TextBlock>
|
||||
<TextBox Margin="5" Background="White" Width="100" Name="offSetTxt" ></TextBox>
|
||||
</StackPanel>
|
||||
<TextBlock Margin="5" Width="400" TextWrapping="Wrap" Foreground="Red" FontWeight="DemiBold" Text="请确认该模组物料全部下架后再标定!"></TextBlock>
|
||||
</StackPanel>
|
||||
<ComboBox x:Name="ComboBoxId" Grid.Row="1" Margin="20,10" Height="50" Width="220" IsEditable="True" hc:InfoElement.Placeholder="请输入账号" Style="{StaticResource ComboBoxExtend}" hc:InfoElement.ContentHeight="50"></ComboBox>
|
||||
<PasswordBox x:Name="PasswordBoxPass" Grid.Row="2" Height="50" Width="220" Margin="20,10" hc:InfoElement.Placeholder="请输入密码" Style="{StaticResource PasswordBoxExtend}"></PasswordBox>
|
||||
<Button Background="DarkRed" Content="验证账号密码并标定" Width="250" Foreground="White" FontSize="24" Height="55" Grid.Row="3" HorizontalAlignment="Stretch" Click="Button_Click"></Button>
|
||||
</Grid>
|
||||
</Window>
|
213
货架标准上位机/Views/Windows/CalibrationWindow.xaml.cs
Normal file
@ -0,0 +1,213 @@
|
||||
using HandyControl.Controls;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel;
|
||||
using WCS.Model.ApiModel.StoreInfo;
|
||||
using WCS.Model.ApiModel.User;
|
||||
using 货架标准上位机.Api;
|
||||
|
||||
namespace 货架标准上位机
|
||||
{
|
||||
/// <summary>
|
||||
/// CalibrationWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class CalibrationWindow : System.Windows.Window
|
||||
{
|
||||
public int BoardId { get; set; }
|
||||
|
||||
public int ModuleId { get; set; }
|
||||
public string ModuleCode { get; set; }
|
||||
public CalibrationWindow(int boardId, int moduleId, string moduleCode)
|
||||
{
|
||||
InitializeComponent();
|
||||
BoardId = boardId;
|
||||
ModuleId = moduleId;
|
||||
tagIdTxt.Text = $"板ID:{boardId}";
|
||||
ModuleCode = moduleCode;
|
||||
moduleCodeTxt.Text = $"库位:{moduleCode}";
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
#region 输入框验证
|
||||
//偏差值输入框的验证
|
||||
var offSet = 0;
|
||||
try
|
||||
{
|
||||
offSet = Convert.ToInt32(offSetTxt.Text.Trim());
|
||||
if (offSet <= 0)
|
||||
{
|
||||
System.Windows.MessageBox.Show($"偏差值请输入大于0的自然数!", "提示");
|
||||
offSetTxt.Focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Windows.MessageBox.Show($"偏差值请输入大于0的自然数!", "提示");
|
||||
offSetTxt.Focus();
|
||||
return;
|
||||
}
|
||||
|
||||
var loginName = ComboBoxId.Text.Trim();
|
||||
var pass = PasswordBoxPass.Password.ToString();
|
||||
|
||||
if (string.IsNullOrEmpty(loginName))
|
||||
{
|
||||
System.Windows.MessageBox.Show("请输入账号!", "提示");
|
||||
ComboBoxId.Focus();
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(pass))
|
||||
{
|
||||
System.Windows.MessageBox.Show("请输入密码!", "提示");
|
||||
PasswordBoxPass.Focus();
|
||||
return;
|
||||
}
|
||||
#endregion
|
||||
try
|
||||
{
|
||||
#region 调用接口:验证账号密码
|
||||
var body = new UserLoginRequest()
|
||||
{
|
||||
UserName = loginName,
|
||||
DeviceType = LocalFile.Config.DeviceType + "标定",
|
||||
GroupNames = LocalFile.Config.GroupName,
|
||||
PassWord = pass,
|
||||
IsNoLogin = false,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseBase<UserModel>>(LocalFile.Config.ApiIpHost + "user/userLogin", body, "POST");
|
||||
if (Result != null && Result.Code != 200)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Warning(Result.Message, "提示");
|
||||
return;
|
||||
}
|
||||
else if (Result == null)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Warning("登录失败:接口调用失败!", "提示");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Result.Data.IsAdmin && !Result.Data.IsGCYF)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Warning("登录成功!权限不足", "提示");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
//此分支可以继续
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 调用接口:发送标定和设置偏移量指令
|
||||
try
|
||||
{
|
||||
var body1 = new CalibrationSetOffsetRequest()
|
||||
{
|
||||
MouduleIds = new List<int>() { ModuleId },
|
||||
OffSet = offSet,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
};
|
||||
var Result1 = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "storeInfo/calibrationSetOffset", body1, "POST");
|
||||
if (Result1 != null && Result1.Code == 200)
|
||||
{
|
||||
Growl.Success("发送标定指令成功!");
|
||||
this.Close();
|
||||
}
|
||||
else if (Result != null)
|
||||
{
|
||||
Growl.Error(Result1.Message);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Error("操作失败:" + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Windows.MessageBox.Show(ex.Message, "错误");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
Button_Click(null, null);
|
||||
}
|
||||
else if (e.Key == Key.Escape)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public string GetDataFromHttp(string data, string url, string httpMethod)
|
||||
{
|
||||
try
|
||||
{
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
|
||||
request.Method = httpMethod;
|
||||
request.ContentType = "application/json";
|
||||
if (!string.IsNullOrEmpty(data))
|
||||
{
|
||||
string strContent = data; //参数data
|
||||
using (StreamWriter dataStream = new StreamWriter(request.GetRequestStream()))
|
||||
{
|
||||
dataStream.Write(strContent);
|
||||
dataStream.Close();
|
||||
}
|
||||
}
|
||||
|
||||
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
|
||||
string encoding = response.ContentEncoding;
|
||||
if (encoding == null || encoding.Length < 1)
|
||||
{
|
||||
encoding = "UTF-8"; //默认编码
|
||||
}
|
||||
StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(encoding));
|
||||
string retString = reader.ReadToEnd();
|
||||
return retString;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class RootLogin
|
||||
{
|
||||
public int code { get; set; }
|
||||
|
||||
public string msg { get; set; }
|
||||
|
||||
public object data { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -62,7 +62,6 @@ namespace 货架标准上位机
|
||||
|
||||
public static void InitWarning()
|
||||
{
|
||||
//TODO 调用接口获取当前IP前端已接收未进行处理的异常,避免因前端重启造成异常无法处理
|
||||
#region 调用接口
|
||||
#endregion
|
||||
}
|
||||
|
@ -138,13 +138,18 @@ namespace 货架标准上位机
|
||||
scanner.ShelfCode = string.Empty;
|
||||
scanner.ModulesStr = string.Empty;
|
||||
|
||||
scanner.ScannerDisplayControl.RefreshValues(string.Empty, string.Empty);
|
||||
scanner.ScannerDisplayControl.RefreshValues(string.Empty, string.Empty, string.Empty);
|
||||
}
|
||||
client.Send(e.DataFrame.ToText());
|
||||
break;
|
||||
case WarningTypeEnum.通知自检进度:
|
||||
TextBoxLog.AddLog(warning.WarningMessage, "selfCheck", warning.CreateTime);
|
||||
client.Send(e.DataFrame.ToText());
|
||||
break;
|
||||
case WarningTypeEnum.自检未响应:
|
||||
TextBoxLog.AddLog(warning.WarningMessage, "selfCheck", warning.CreateTime);
|
||||
client.Send(e.DataFrame.ToText());
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
return;
|
||||
|
@ -2,11 +2,11 @@
|
||||
//连接不上加:SslMode=none;
|
||||
"MySql": "server=localhost;Database=db1;Uid=root;Pwd=123456;Convert Zero Datetime=True",
|
||||
//货架服务器的IP和端口号
|
||||
"ApiIpHost": "http://127.0.0.1:8888/",
|
||||
"ApiIpHost": "http://192.168.9.21:8888/",
|
||||
//WebSocket的地址
|
||||
"WebSocketUrl": "ws://127.0.0.1:7789/ws",
|
||||
"WebSocketUrl": "ws://192.168.9.21:7789/ws",
|
||||
//货架分区
|
||||
"GroupName": [ "C0" ],
|
||||
"GroupName": [ "A0-2" ],
|
||||
//设备类型 可以配置为每个电脑不一样
|
||||
"DeviceType": "WCS前端",
|
||||
//货架类型的是否开机自检
|
||||
@ -16,7 +16,7 @@
|
||||
//串口扫码枪延时
|
||||
"ScannerTimeOut": 2000,
|
||||
//盟讯公司配置-是否是盟讯
|
||||
"IsMX": false,
|
||||
"IsMX": true,
|
||||
//盟讯公司配置-获取要料单
|
||||
"GetPickOrderUrl": "http://192.168.2.23:9289/integrate/inOut/missPickListR",
|
||||
//盟讯公司配置-获取要料明细接口
|
||||
|