25 Commits

Author SHA1 Message Date
44467d3213 Merge branch '深圳海陵威' of https://gitee.com/cquni-wcs/wcs into 深圳海陵威 2025-06-16 09:22:18 +08:00
62fba9343d 非盟讯公司返回条数优化 2025-06-16 09:22:03 +08:00
664b7bfc1b 提交 配置文件 2025-04-30 09:24:25 +08:00
ff59990f10 屏蔽锁库存的功能 2025-04-09 16:09:35 +08:00
ddf94cdcf0 提供给员工手动处理货架状态不一致的按钮 2025-03-20 09:42:01 +08:00
5441648d49 1.数据库编译报错
2.修改货架IP接口
2025-03-14 17:39:52 +08:00
549a45dcf0 1.智能货架退出出库后解锁
2.数据库支持多线程
3.调整出库单据导入模板
2025-03-14 08:34:03 +08:00
f8fe33c32b 后台线程配置 2025-03-10 10:15:58 +08:00
ddc0b13813 Merge branch 'develop' of https://gitee.com/cquni-wcs/wcs into develop 2025-03-07 18:15:22 +08:00
05a66dc2d3 1.增加根据货架配置数据自动生成模组和库位的功能(纯后台)
2.发送指令异常时日志优化
2025-03-07 18:14:44 +08:00
dfe65e806d 版本更新【1.0.4】
优化盟迅公司【物料盘点】功能不显示数量异常
2024-12-26 13:44:07 +08:00
9e16a001c0 V1.0.3 软件根据硬件协议增加保存当前电压值的功能 2024-12-03 13:48:59 +08:00
963ffc4ad2 提交版本履历表 2024-12-03 11:47:49 +08:00
15ccafbd5e V1.0.2
增加硬件禁用逻辑
2024-12-03 11:42:40 +08:00
9f5fdc24e9 V1.0.2
1.增加硬件禁用逻辑
2.弹窗报错逻辑优化(入库中的错误不再发再次进入入库指令)
2024-11-28 17:59:29 +08:00
6fbc90dac3 增加硬件禁用逻辑 2024-11-28 09:25:03 +08:00
40024b339d 软件增加功能:标定时记录上一次的历史电压 2024-11-12 08:33:28 +08:00
6282ecc0c1 Merge branch 'develop' into 煤科院货架液晶显示屏 2024-11-11 18:01:57 +08:00
ec50c3986b 增加日志,优化提示 2024-11-06 14:26:42 +08:00
2f9ca87876 1.报错机制增加未扫描上架的提供库位屏蔽机制
2.库位查询增加当前屏蔽模组库位百分比查询
3.货架库位屏蔽、模组屏蔽后增加当前禁用模组库位百分比查询
2024-11-05 16:32:33 +08:00
d64dbe4c33 增加SN的显示 2024-11-05 08:39:15 +08:00
e197c32f52 复位无法清理状态!!! 2024-11-01 10:10:58 +08:00
0386f95bc2 Merge branch '软著申请修改' into 煤科院货架液晶显示屏 2024-10-31 13:58:02 +08:00
21d12b0003 完善软件逻辑 2024-10-31 13:57:51 +08:00
759ebf2c89 软件修改名称 2024-10-31 13:57:24 +08:00
42 changed files with 1488 additions and 225 deletions

View File

@ -103,6 +103,18 @@ namespace WCS.DAL.DbModels
[SugarColumn(ColumnName = "Bind_shelf_code", IsNullable = true, ColumnDescription = "串联绑定后的大货架编码")]
public string? BigShelfCode { get; set; } = string.Empty;
/// <summary>
/// 每块板子的灯数量
/// </summary>
[SugarColumn(ColumnName = "light_count", IsNullable = true, ColumnDescription = "每块板子的灯数量")]
public int LightCount { get; set; }
/// <summary>
/// 每块板子的灯数量
/// </summary>
[SugarColumn(ColumnName = "first_board_id", IsNullable = true, ColumnDescription = "左上角的板子id")]
public int FirtstBoardId { get; set; }
/// <summary>
/// 序号
/// </summary>

View File

@ -0,0 +1,141 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WCS.DAL.DbModels
{
[SugarTable("wcs_store_info_history_voltage")]
public partial class StoreInfoHistoryVoltage
{
/// <summary>
/// Id
/// </summary>
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
public int Id { get; set; }
[SugarColumn(ColumnName = "store_id")]
public int StoreId { get; set; }
/// <summary>
/// 入库的库位编码
/// </summary>
[SugarColumn(ColumnName = "store_code", Length = 50, IsNullable = false, ColumnDescription = "库位编码")]
public string StoreCode { get; set; }
/// <summary>
/// 货架类型Id
/// </summary>
[SugarColumn(ColumnName = "shelf_type_id", IsNullable = false, DefaultValue = "0", ColumnDescription = "货架类型Id")]
public int ShelfTypeId { get; set; }
/// <summary>
/// 模组Id
/// </summary>
[SugarColumn(ColumnName = "module_id", IsNullable = false, ColumnDescription = "模组Id")]
public int ModuleId { get; set; }
/// <summary>
/// 模组编号
/// </summary>
[SugarColumn(ColumnName = "module_code", Length = 50, IsNullable = false, ColumnDescription = "模组编码")]
public string ModuleCode { get; set; }
/// <summary>
/// 货架Id
/// </summary>
[SugarColumn(ColumnName = "shelf_id", IsNullable = false, ColumnDescription = "货架Id")]
public int ShelfId { get; set; }
/// <summary>
/// 货架号
/// </summary>
[SugarColumn(ColumnName = "shelf_code", Length = 50, IsNullable = false, ColumnDescription = "货架编码;货架一般按照报警灯来区分 一个报警灯指示的是一个货架")]
public string ShelfCode { get; set; }
/// <summary>
/// 板子的Id
/// </summary>
[SugarColumn(ColumnName = "board_id", IsNullable = false, ColumnDescription = "模组pcb板id")]
public int BoardId { get; set; }
/// <summary>
/// 板子上第几个灯
/// </summary>
[SugarColumn(ColumnName = "light_number", IsNullable = true, ColumnDescription = "板子上第几个灯")]
public int LightNumber { get; set; }
/// <summary>
/// 优先级;为钢网柜推荐库位预留
/// </summary>
[SugarColumn(ColumnName = "priority", IsNullable = true, ColumnDescription = "板子上第几个灯")]
public int Priority { get; set; }
/// <summary>
/// 记录一下查询时的历史是否有物料
/// </summary>
[SugarColumn(ColumnName = "current_mat_sn", Length = 200, IsNullable = true, ColumnDescription = "当前物料")]
public string CurrentMatSn { get; set; }
/// <summary>
/// 当前电压;当前电压,调试排查问题用
/// </summary>
[SugarColumn(ColumnName = "current_voltage", IsNullable = true, ColumnDescription = "当前电压值")]
public decimal CurrentVoltage { get; set; }
/// <summary>
/// 标准电压;标准电压,调试排查问题用
/// </summary>
[SugarColumn(ColumnName = "standard_voltage", IsNullable = true, ColumnDescription = "标准电压值")]
public decimal StandardVoltage { get; set; }
/// <summary>
/// 偏差电压;偏差电压,调试排查问题用
/// </summary>
[SugarColumn(ColumnName = "offset_voltage", IsNullable = true, ColumnDescription = "电压偏移值")]
public decimal OffsetVoltage { get; set; }
/// <summary>
/// 串联绑定后的大货架编码
/// </summary>
[SugarColumn(ColumnName = "Bind_shelf_code", IsNullable = true, ColumnDescription = "串联绑定后的大货架编码")]
public string? BigShelfCode { get; set; } = string.Empty;
/// <summary>
/// Row 行
/// </summary>
[SugarColumn(ColumnName = "R", Length = 10, IsNullable = true, ColumnDescription = "库位 行")]
public string R { get; set; }
/// <summary>
/// Column 列
/// </summary>
[SugarColumn(ColumnName = "C", Length = 10, IsNullable = true, ColumnDescription = "库位 列")]
public string C { get; set; }
/// <summary>
/// Column 位
/// </summary>
[SugarColumn(ColumnName = "Wei", Length = 10, IsNullable = true, ColumnDescription = "库位 位 第几个库位灯")]
public string Wei { get; set; }
/// <summary>
/// 货架的组别、区域(区分单个软件管哪些货架的,前端的配置文件配置一个组别,查询时只显示当前组别的货架)
/// </summary>
[SugarColumn(ColumnName = "group_name", Length = 50, IsNullable = false, DefaultValue = "0", ColumnDescription = "货架的组别、区域(区分单个软件管哪些货架的,前端的配置文件配置一个组别,查询时只显示当前组别的货架)")]
public string GroupName { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnName = "create_time", IsNullable = false, ColumnDescription = "创建时间")]
public DateTime CreateTime { get; set; } = DateTime.Now;
/// <summary>
/// 序号
/// </summary>
[SugarColumn(IsIgnore = true)]
public int RowNumber { get; set; }
/// <summary>
/// 是否已经选择
/// </summary>
[SugarColumn(IsIgnore = true)]
public bool IsSelected { get; set; }
}
}

View File

@ -124,6 +124,11 @@ namespace WCS.BLL.HardWare
/// </summary>
public void Reset();
/// <summary>
/// 板子与货架状态不一致的复位(未响应的复位)
/// </summary>
public void NoResponseReset();
/// <summary>
/// 货架自检
/// </summary>

View File

@ -95,6 +95,11 @@ namespace WCS.BLL.HardWare
return;
}
public void NoResponseReset()
{
return;
}
public void SetCurrentMode(Mode mode)
{

View File

@ -337,7 +337,7 @@ namespace WCS.BLL.HardWare
if (module.CurrentOutSns == null || module.CurrentOutSns.Count == 0)
{
Logs.Write($"GoInOutstoreByModule货架【{ShelfCode}】,模组【{module.ModuleCode}】,不存在需要继续出的物料,给其复位。", LogsType.Outstore);
//不需要这个模组继续亮灯了
module.GoOutOutStoreMode(TcpCleint);
Thread.Sleep(400);
@ -694,6 +694,18 @@ namespace WCS.BLL.HardWare
WarningManager.SendWarning(warningModel);
}
var currentOutStoreMatSns = CurrentOutStoreMatSNs.ToList();
//Task.Run(() =>
//{
// var matDetails = DbHelp.db.Queryable<InventoryDetail>()
// .Where(t => currentOutStoreMatSns.Contains(t.MatSN))
// .Where(t => t.IsLocked)
// .ToList();
// matDetails.ForEach(t => t.IsLocked = false);
// DbHelp.db.Updateable(matDetails).ExecuteCommand();
//});
CurrentOutStoreMatSNs.Clear();
WarningLight.CloseLight(TcpCleint);
SetCurrentMode(Mode.);
@ -911,6 +923,31 @@ namespace WCS.BLL.HardWare
SetCurrentMode(Mode.);
}
/// <summary>
/// 板子与货架状态不一致的复位(未响应的复位)
/// </summary>
public void NoResponseReset()
{
//不是待机模式不发送指令
if (CurrentMode != Mode.)
{
return;
}
//获取状态不一致的板子
var modules = Modules.Where(t => t.IsEnable && t.CurrentMode != Mode.)
.ToList();
if (modules != null && modules.Count > 0)
{
modules.ForEach(t =>
{
//复位状态不一致的板子
Logs.Write($"复位模组【{t.ModuleCode}({t.CurrentMode})】发送指令成功!");
t.Reset(TcpCleint);
});
}
}
public void QueryVoltage(int moduleId)
{
var moudle = Modules.Where(t => t.ModuleId == moduleId).First();
@ -994,7 +1031,7 @@ namespace WCS.BLL.HardWare
ExceptionMessages.Add($"模组{item.ModuleCode}未响应自检!");
}
//通信校验
var messages = notReturnList.Select(t => $"模组{t.ModuleCode}未响应自检!").ToList();
var messages = notReturnList.Select(t => $"模组{t.ModuleCode}({t.CurrentMode})未响应自检!").ToList();
var exceptionMessage = string.Join("\r\n", messages);
var warningModel = new WebSocketMessageModel()
{
@ -1698,10 +1735,51 @@ namespace WCS.BLL.HardWare
//当前库位未记录MatSn
if (string.IsNullOrEmpty(storeInfo.CurrentMatSn))
{
//该库位是需要出库的库位物料被多次取出or给了多个正常出库信号
Logs.Write($"该库位是需要出库的库位物料被反复取出or给了多个正常出库信号,库位{storeInfo.StoreCode}", LogsType.Outstore);
//暂不进行处理
return;
if (data[TcpCleint.PreFixLength + 6] == 0x0D &&
data[TcpCleint.PreFixLength + 7] == 0x0D &&
data[TcpCleint.PreFixLength + 8] == 0x0D &&
data[TcpCleint.PreFixLength + 9] == 0x0D)
{
Task.Run(() =>
{
var historyVoltage = new StoreInfoHistoryVoltage()
{
StoreId = storeInfo.Id,
StoreCode = storeInfo.StoreCode,
ShelfTypeId = storeInfo.ShelfTypeId,
ModuleId = storeInfo.ModuleId,
ModuleCode = storeInfo.ModuleCode,
ShelfId = storeInfo.ShelfId,
ShelfCode = storeInfo.ShelfCode,
BoardId = storeInfo.BoardId,
LightNumber = storeInfo.LightNumber,
Priority = storeInfo.Priority,
CurrentMatSn = storeInfo.CurrentMatSn,
CurrentVoltage = storeInfo.CurrentVoltage,
StandardVoltage = storeInfo.StandardVoltage,
OffsetVoltage = storeInfo.OffsetVoltage,
BigShelfCode = storeInfo.BigShelfCode,
R = storeInfo.R,
C = storeInfo.C,
Wei = storeInfo.Wei,
GroupName = "出库自动标定记录历史电压",
CreateTime = DateTime.Now,
};
//自动保存最新的电压值
storeInfo.CurrentVoltage = (data[TcpCleint.PreFixLength + 4] << 8) + data[TcpCleint.PreFixLength + 5];
DbHelp.db.Insertable(historyVoltage).ExecuteCommand();
DbHelp.db.Updateable(storeInfo).ExecuteCommand();
});
Thread.Sleep(10);
return;
}
else
{
//该库位是需要出库的库位物料被多次取出or给了多个正常出库信号
Logs.Write($"该库位是需要出库的库位物料被反复取出or给了多个正常出库信号,库位{storeInfo.StoreCode}", LogsType.Outstore);
//暂不进行处理
return;
}
}
//不是本次出库需要出的物料
@ -2240,7 +2318,9 @@ namespace WCS.BLL.HardWare
public void ResetReturnProcess(byte[] data, int boardId, int lightNumber)
{
var module = this.Modules.Where(t => t.BoardId == boardId && t.CurrentMode == Mode.).FirstOrDefault();
var module = this.Modules
.Where(t => t.BoardId == boardId)
.FirstOrDefault();
if (module == null)
{
return;
@ -2337,7 +2417,7 @@ namespace WCS.BLL.HardWare
{
//获取当前板所有库位
var storeInfos = DbHelp.db.Queryable<StoreInfo>()
.Where(t => t.BoardId == boardId)
.Where(t => t.BoardId == boardId && t.ShelfId == ShelfId)
.ToList();
//当前设置的板库位数
var boardStoreNumber = storeInfos.Count();

View File

@ -122,12 +122,22 @@ namespace WCS.BLL.HardWare
.OrderBy(t => t.LightNumber)
.ToList();
char[] data = "0000000000000000".ToCharArray();
//禁用
char[] dataBan = "0000000000000000".ToCharArray();
var boardStoreNumber = storeInfos.Count();
foreach (var storeInfo in storeInfos)
{
if (!string.IsNullOrEmpty(storeInfo.CurrentMatSn) && storeInfo.LightNumber > 0 && storeInfo.LightNumber <= boardStoreNumber)
{
data[storeInfo.LightNumber - 1] = '1';
//禁用
if (storeInfo.CurrentMatSn == "禁用")
{
dataBan[storeInfo.LightNumber - 1] = '1';
}
}
}
var dataStr = string.Join("", data.Reverse());
@ -136,6 +146,13 @@ namespace WCS.BLL.HardWare
GoInInstoreData[1] = Convert.ToByte(data1, 2);
GoInInstoreData[2] = Convert.ToByte(data2, 2);
//禁用
var dataBanStr = string.Join("", dataBan.Reverse());
var data1Ban = dataBanStr.Substring(8, 8);
var data2Ban = dataBanStr.Substring(0, 8);
GoInInstoreData[6] = Convert.ToByte(data1Ban, 2);
GoInInstoreData[7] = Convert.ToByte(data2Ban, 2);
tcpClient.Send(tcpClient.GenerateMessage(BoardId, GoInInstoreData));
}
@ -187,12 +204,21 @@ namespace WCS.BLL.HardWare
.OrderBy(t => t.LightNumber)
.ToList();
char[] data = "0000000000000000".ToCharArray();
//禁用功能
char[] dataBan = "0000000000000000".ToCharArray();
var boardStoreNumber = storeInfos.Count();
foreach (var storeInfo in storeInfos)
{
if (!string.IsNullOrEmpty(storeInfo.CurrentMatSn) && storeInfo.LightNumber > 0 && storeInfo.LightNumber <= boardStoreNumber)
{
data[storeInfo.LightNumber - 1] = '1';
//禁用功能
if (storeInfo.CurrentMatSn == "禁用")
{
dataBan[storeInfo.LightNumber - 1] = '1';
}
}
}
var dataStr = string.Join("", data.Reverse());
@ -201,6 +227,13 @@ namespace WCS.BLL.HardWare
CheckModeData[1] = Convert.ToByte(data1, 2);
CheckModeData[2] = Convert.ToByte(data2, 2);
//禁用功能
var dataBanStr = string.Join("", dataBan.Reverse());
var data1Ban = dataBanStr.Substring(8, 8);
var data2Ban = dataBanStr.Substring(0, 8);
CheckModeData[6] = Convert.ToByte(data1Ban, 2);
CheckModeData[7] = Convert.ToByte(data2Ban, 2);
tcpClient.Send(tcpClient.GenerateMessage(BoardId, CheckModeData));
}
@ -218,12 +251,21 @@ namespace WCS.BLL.HardWare
.ToList();
//计算物料在库的库位
char[] data = "0000000000000000".ToCharArray();
//计算禁用的库位
char[] dataBan = "0000000000000000".ToCharArray();
var storeNumber = storeInfos.Count();
foreach (var storeInfo in storeInfos)
{
if (!string.IsNullOrEmpty(storeInfo.CurrentMatSn) && storeInfo.LightNumber > 0 && storeInfo.LightNumber <= storeNumber)
{
data[storeInfo.LightNumber - 1] = '1';
//禁用
if (storeInfo.CurrentMatSn == "禁用")
{
dataBan[storeInfo.LightNumber - 1] = '1';
}
}
}
var dataStr = string.Join("", data.Reverse());
@ -232,6 +274,13 @@ namespace WCS.BLL.HardWare
GoInOutstoreModeData[1] = Convert.ToByte(data1, 2);
GoInOutstoreModeData[2] = Convert.ToByte(data2, 2);
//禁用
var dataBanStr = string.Join("", dataBan.Reverse());
var data1Ban = dataBanStr.Substring(8, 8);
var data2Ban = dataBanStr.Substring(0, 8);
GoInOutstoreModeData[6] = Convert.ToByte(data1Ban, 2);
GoInOutstoreModeData[7] = Convert.ToByte(data2Ban, 2);
//出库位置亮灯
if (outSns != null && outSns.Count > 0)
{

View File

@ -70,7 +70,7 @@ namespace WCS.BLL.Manager
DbHelp.dbLog.DbMaintenance.CreateDatabase();
Logs.Write("【初始化数据库】创建数据库", LogsType.StartBoot);
DbHelp.db.CodeFirst.InitTables(typeof(ModuleInfo), typeof(ShelfInfo), typeof(StoreInfo)
DbHelp.db.CodeFirst.InitTables(typeof(ModuleInfo), typeof(ShelfInfo), typeof(StoreInfo),typeof(StoreInfoHistoryVoltage)
, typeof(InventoryDetail), typeof(OutOrder), typeof(OutOrderDetail), typeof(OutOrderMatDetail)
, typeof(ShelfTypeInfo), typeof(MatBaseInfo), typeof(MatInfo)
, typeof(StockTakingOrder), typeof(StockTakingOrderMatDetail), typeof(InOutRecord)

View File

@ -18,105 +18,105 @@ namespace WCS.BLL.Manager
{
public static void InitBackgroundThread()
{
#region :Mes入库出库
Task.Run(() =>
{
while (true)
{
//每5秒同步一次
Thread.Sleep(5000);
try
{
var records = DbHelp.db.Queryable<InOutRecord>()
.Where(t => t.OperateTime > DateTime.Now.AddDays(-3)) //只查询回传三天内数据
.Where(t => t.IsUpload == false)
.Includes(t => t.StoreInfo)
.OrderBy(t => t.Id)
.ToList();
//入库记录上传
var inventoryDetails = records.Where(t => t.Direction == DirectionEnum.)
.WhereIF(!string.IsNullOrEmpty(LocalFile.Config.GroupName), t => t.GroupName == LocalFile.Config.GroupName)
.ToList();
if (inventoryDetails != null && inventoryDetails.Count > 0)
{
for (int i = 0; i < inventoryDetails.Count; i++)
{
try
{
//请求WMS上传入库记录
var data = new InputStockInRequest
{
materialBar = inventoryDetails[i].MatSN,
shelfCode = inventoryDetails[i].BigShelfCode,
shelfX = "R" + inventoryDetails[i].R,
shelfY = "C" + inventoryDetails[i].C,
shelfZ = inventoryDetails[i].Wei,
inUser = inventoryDetails[i].OperateUser,
inTime = inventoryDetails[i].OperateTime.ToString("yyyy-MM-dd HH:mm:ss"),
};
Guid guid = Guid.NewGuid();
var result = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.InputStockInStr, data, "POST", true);
if (result != null && (result.Code == 200))
{
//上传成功 更改上传状态
inventoryDetails[i].IsUpload = true;
DbHelp.db.Updateable(inventoryDetails[i]).ExecuteCommand();
}
//#region 定时任务:回传Mes入库出库
//Task.Run(() =>
//{
// while (true)
// {
// //每5秒同步一次
// Thread.Sleep(5000);
// try
// {
// var records = DbHelp.db.Queryable<InOutRecord>()
// .Where(t => t.OperateTime > DateTime.Now.AddDays(-3)) //只查询回传三天内数据
// .Where(t => t.IsUpload == false)
// .Includes(t => t.StoreInfo)
// .OrderBy(t => t.Id)
// .ToList();
// //入库记录上传
// var inventoryDetails = records.Where(t => t.Direction == DirectionEnum.入库)
// .WhereIF(!string.IsNullOrEmpty(LocalFile.Config.GroupName), t => t.GroupName == LocalFile.Config.GroupName)
// .ToList();
// if (inventoryDetails != null && inventoryDetails.Count > 0)
// {
// for (int i = 0; i < inventoryDetails.Count; i++)
// {
// try
// {
// //请求WMS上传入库记录
// var data = new InputStockInRequest
// {
// materialBar = inventoryDetails[i].MatSN,
// shelfCode = inventoryDetails[i].BigShelfCode,
// shelfX = "R" + inventoryDetails[i].R,
// shelfY = "C" + inventoryDetails[i].C,
// shelfZ = inventoryDetails[i].Wei,
// inUser = inventoryDetails[i].OperateUser,
// inTime = inventoryDetails[i].OperateTime.ToString("yyyy-MM-dd HH:mm:ss"),
// };
// Guid guid = Guid.NewGuid();
// var result = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.InputStockInStr, data, "POST", true);
// if (result != null && (result.Code == 200))
// {
// //上传成功 更改上传状态
// inventoryDetails[i].IsUpload = true;
// DbHelp.db.Updateable(inventoryDetails[i]).ExecuteCommand();
// }
}
catch (Exception ex)
{
// }
// catch (Exception ex)
// {
}
Thread.Sleep(200);
}
}
// }
// Thread.Sleep(200);
// }
// }
//出库记录上传
var outRecord = records.Where(t => t.Direction == DirectionEnum.)
.Where(t => !string.IsNullOrEmpty(t.OrderNumber))
.WhereIF(!string.IsNullOrEmpty(LocalFile.Config.GroupName), t => t.GroupName == LocalFile.Config.GroupName)
.ToList();
if (outRecord != null && outRecord.Count > 0)
{
for (int i = 0; i < outRecord.Count; i++)
{
try
{
var retString = string.Empty;
// //出库记录上传
// var outRecord = records.Where(t => t.Direction == DirectionEnum.出库)
// .Where(t => !string.IsNullOrEmpty(t.OrderNumber))
// .WhereIF(!string.IsNullOrEmpty(LocalFile.Config.GroupName), t => t.GroupName == LocalFile.Config.GroupName)
// .ToList();
// if (outRecord != null && outRecord.Count > 0)
// {
// for (int i = 0; i < outRecord.Count; i++)
// {
// try
// {
// var retString = string.Empty;
var data = new BunkerOutRequest()
{
materialBar = outRecord[i].MatSN,
outType = 0,
pickBillNumber = outRecord[i].OrderNumber,
qty = outRecord[i].MatQty,
};
var result = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.BunkerOutStr, data, "POST", true);
//请求成功
if (result != null && result.Code == 200)
{
//上传成功 更改上传状态
outRecord[i].IsUpload = true;
DbHelp.db.Updateable(outRecord[i]).ExecuteCommand();
}
// var data = new BunkerOutRequest()
// {
// materialBar = outRecord[i].MatSN,
// outType = 0,
// pickBillNumber = outRecord[i].OrderNumber,
// qty = outRecord[i].MatQty,
// };
// var result = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.BunkerOutStr, data, "POST", true);
// //请求成功
// if (result != null && result.Code == 200)
// {
// //上传成功 更改上传状态
// outRecord[i].IsUpload = true;
// DbHelp.db.Updateable(outRecord[i]).ExecuteCommand();
// }
}
catch (Exception ex)
{
// }
// catch (Exception ex)
// {
}
Thread.Sleep(200);
}
}
}
catch (Exception ex)
{
Logs.Write("【定时任务】上传异常:" + ex.Message);
}
}
});
#endregion
// }
// Thread.Sleep(200);
// }
// }
// }
// catch (Exception ex)
// {
// Logs.Write("【定时任务】上传异常:" + ex.Message);
// }
// }
//});
//#endregion
#region 退
Task.Run(() =>
@ -169,97 +169,97 @@ namespace WCS.BLL.Manager
});
#endregion
#region
Task.Run(() =>
{
while (true)
{
//间隔20秒同步一次
Thread.Sleep(20000);
try
{
var inventoryDetails = DbHelp.db.Queryable<InventoryDetail>()
.Where(t => t.MatName == "暂时未知")
.Where(t => t.InstoreTime > DateTime.Now.AddDays(-3))
.ToList();
if (inventoryDetails != null && inventoryDetails.Count > 0)
{
for (int i = 0; i < inventoryDetails.Count; i++)
{
try
{
//请求WMS获取物料的信息
var request = new QueryBybarRequest()
{
materialBar = inventoryDetails[i].MatSN
};
var result = ApiHelp.GetDataFromHttp<QueryBybarResponse>(LocalFile.Config.QueryBybar, request, "POST", true);
if (result != null && (result.code == 200) && result.data != null && result.data.Count() > 0)
{
//查询成功 更改数值
var instoreDto = result.data.FirstOrDefault();
inventoryDetails[i].MatCode = instoreDto.materialCode;
inventoryDetails[i].MatName = instoreDto.materialName;
inventoryDetails[i].MatBatch = instoreDto.batchNo;
inventoryDetails[i].MatSpec = instoreDto.materialSpec;
inventoryDetails[i].MatQty = (int)instoreDto.materialQty;
DbHelp.db.Updateable(inventoryDetails[i]).ExecuteCommand();
}
//#region 定时任务:海康未扫物料码的物料更新数
//Task.Run(() =>
//{
// while (true)
// {
// //间隔20秒同步一次
// Thread.Sleep(20000);
// try
// {
// var inventoryDetails = DbHelp.db.Queryable<InventoryDetail>()
// .Where(t => t.MatName == "暂时未知")
// .Where(t => t.InstoreTime > DateTime.Now.AddDays(-3))
// .ToList();
// if (inventoryDetails != null && inventoryDetails.Count > 0)
// {
// for (int i = 0; i < inventoryDetails.Count; i++)
// {
// try
// {
// //请求WMS获取物料的信息
// var request = new QueryBybarRequest()
// {
// materialBar = inventoryDetails[i].MatSN
// };
// var result = ApiHelp.GetDataFromHttp<QueryBybarResponse>(LocalFile.Config.QueryBybar, request, "POST", true);
// if (result != null && (result.code == 200) && result.data != null && result.data.Count() > 0)
// {
// //查询成功 更改数值
// var instoreDto = result.data.FirstOrDefault();
// inventoryDetails[i].MatCode = instoreDto.materialCode;
// inventoryDetails[i].MatName = instoreDto.materialName;
// inventoryDetails[i].MatBatch = instoreDto.batchNo;
// inventoryDetails[i].MatSpec = instoreDto.materialSpec;
// inventoryDetails[i].MatQty = (int)instoreDto.materialQty;
// DbHelp.db.Updateable(inventoryDetails[i]).ExecuteCommand();
// }
}
catch (Exception ex)
{
// }
// catch (Exception ex)
// {
}
Thread.Sleep(500);
}
}
// }
// Thread.Sleep(500);
// }
// }
}
catch (Exception ex)
{
Logs.Write("【定时任务】更新海康物料信息异常:" + ex.Message);
}
// }
// catch (Exception ex)
// {
// Logs.Write("【定时任务】更新海康物料信息异常:" + ex.Message);
// }
Thread.Sleep(3000);
try
{
var inventoryDetails = DbHelp.db.Queryable<InventoryDetail>()
.Where(t => t.WarehouseCode == null)
.Where(t => t.InstoreTime > DateTime.Now.AddDays(-30))
.ToList();
if (inventoryDetails != null && inventoryDetails.Count > 0)
{
for (int i = 0; i < inventoryDetails.Count; i++)
{
try
{
var url = $"http://192.168.2.23:9213/integrate/hkwsInventoryDetail/selectMaterialBar?materialBar={inventoryDetails[i].MatSN}";
var result = ApiHelp.GetDataFromHttp<SelectMaterialBarResponse>(url, null, "POST", false);
if (result != null && result.code == 200 && result.data != null && !string.IsNullOrEmpty(result.data.warehouseCode))
{
//查询成功 更改数值
inventoryDetails[i].WarehouseCode = result.data.warehouseCode;
DbHelp.db.Updateable(inventoryDetails[i]).ExecuteCommand();
}
// Thread.Sleep(3000);
// try
// {
// var inventoryDetails = DbHelp.db.Queryable<InventoryDetail>()
// .Where(t => t.WarehouseCode == null)
// .Where(t => t.InstoreTime > DateTime.Now.AddDays(-30))
// .ToList();
// if (inventoryDetails != null && inventoryDetails.Count > 0)
// {
// for (int i = 0; i < inventoryDetails.Count; i++)
// {
// try
// {
// var url = $"http://192.168.2.23:9213/integrate/hkwsInventoryDetail/selectMaterialBar?materialBar={inventoryDetails[i].MatSN}";
// var result = ApiHelp.GetDataFromHttp<SelectMaterialBarResponse>(url, null, "POST", false);
// if (result != null && result.code == 200 && result.data != null && !string.IsNullOrEmpty(result.data.warehouseCode))
// {
// //查询成功 更改数值
// inventoryDetails[i].WarehouseCode = result.data.warehouseCode;
// DbHelp.db.Updateable(inventoryDetails[i]).ExecuteCommand();
// }
}
catch (Exception ex)
{
Logs.Write("【定时任务】更新仓库代码异常:" + ex.Message);
}
Thread.Sleep(500);
}
}
}
catch (Exception ex)
{
}
}
});
#endregion
// }
// catch (Exception ex)
// {
// Logs.Write("【定时任务】更新仓库代码异常:" + ex.Message);
// }
// Thread.Sleep(500);
// }
// }
// }
// catch (Exception ex)
// {
// }
// }
//});
//#endregion
#region
//判断灯颜色和模式是否对应

View File

@ -5,6 +5,7 @@ using System.Data.OscarClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WCS.BLL.Config;
using WCS.BLL.DbModels;
using WCS.BLL.HardWare;
using WCS.DAL.Db;
@ -81,6 +82,21 @@ namespace WCS.BLL.Manager
break;
}
}
else if (solveType == SolveTypeEnum.)
{
switch (warningInManager.WarningType)
{
case WarningTypeEnum.:
DisableNoScan(warningInManager);
break;
case WarningTypeEnum.:
DisableNoScan(warningInManager);
break;
case WarningTypeEnum.:
DisableNoScan(warningInManager);
break;
}
}
else if (solveType == SolveTypeEnum.)
{
//不发指令了
@ -120,6 +136,14 @@ namespace WCS.BLL.Manager
}
}
if (warning.WarningType == WarningTypeEnum. ||
warning.WarningType == WarningTypeEnum. ||
warning.WarningType == WarningTypeEnum. ||
warning.WarningType == WarningTypeEnum.)
{
return;
}
#region
Logs.Write($"GoInRightMode", LogsType.WebSocket);
GoInRightMode(warning);
@ -143,9 +167,85 @@ namespace WCS.BLL.Manager
#region
public static void SolveNoScan(WebSocketMessageModel warning)
/// <summary>
/// 未扫描上架禁用库位
/// </summary>
/// <param name="warning"></param>
public static void DisableNoScan(WebSocketMessageModel warning)
{
#region
try
{
//获取库位
var storeInfo = DbHelp.db.Queryable<StoreInfo>()
.Where(t => t.ShelfId == warning.ShelfId)
.Where(t => t.Id == warning.StoreId)
.First();
if (storeInfo != null)
{
storeInfo.CurrentMatSn = "禁用";
DbHelp.db.Updateable(storeInfo).ExecuteCommand();
if (LocalFile.Config.IsMx)
{
var DingDing = string.Empty;
MXBackgroundThread.SendDingDingMsg($"【智能货架】库位{storeInfo.StoreCode}被 {warning.SolvedUser} “未扫描上架弹窗”屏蔽,请及时调查或维保硬件!", new List<string> { "104379", "103595" }, ref DingDing);
Logs.Write($"【智能货架】库位{storeInfo.StoreCode}被 {warning.SolvedUser} “未扫描上架弹窗”屏蔽,请及时调查或维保硬件!");
#region
Task.Run(() =>
{
var disabledStore = DbHelp.db.Queryable<StoreInfo>()
.Where(t => t.CurrentMatSn == "禁用")
.ToList();
var allStore = DbHelp.db.Queryable<StoreInfo>()
.ToList();
var disabledCount = disabledStore.Count();
var allCount = allStore.Count();
var disabledACount = disabledStore.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
var allACount = allStore.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
var disabledCCount = disabledStore.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
var allCCount = allStore.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
var disabledModule = DbHelp.db.Queryable<ModuleInfo>()
.Where(t => t.IsEnable == false)
.ToList();
var allModule = DbHelp.db.Queryable<ModuleInfo>()
.ToList();
var disabledModuleCount = disabledModule.Count();
var allModuleCount = allModule.Count();
var disabledAModuleCount = disabledModule.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
var allAModuleCount = allModule.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
var disabledCModuleCount = disabledModule.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
var allCModuleCount = allModule.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
var message = $"【智能货架】当前库位总数{allCount},禁用总数{disabledCount},禁用率{((double)disabledCount / allCount).ToString("P")}" +
$"其中A区库位总数{allACount},禁用数{disabledACount},禁用率{((double)disabledACount / allACount).ToString("P")}" +
$"C区库位总数{allCCount},禁用数{disabledCCount},禁用率{((double)disabledCCount / allCCount).ToString("P")}。\r\n" +
$"当前模组总数{allModuleCount},禁用总数{disabledModuleCount},禁用率{((double)disabledModuleCount / allModuleCount).ToString("P")}" +
$"其中A区模组总数{allAModuleCount},禁用数{disabledAModuleCount},禁用率{((double)disabledAModuleCount / allAModuleCount).ToString("P")}" +
$"C区模组总数{allCModuleCount},禁用数{disabledCModuleCount},禁用率{((double)disabledCModuleCount / allCModuleCount).ToString("P")}。";
Logs.Write(message);
var dd = string.Empty;
MXBackgroundThread.SendDingDingMsg(message, new List<string> { "104379", "103595" }, ref dd);
});
#endregion
}
}
}
catch (Exception e)
{
DbHelp.db.RollbackTran();
}
#endregion
}
public static void SolveLoss(WebSocketMessageModel warning)
@ -244,6 +344,7 @@ namespace WCS.BLL.Manager
#endregion
}
public static void GoInRightMode(WebSocketMessageModel warning)
{
try

View File

@ -52,6 +52,13 @@ namespace WCS.BLL.Services.IService
/// <returns></returns>
public Task<ResponseCommon> queryModuleVoltage(QueryModuleVoltageRequest request);
/// <summary>
/// 查询库位历史电压值-非硬件查询 仅查询软件记录的历史电压
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public Task<ResponseCommon> queryStoreInfoHistoryVoltage(QueryStoreInfoHistoryVoltageRequest request);
/// <summary>
/// 标定+设置偏移量
/// </summary>
@ -73,5 +80,6 @@ namespace WCS.BLL.Services.IService
/// <returns></returns>
public Task<ResponseCommon> disableOrEnableStore(DisableOrEnableStoreRequest request);
public Task<ResponseCommon> getDisablePercent();
}
}

View File

@ -198,11 +198,11 @@ namespace WCS.BLL.Services.Service
#region
//锁库存
inventoryDetails.ForEach(t =>
{
t.IsLocked = true;
});
var lockTask = DbHelp.db.Updateable(inventoryDetails).ExecuteCommandAsync();
//inventoryDetails.ForEach(t =>
//{
// t.IsLocked = true;
//});
//var lockTask = DbHelp.db.Updateable(inventoryDetails).ExecuteCommandAsync();
//保存数据
var order = new OutOrder()
@ -239,7 +239,7 @@ namespace WCS.BLL.Services.Service
await DbHelp.db.Insertable(orderMatDetail).ExecuteCommandAsync();
}).ToList();
await lockTask;
//await lockTask;
await Task.WhenAll(matDetailTasks);
await DbHelp.db.CommitTranAsync();
@ -476,8 +476,9 @@ namespace WCS.BLL.Services.Service
//直接查询
var recordsQueryable = DbHelp.db.Queryable<OutOrder>()
.Where(t => request.OrderExeStatus.Contains(t.OutOrderExeStatus))
.Where(t => t.CreateTime > DateTime.Now.AddDays(-2))
.WhereIF(request.IsMXPD != null, t => t.IsMXPD == request.IsMXPD)
.WhereIF(LocalFile.Config.IsMx, t => t.CreateTime > DateTime.Now.AddDays(-3))
//.WhereIF(LocalFile.Config.IsMx, t => t.CreateTime > DateTime.Now.AddDays(-3))
.WhereIF(!string.IsNullOrEmpty(LocalFile.Config.GroupName), t => t.GroupName == LocalFile.Config.GroupName);
var totalCount = await recordsQueryable.CountAsync();
@ -1071,7 +1072,7 @@ namespace WCS.BLL.Services.Service
});
outOrderDetail.ReqQty = 0;
matInventoryDetails[i].IsLocked = true;
//matInventoryDetails[i].IsLocked = true;
DbHelp.db.Updateable(matInventoryDetails[i]).ExecuteCommand();
}
else
@ -1098,7 +1099,7 @@ namespace WCS.BLL.Services.Service
CreateUser = createUser,
});
matInventoryDetails[i].IsLocked = true;
//matInventoryDetails[i].IsLocked = true;
DbHelp.db.Updateable(matInventoryDetails[i]).ExecuteCommand();
}
}
@ -1273,7 +1274,7 @@ namespace WCS.BLL.Services.Service
{
DbHelp.db.Updateable<InventoryDetail>().SetColumns(it => it.IsLocked == false).Where(it => it.MatSN == listdetail.MatSN).ExecuteCommand();
}
//灭灯
//获取需要出库的物料明细
var outOrderMatDetails = DbHelp.db.Queryable<OutOrderMatDetail>()

View File

@ -24,6 +24,11 @@ namespace WCS.BLL.Services.Service
{
public class SingleLightService : ISingleLightService
{
/// <summary>
/// 单灯 一个库位对应一个硬件
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public async Task<ResponseCommon<object>> SingleLightControl(SingleLightControlRequest request)
{
try
@ -37,12 +42,13 @@ namespace WCS.BLL.Services.Service
Message = "操作失败:没有需要控制的库位",
};
}
//对应库位
//库位编码去重
var storeCodes = request.StoreList.Select(t => t.StoreCode)
.Distinct()
.ToList();
var stores = DbHelp.db.Queryable<StoreInfo>().Where(t => storeCodes.Contains(t.StoreCode))
.ToList();
var stores = DbHelp.db.Queryable<StoreInfo>()
.Where(t => storeCodes.Contains(t.StoreCode))
.ToList();
if (stores == null || stores.Count == 0)
{
return new ResponseCommon<object>
@ -56,10 +62,11 @@ namespace WCS.BLL.Services.Service
var shelfIds = stores.Select(t => t.ShelfId).Distinct().ToList();
var shelfs = DbHelp.db.Queryable<ShelfInfo>().Where(t => shelfIds.Contains(t.Id))
.ToList();
//对应模组信息
var moduleIds = stores.Select(t => t.ModuleId).Distinct().ToList();
var modules = DbHelp.db.Queryable<ModuleInfo>().Where(t => moduleIds.Contains(t.Id))
.ToList();
.ToList();
//加载请求参数中的库位灯 板子ID和货架ID
foreach (var store in request.StoreList)

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
@ -350,7 +351,55 @@ namespace WCS.BLL.Services.Service
if (LocalFile.Config.IsMx)
{
var DingDing = string.Empty;
MXBackgroundThread.SendDingDingMsg($"【智能货架】模组{moduleInfo.ModuleCode}被屏蔽", new List<string> { "104379", "103595" }, ref DingDing);
MXBackgroundThread.SendDingDingMsg($"【智能货架】模组{moduleInfo.ModuleCode}被屏蔽(模组管理),请及时调查或维保硬件!", new List<string> { "104379", "103595" }, ref DingDing);
Logs.Write($"【智能货架】模组{moduleInfo.ModuleCode}被屏蔽(模组管理),请及时调查或维保硬件!");
#region
Task.Run(() =>
{
var disabledStore = DbHelp.db.Queryable<StoreInfo>()
.Where(t => t.CurrentMatSn == "禁用")
.ToList();
var allStore = DbHelp.db.Queryable<StoreInfo>()
.ToList();
var disabledCount = disabledStore.Count();
var allCount = allStore.Count();
var disabledACount = disabledStore.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
var allACount = allStore.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
var disabledCCount = disabledStore.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
var allCCount = allStore.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
var disabledModule = DbHelp.db.Queryable<ModuleInfo>()
.Where(t => t.IsEnable == false)
.ToList();
var allModule = DbHelp.db.Queryable<ModuleInfo>()
.ToList();
var disabledModuleCount = disabledModule.Count();
var allModuleCount = allModule.Count();
var disabledAModuleCount = disabledModule.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
var allAModuleCount = allModule.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
var disabledCModuleCount = disabledModule.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
var allCModuleCount = allModule.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
var message = $"【智能货架】当前库位总数{allCount},禁用总数{disabledCount},禁用率{((double)disabledCount / allCount).ToString("P")}" +
$"其中A区库位总数{allACount},禁用数{disabledACount},禁用率{((double)disabledACount / allACount).ToString("P")}" +
$"C区库位总数{allCCount},禁用数{disabledCCount},禁用率{((double)disabledCCount / allCCount).ToString("P")}。\r\n" +
$"当前模组总数{allModuleCount},禁用总数{disabledModuleCount},禁用率{((double)disabledModuleCount / allModuleCount).ToString("P")}" +
$"其中A区模组总数{allAModuleCount},禁用数{disabledAModuleCount},禁用率{((double)disabledAModuleCount / allAModuleCount).ToString("P")}" +
$"C区模组总数{allCModuleCount},禁用数{disabledCModuleCount},禁用率{((double)disabledCModuleCount / allCModuleCount).ToString("P")}。";
Logs.Write(message);
var dd = string.Empty;
MXBackgroundThread.SendDingDingMsg(message, new List<string> { "104379", "103595" }, ref dd);
});
#endregion
}
}
else
@ -443,6 +492,39 @@ namespace WCS.BLL.Services.Service
}
}
/// <summary>
/// 发送指令获取模组的电压值
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public async Task<ResponseCommon> queryStoreInfoHistoryVoltage(QueryStoreInfoHistoryVoltageRequest request)
{
try
{
//获取数据
var list = await DbHelp.db.Queryable<StoreInfoHistoryVoltage>()
.Where(t => request.StoreIds.Contains(t.StoreId))
.OrderByDescending(t => t.Id)
.ToListAsync();
return new ResponseCommon()
{
Code = 200,
Message = "Success",
Data = list
};
}
catch (Exception ex)
{
return new ResponseCommon()
{
Code = 300,
Message = "操作失败:" + ex.Message
};
}
}
public async Task<ResponseCommon> calibrationSetOffset(CalibrationSetOffsetRequest request)
{
try
@ -455,22 +537,67 @@ namespace WCS.BLL.Services.Service
if (shelf != null && shelf is SmartShelf)
{
var smartShelf = (SmartShelf)shelf;
#region
//2024/11/11 程心怡说刘一科长喊加的
//需求来源:微信
//软件加光衰标定值,观察光衰数据
//相当于就是你那边软件要记录一下上一次标定的值
//相当于,到时候我们这边板子上完了,我会手动用你的软件标定一次,你那边就记录数据。
var time = DateTime.Now;
var historyList = new List<StoreInfoHistoryVoltage>();
var storeInfos = DbHelp.db.Queryable<StoreInfo>()
.Where(t => t.ModuleId == module.Id)
.Where(t => t.BoardId == module.BoardId)
.OrderBy(t => t.LightNumber)
.ToList();
storeInfos.ForEach(t =>
{
historyList.Add(new StoreInfoHistoryVoltage()
{
StoreId = t.Id,
StoreCode = t.StoreCode,
ShelfTypeId = t.ShelfTypeId,
ModuleId = module.Id,
ModuleCode = t.ModuleCode,
ShelfId = t.ShelfId,
ShelfCode = t.ShelfCode,
BoardId = t.BoardId,
LightNumber = t.LightNumber,
Priority = t.Priority,
CurrentMatSn = t.CurrentMatSn,
CurrentVoltage = t.CurrentVoltage,
StandardVoltage = t.StandardVoltage,
OffsetVoltage = t.OffsetVoltage,
BigShelfCode = t.BigShelfCode,
R = t.R,
C = t.C,
Wei = t.Wei,
GroupName = t.GroupName,
CreateTime = time,
});
});
DbHelp.db.Insertable(historyList).ExecuteCommand();
#endregion
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)
{
@ -552,7 +679,56 @@ namespace WCS.BLL.Services.Service
if (LocalFile.Config.IsMx)
{
var DingDing = string.Empty;
MXBackgroundThread.SendDingDingMsg($"【智能货架】库位{storeInfo.StoreCode}被屏蔽", new List<string> { "104379", "103595" }, ref DingDing);
MXBackgroundThread.SendDingDingMsg($"【智能货架】库位{storeInfo.StoreCode}被屏蔽(库位管理),请及时调查或维保硬件!", new List<string> { "104379", "103595" }, ref DingDing);
Logs.Write($"【智能货架】库位{storeInfo.StoreCode}被屏蔽(库位管理),请及时调查或维保硬件!");
#region
Task.Run(() =>
{
var disabledStore = DbHelp.db.Queryable<StoreInfo>()
.Where(t => t.CurrentMatSn == "禁用")
.ToList();
var allStore = DbHelp.db.Queryable<StoreInfo>()
.ToList();
var disabledCount = disabledStore.Count();
var allCount = allStore.Count();
var disabledACount = disabledStore.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
var allACount = allStore.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
var disabledCCount = disabledStore.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
var allCCount = allStore.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
var disabledModule = DbHelp.db.Queryable<ModuleInfo>()
.Where(t => t.IsEnable == false)
.ToList();
var allModule = DbHelp.db.Queryable<ModuleInfo>()
.ToList();
var disabledModuleCount = disabledModule.Count();
var allModuleCount = allModule.Count();
var disabledAModuleCount = disabledModule.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
var allAModuleCount = allModule.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
var disabledCModuleCount = disabledModule.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
var allCModuleCount = allModule.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
var message = $"【智能货架】当前库位总数{allCount},禁用总数{disabledCount},禁用率{((double)disabledCount / allCount).ToString("P")}" +
$"其中A区库位总数{allACount},禁用数{disabledACount},禁用率{((double)disabledACount / allACount).ToString("P")}" +
$"C区库位总数{allCCount},禁用数{disabledCCount},禁用率{((double)disabledCCount / allCCount).ToString("P")}。\r\n" +
$"当前模组总数{allModuleCount},禁用总数{disabledModuleCount},禁用率{((double)disabledModuleCount / allModuleCount).ToString("P")}" +
$"其中A区模组总数{allAModuleCount},禁用数{disabledAModuleCount},禁用率{((double)disabledAModuleCount / allAModuleCount).ToString("P")}" +
$"C区模组总数{allCModuleCount},禁用数{disabledCModuleCount},禁用率{((double)disabledCModuleCount / allCModuleCount).ToString("P")}。";
Logs.Write(message);
var dd = string.Empty;
MXBackgroundThread.SendDingDingMsg(message, new List<string> { "104379", "103595" }, ref dd);
});
#endregion
}
//库位
@ -618,6 +794,75 @@ namespace WCS.BLL.Services.Service
}
}
public async Task<ResponseCommon> getDisablePercent()
{
try
{
#region
var disabledStore = DbHelp.db.Queryable<StoreInfo>()
.Where(t => t.CurrentMatSn == "禁用")
.ToList();
var allStore = DbHelp.db.Queryable<StoreInfo>()
.ToList();
var disabledCount = disabledStore.Count();
var allCount = allStore.Count();
var disabledACount = disabledStore.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
var allACount = allStore.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
var disabledCCount = disabledStore.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
var allCCount = allStore.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
var disabledModule = DbHelp.db.Queryable<ModuleInfo>()
.Where(t => t.IsEnable == false)
.ToList();
var allModule = DbHelp.db.Queryable<ModuleInfo>()
.ToList();
var disabledModuleCount = disabledModule.Count();
var allModuleCount = allModule.Count();
var disabledAModuleCount = disabledModule.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
var allAModuleCount = allModule.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
var disabledCModuleCount = disabledModule.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
var allCModuleCount = allModule.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
var message = $"【智能货架】当前库位总数{allCount},禁用总数{disabledCount},禁用率{((double)disabledCount / allCount).ToString("P")}" +
$"其中A区库位总数{allACount},禁用数{disabledACount},禁用率{((double)disabledACount / allACount).ToString("P")}" +
$"C区库位总数{allCCount},禁用数{disabledCCount},禁用率{((double)disabledCCount / allCCount).ToString("P")}。\r\n" +
$"当前模组总数{allModuleCount},禁用总数{disabledModuleCount},禁用率{((double)disabledModuleCount / allModuleCount).ToString("P")}" +
$"其中A区模组总数{allAModuleCount},禁用数{disabledAModuleCount},禁用率{((double)disabledAModuleCount / allAModuleCount).ToString("P")}" +
$"C区模组总数{allCModuleCount},禁用数{disabledCModuleCount},禁用率{((double)disabledCModuleCount / allCModuleCount).ToString("P")}。";
#endregion
//非盟讯公司的展示
if (LocalFile.Config.IsMx == false)
{
message = $"【智能货架】当前库位总数{allCount},禁用总数{disabledCount},禁用率{((double)disabledCount / allCount).ToString("P")}。";
}
return new ResponseCommon()
{
Code = 200,
Message = $"Success",
Data = message,
};
}
catch (Exception ex)
{
DbHelp.db.RollbackTran();
return new ResponseCommon()
{
Code = 300,
Message = $"操作失败:异常{ex.Message}"
};
}
}
#endregion
}
}

View File

@ -260,7 +260,8 @@ namespace WCS.BLL
}
catch (Exception ex)
{
Logs.Write("【发送指令时发生异常】" + ex.Message, LogsType.Instructions);
var clientIpHost = tcpClient.IP + ":" + tcpClient.Port;
Logs.Write($"【发送指令时发生异常{clientIpHost}】" + ex.Message, LogsType.Instructions);
//因异常断连时(网线已经被断了) 手动重连一次
if (ex is NotConnectedException)
{

View File

@ -61,6 +61,11 @@ namespace WCS.Model.ApiModel.MXL4
/// </summary>
public string MatBatch { get; set; }
/// <summary>
/// 物料SN
/// </summary>
public string MatSN { get; set; }
/// <summary>
/// 数量
/// </summary>

View File

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WCS.Model.ApiModel.StoreInfo
{
public class QueryStoreInfoHistoryVoltageRequest : RequestBase
{
public List<int> StoreIds { get; set; }
}
}

View File

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WCS.Model.ApiModel.StoreInfo
{
public partial class StoreInfoHistoryVoltageModel
{
public int Id { get; set; }
public string StoreCode { get; set; }
public int ShelfTypeId { get; set; }
public int ModuleId { get; set; }
public string ModuleCode { get; set; }
public int ShelfId { get; set; }
public string ShelfCode { get; set; }
public int BoardId { get; set; }
public int LightNumber { get; set; }
public int Priority { get; set; }
public string CurrentMatSn { get; set; }
public decimal CurrentVoltage { get; set; }
public decimal StandardVoltage { get; set; }
public decimal OffsetVoltage { get; set; }
public string BigShelfCode { get; set; }
public string R { get; set; }
public string C { get; set; }
public string Wei { get; set; }
public string GroupName { get; set; }
public DateTime CreateTime { get; set; }
public int RowNumber { get; set; }
public bool IsSelected { get; set; }
}
}

View File

@ -14,5 +14,6 @@ namespace WCS.Model.WebSocketModel
{
= 0,
= 1,
= 2,
}
}

View File

@ -239,6 +239,42 @@ namespace WCS.WebApi.Controllers
}
}
/// <summary>
/// 重置货架的状态 使其回到待机模式
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("noResponseReset")]
[HttpPost(Name = "noResponseReset")]
public async Task<ResponseBase> noResponseReset(RequestBase request)
{
try
{
var shelfs = new List<IShelfBase>();
shelfs = ShelfManager.Shelves
.Where(t => t.CurrentMode == Mode.)
.ToList();
foreach (var shelf in shelfs)
{
shelf.NoResponseReset();
}
return new ResponseBase()
{
Code = 200,
Message = "success",
};
}
catch (Exception ex)
{
return new ResponseBase()
{
Code = 300,
Message = ex.Message,
};
}
}
/// <summary>

View File

@ -7,6 +7,8 @@ using WCS.Model.ApiModel.StoreInfo;
using WCS.BLL.DbModels;
using WCS.Model.ApiModel.MatBaseInfo;
using WCS.DAL.DbModels;
using WCS.DAL.Db;
using WCS.BLL.Config;
namespace WCS.WebApi.Controllers
{
@ -44,7 +46,6 @@ namespace WCS.WebApi.Controllers
}
#endregion
#region
[Route("getModules")]
[HttpPost(Name = "getModules")]
@ -67,6 +68,13 @@ namespace WCS.WebApi.Controllers
return await _storeInfoService.queryModuleVoltage(request);
}
[Route("queryStoreInfoHistoryVoltage")]
[HttpPost(Name = "queryStoreInfoHistoryVoltage")]
public async Task<ResponseBase> queryStoreInfoHistoryVoltage(QueryStoreInfoHistoryVoltageRequest request)
{
return await _storeInfoService.queryStoreInfoHistoryVoltage(request);
}
[Route("calibrationSetOffset")]
[HttpPost(Name = "calibrationSetOffset")]
public async Task<ResponseBase> calibrationSetOffset(CalibrationSetOffsetRequest request)
@ -89,6 +97,179 @@ namespace WCS.WebApi.Controllers
{
return await _storeInfoService.disableOrEnableStore(request);
}
[Route("getDisablePercent")]
[HttpPost(Name = "getDisablePercent")]
public async Task<ResponseBase> getDisablePercent(DisableOrEnableStoreRequest request)
{
return await _storeInfoService.getDisablePercent();
}
[Route("genModuleStoreInfos")]
[HttpPost(Name = "genModuleStoreInfos")]
public async Task<ResponseBase> genModuleStoreInfos(RequestBase request)
{
try
{
if (request.UserName != "aaa")
{
return new ResponseBase()
{
Code = 300,
Message = "用户名不对头!无法生成模组库位"
};
}
//获取货架 此组后端管的货架
var shelfInfos = DbHelp.db.Queryable<ShelfInfo>()
.Where(t => t.GroupName == LocalFile.Config.GroupName)
.OrderBy(t => t.BigShelfCode)
.OrderBy(t => t.ShelfCode)
.ToList();
var lastBindBigShelfCode = string.Empty;
var lastColumnCount = 1;
List<ModuleInfo> moduleInfos = new List<ModuleInfo>();
//生成模组
foreach (var shelfInfo in shelfInfos)
{
var modulePreFix = shelfInfo.IsBind ? shelfInfo.BigShelfCode : shelfInfo.ShelfCode;
//不绑定或者绑定换了面 重新从1开始计数
if (shelfInfo.BigShelfCode != lastBindBigShelfCode)
{
lastColumnCount = 1;
}
lastBindBigShelfCode = shelfInfo.BigShelfCode;
for (int rowIndex = 0; rowIndex < shelfInfo.Rowcounts; rowIndex++)
{
for (int columnIndex = 0; columnIndex < shelfInfo.Columncounts; columnIndex++)
{
var moduleCode = modulePreFix + "-R" + (rowIndex + 1).ToString() + "C" + (lastColumnCount + columnIndex).ToString();
var moduleInfo = new ModuleInfo()
{
ModuleCode = moduleCode,
ShelfTypeId = shelfInfo.ShelfTypeId,
ShelfId = shelfInfo.Id,
ShelfCode = shelfInfo.ShelfCode,
BoardId = shelfInfo.FirtstBoardId++,
LightCount = shelfInfo.LightCount,
CleintIp = shelfInfo.ClientIp,
GroupName = shelfInfo.GroupName,
R = (rowIndex + 1).ToString(),
C = (lastColumnCount + columnIndex).ToString(),
Bigshelfcode = shelfInfo.BigShelfCode,
IsEnable = true,
CurrentMode = BLL.HardWare.Mode.,
};
moduleInfos.Add(moduleInfo);
}
}
lastColumnCount = lastColumnCount + shelfInfo.Columncounts;
}
DbHelp.db.Insertable(moduleInfos).ExecuteCommand();
//生成库位
moduleInfos = DbHelp.db.Queryable<ModuleInfo>()
.Where(t => t.GroupName == LocalFile.Config.GroupName)
.OrderBy(t => t.Id)
.ToList();
List<StoreInfo> storeInfos = new List<StoreInfo>();
foreach (var moduleInfo in moduleInfos)
{
for (int wei = 0; wei < moduleInfo.LightCount; wei++)
{
var storeCode = moduleInfo.ModuleCode + "-" + (wei + 1).ToString();
var stroreInfo = new StoreInfo()
{
StoreCode = storeCode,
ShelfTypeId = moduleInfo.ShelfTypeId,
ModuleId = moduleInfo.Id,
ModuleCode = moduleInfo.ModuleCode,
ShelfId = moduleInfo.ShelfId,
ShelfCode = moduleInfo.ShelfCode,
BoardId = moduleInfo.BoardId,
LightNumber = wei + 1,
Priority = 0,
CurrentMatSn = string.Empty,
CurrentVoltage = 0,
StandardVoltage = 0,
OffsetVoltage = 0,
BigShelfCode = moduleInfo.Bigshelfcode,
R = moduleInfo.R,
C = moduleInfo.C,
Wei = (wei + 1).ToString(),
GroupName = moduleInfo.GroupName
};
storeInfos.Add(stroreInfo);
}
}
DbHelp.db.Insertable(storeInfos).ExecuteCommand();
return new ResponseBase()
{
Code = 200,
Message = "生成库位成功"
};
}
catch (Exception ex)
{
return new ResponseBase()
{
Code = 300,
Message = ex.Message
};
}
}
[Route("updateClientIp")]
[HttpPost(Name = "updateClientIp")]
public async Task<ResponseBase> updateClientIp(RequestBase request)
{
try
{
if (request.UserName != "aaa")
{
return new ResponseBase()
{
Code = 300,
Message = "用户名不对头修改货架的IP。"
};
}
//获取货架 此组后端管的货架
var shelfInfos = DbHelp.db.Queryable<ShelfInfo>()
.Where(t => t.ClientIp.Contains(".225."))
.ToList();
shelfInfos.ForEach(t => t.ClientIp = t.ClientIp.Replace(".225.", ".210."));
var moduleInfos = DbHelp.db.Queryable<ModuleInfo>()
.Where(t => t.CleintIp.Contains(".225."))
.ToList();
moduleInfos.ForEach(t => t.CleintIp = t.CleintIp.Replace(".225.", ".210."));
DbHelp.db.Updateable(moduleInfos).UpdateColumns(t => new { t.CleintIp }).ExecuteCommand();
DbHelp.db.Updateable(shelfInfos).UpdateColumns(t => new { t.ClientIp }).ExecuteCommand();
return new ResponseBase()
{
Code = 200,
Message = "更新库位成功"
};
}
catch (Exception ex)
{
return new ResponseBase()
{
Code = 300,
Message = ex.Message
};
}
}
#endregion
}
}

View File

@ -39,6 +39,9 @@ namespace WebApi
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ط<EFBFBD><D8B7>߳<EFBFBD>
WarningManager.StartWarningMessageThread();
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>Ӳ<EFBFBD><D3B2>״̬<D7B4>߳<EFBFBD> <20><>ʱ<EFBFBD>˳<EFBFBD>ģʽ<C4A3><CABD><EFBFBD><EFBFBD><EFBFBD>عصƵȻ<C6B5><C8BB><EFBFBD>
MXBackgroundThread.InitBackgroundThread();
//<2F><>Ѷ<EFBFBD><D1B6>˾<EFBFBD><CBBE>̨<EFBFBD>߳<EFBFBD>
if (LocalFile.Config.IsMx)
{

View File

@ -0,0 +1,16 @@
{
"ModuleCodePatterns": null,
"IsSameMatCodeOut": true,
"DataDbPath": "Server=192.168.2.2; Database=EdgeDB; uid = sa; pwd = 8ik,9ol.; Trusted_Connection = False;",
"LogDbPath": "Server=192.168.2.2; Database=EdgeDB; uid = sa; pwd = 8ik,9ol.; Trusted_Connection = False;",
"AuthDbPath": "Server=192.168.2.2; Database=EdgeDB; uid = sa; pwd = 8ik,9ol.; Trusted_Connection = False;",
"IsAccessWMS": true,
"WMSUrl": null,
"IsResetDBOrTable": false,
"InstoreTimeOut": 5000,
"IsMx": true,
"InputStockInStr": "http://192.168.2.23:9289/integrate/instock/inputStockIn",
"BunkerOutStr": "http://192.168.2.23:9289/integrate/inOut/bunkerOut",
"QueryBybar": "http://192.168.2.23:9213/integrate/instock/queryBybar",
"GroupName": "CC"
}

BIN
版本履历表.xlsx Normal file

Binary file not shown.

View File

@ -61,6 +61,37 @@ namespace 智能仓储WCS管理系统.ViewModel
Growl.Error("打开文件夹失败。");
}
}
public ICommand NoResponseResetCommand { get => new DelegateCommand(NoResponseReset); }
/// <summary>
/// 打开用户
/// </summary>
public void NoResponseReset()
{
var result = HandyControl.Controls.MessageBox.Show("此功能用于“未成功退出入库、出库”等异常提示\r\n建议所有货架都处于待机模式时使用继续复位请点击[确定]", "提示", MessageBoxButton.OKCancel);
if (result == MessageBoxResult.Cancel)
return;
#region
var body = new RequestBase()
{
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
};
var Result = ApiHelp.GetDataFromHttp<ResponseBase>(LocalFile.Config.ApiIpHost + "home/noResponseReset", body, "POST");
if (Result != null && Result.Code == 200)
{
Growl.Warning("已给状态不一致的板子发送复位指令,建议点击第一个按钮[货架状态初始化]重置所有货架状态!");
}
else if (Result != null)
{
Growl.Warning(Result.Message);
}
else
{
Growl.Warning("调用接口失败!");
}
#endregion
}
}
public class DeviceReadModel : BindableBase

View File

@ -102,7 +102,9 @@ namespace 智能仓储WCS管理系统.ViewModel
}
else if (Result != null && Result.Code == 200 && (Result.Data == null || Result.Data.Lists == null || Result.Data.Lists.Count == 0))
{
MessageBox.Show($"未查询到领料明细!所推荐物料在此货架上不存在,请确认是否在其他货架上!\r\n{string.Join(",\r\n", matSns)}");
var content = $"MES/WMS系统按先进先出推荐物料条码在此货架上不存在,请确认物料是否在其他货架B区或者确认是否是物料上架后丢失复制物料条码后在[出入记录]功能中通过物料SN查询确认是否丢失如果确认是此货架上丢失重新上架再次进行出库操作具体条码如下\r\n{string.Join(",\r\n", matSns)}";
//MessageBox.Show($"未查询到领料明细!所推荐物料在此货架上不存在,请确认是否在其他货架上!或者是否已经丢失?(复制物料条码后在[出入记录]功能中即可查询)\r\n{string.Join(",\r\n", matSns)}");
TipView.Show(content, "提示", true);
DataGridItemSource = null;
}
else
@ -120,12 +122,12 @@ namespace 智能仓储WCS管理系统.ViewModel
}
else if (result != null && result.code == 200 && (result.data == null || result.data.Count == 0))
{
Growl.Warning("未查询到物料明细MES推荐物料明细为空");
Growl.Warning("未查询到物料明细MES推荐物料明细为空请确认该单据是否已发或咨询MES系统相关负责人");
DataGridItemSource = null;
}
else
{
Growl.Warning("未查询到领料明细请求MES接口失败");
Growl.Warning("未查询到领料明细请求MES接口失败请确认该单据是否已发或咨询MES系统相关负责人");
DataGridItemSource = null;
}
});

View File

@ -6,10 +6,12 @@ using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using WCS.BLL.DbModels;
using WCS.Model;
using WCS.Model.ApiModel.Home;
using WCS.Model.ApiModel.MatBaseInfo;
using WCS.Model.ApiModel.MatInventoryDetail;
using WCS管理系统.Api;
@ -19,6 +21,46 @@ namespace 智能仓储WCS管理系统.ViewModels
public class OutInventoryImportDucumentViewModel : BindableBase
{
#region Property
private List<ShelfTypeModel> shelfTypeItems;
public List<ShelfTypeModel> 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<PageQueryResponse<ShelfTypeModel>>(LocalFile.Config.ApiIpHost + "home/getShelfTypes", body, "POST");
if (Result != null && Result.Data != null && Result.Data.Lists.Count() > 0)
{
ShelfTypeItems = Result.Data.Lists;
SelectedShelfTypeItem = Result.Data.Lists.First();
}
});
}
private ShelfTypeModel selectedShelfTypeItem;
public ShelfTypeModel SelectedShelfTypeItem
{
get { return selectedShelfTypeItem; }
set
{
SetProperty(ref selectedShelfTypeItem, value);
}
}
private ObservableCollection<MatInventorySummaryModel> dataGridItemSource;
public ObservableCollection<MatInventorySummaryModel> DataGridItemSource
{
@ -49,9 +91,10 @@ namespace 智能仓储WCS管理系统.ViewModels
#region
Microsoft.Win32.SaveFileDialog sfd = new Microsoft.Win32.SaveFileDialog();
sfd.Filter = ".xlsx文件(*.xlsx)|*.xlsx";
sfd.FileName = "出库导入模板";
sfd.FileName = "出库单据导入模板";
sfd.Title = "请选择文件保存地址";
sfd.OverwritePrompt = true;
if (sfd.ShowDialog() != true)
{
return;
@ -65,6 +108,8 @@ namespace 智能仓储WCS管理系统.ViewModels
try
{
File.Copy(sourceFile, destinationFile, true); // true表示如果目标文件存在则覆盖它
// 设置文件的最后写入时间为当前时间
File.SetLastWriteTime(destinationFile, DateTime.Now);
Growl.Success("文件下载成功!");
}
catch (IOException ioEx)
@ -174,6 +219,8 @@ namespace 智能仓储WCS管理系统.ViewModels
{
var body = new SysOutOrderByMatCodeRequest()
{
ShelfTypeId = SelectedShelfTypeItem.Id,
ShelfTypeName = SelectedShelfTypeItem.ShelfTypeName,
OrderType = "出库",
OrderSource = "WCS前端",
ItemList = DataGridItemSource.Select(t => new MatCodeItemList()

View File

@ -230,6 +230,37 @@ namespace 智能仓储WCS管理系统.ViewModel
}
#endregion
}
public ICommand BtnDisablePercentCommand { get => new DelegateCommand(DisablePercent); }
public void DisablePercent()
{
#region
try
{
var body = new DisableOrEnableStoreRequest()
{
};
var Result = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "storeInfo/getDisablePercent", body, "POST");
if (Result != null && Result.Code == 200)
{
HandyControl.Controls.MessageBox.Show(Result.Data.ToString());
}
else if (Result != null)
{
Growl.Warning(Result.Message);
}
else
{
Growl.Warning("操作失败:请重试!");
}
}
catch (Exception ex)
{
Growl.Error("操作失败:" + ex.Message);
}
#endregion
}
#endregion
#region PageOperation

View File

@ -18,6 +18,11 @@
<Button Margin="5,3" Padding="30,0" Name="resetShelf" Content="货架状态初始化" Command="{Binding ResetAllShelfCommand}"></Button>
<Button Margin="5,3" Padding="30,0" Content="打开打印模板路径" Command="{Binding BarcodePrintTemplateCommand}"></Button>
<Button Margin="5,3"
Padding="30,0"
Content="未成功退出模式的模组复位"
Command="{Binding NoResponseResetCommand}"></Button>
</StackPanel>
</GroupBox>

View File

@ -168,7 +168,7 @@
<DataGridTextColumn IsReadOnly="True" Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="库位" Binding="{Binding StoreCode}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="物料编码" Binding="{Binding MatCode}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="数量" Binding="{Binding OriginalQty}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="数量" Binding="{Binding MatQty}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="物料名称" Binding="{Binding MatName}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" MaxWidth="300" Header="规格" Binding="{Binding MatSpec}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="批次" Binding="{Binding MatBatch}"></DataGridTextColumn>

View File

@ -34,7 +34,7 @@
<Border Background="AliceBlue" Padding="0">
<Grid >
<StackPanel Margin="3" Orientation="Horizontal">
<StackPanel Margin="3" Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
<StackPanel Margin="3" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
<TextBlock VerticalAlignment="Center"
Text="货架类型:" FontSize="22" >
</TextBlock>

View File

@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:hc="https://handyorg.github.io/handycontrol"
Height="500" Width="850" WindowStyle="None" Background="{x:Null}" BorderThickness="0" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Opacity="1">
Height="500" Width="850" WindowStyle="None" Loaded="Window_Loaded" Background="{x:Null}" BorderThickness="0" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Opacity="1">
<hc:Window.Resources>
<ResourceDictionary>
<Style TargetType="Button" BasedOn="{StaticResource ButtonDefault}">
@ -34,6 +34,19 @@
<Border Background="AliceBlue" Padding="0">
<Grid >
<StackPanel Margin="3" Orientation="Horizontal">
<StackPanel Margin="3" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
<TextBlock VerticalAlignment="Center"
Text="货架类型:" FontSize="22" >
</TextBlock>
<ComboBox
IsEnabled="{Binding ShelfTypeIsEnabled}"
VerticalAlignment="Center"
DisplayMemberPath="ShelfTypeName"
ItemsSource="{Binding ShelfTypeItems}"
SelectedItem="{Binding SelectedShelfTypeItem}"
FontSize="22"
IsEditable="False"/>
</StackPanel>
<Button MinHeight="40" FontSize="18" Margin="3"
Content="&#xe613;导入" FontFamily="{StaticResource IconFont}"
Foreground="WhiteSmoke"

View File

@ -59,5 +59,10 @@ namespace 智能仓储WCS管理系统
this.DialogResult = false;
this.Close();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
viewModel.InitShelfTypeItems();
}
}
}

View File

@ -67,6 +67,11 @@
Grid.Column="9" MinHeight="40" FontSize="18" Content="&#xe652; 重置" FontFamily="{StaticResource IconFont}"
Command="{Binding BtnResetCommand}">
</Button>
<Button Style="{StaticResource ButtonWarning}" hc:BorderElement.CornerRadius="12"
Grid.Column="8" Grid.Row="1" MinHeight="30" FontSize="18" Content="&#xe652; 屏蔽率" FontFamily="{StaticResource IconFont}"
Command="{Binding BtnDisablePercentCommand}">
</Button>
</Grid>
</Border>
@ -85,6 +90,11 @@
SelectionChanged="dataGrid_SelectionChanged"
RowHeight="39"
AutoGenerateColumns="False" FontSize="13">
<DataGrid.ContextMenu>
<ContextMenu Name="dgmenu1" StaysOpen="true">
<MenuItem Header="查询历史电压" Click="MenuItem_Click"/>
</ContextMenu>
</DataGrid.ContextMenu>
<DataGrid.Columns>
<DataGridTextColumn IsReadOnly="True" Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="货架编码" Binding="{Binding ShelfCode}"></DataGridTextColumn>

View File

@ -1,4 +1,5 @@
using Ping9719.WpfEx;
using HandyControl.Controls;
using Ping9719.WpfEx;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@ -14,7 +15,10 @@ using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using WCS.Model.ApiModel.StoreInfo;
using WCS.Model;
using WCS管理系统.ViewModel;
using WCS管理系统.Api;
namespace WCS管理系统
{
@ -86,5 +90,50 @@ namespace 智能仓储WCS管理系统
{
;
}
private void MenuItem_Click(object sender, RoutedEventArgs e)
{
//先获取选中的模组
var storeInfo = viewModel.SelectedataGridItem;
#region
try
{
var body = new QueryStoreInfoHistoryVoltageRequest()
{
StoreIds = new List<int>() { storeInfo.Id },
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
};
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<List<StoreInfoHistoryVoltageModel>>>(LocalFile.Config.ApiIpHost + "storeInfo/queryStoreInfoHistoryVoltage", body, "POST");
if (Result != null && Result.Code == 200)
{
if (Result.Data == null || Result.Data.Count == 0)
{
Growl.Success("查询成功!该库位没有历史电压值数据!");
return;
}
else
{
Growl.Success("查询成功!请查看弹窗内数据!");
var window = new StoreInfoHistoryVoltageWindow(Result.Data, storeInfo.StoreCode);
window.ShowDialog();
}
}
else if (Result != null)
{
Growl.Success(Result.Message);
}
}
catch (Exception ex)
{
Growl.Warning("查询失败:" + ex.Message);
}
finally
{
}
#endregion
}
}
}

View File

@ -133,7 +133,7 @@ namespace 智能仓储WCS管理系统
Growl.Success("发送标定指令成功!");
this.Close();
}
else if (Result != null)
else if (Result1 != null)
{
Growl.Error(Result1.Message);
}

View File

@ -0,0 +1,27 @@
<Window x:Class="智能仓储WCS管理系统.StoreInfoHistoryVoltageWindow"
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="650" Width="660" ResizeMode="NoResize" FontSize="25"
Icon="/Resources/Logo.ico" WindowStartupLocation="CenterScreen" >
<Grid Background="AliceBlue">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<TextBlock Text="库位编码" Name="storeCodeTxt" FontSize="40" HorizontalAlignment="Center"></TextBlock>
<DataGrid Grid.Row="1" Name="dataGrid" FontSize="15" AutoGenerateColumns="False" HeadersVisibility="All" CanUserAddRows="False">
<DataGrid.Columns>
<DataGridTextColumn Header="电压标准值" Binding="{Binding StandardVoltage}" Width="*"/>
<DataGridTextColumn Header="电压偏移值" Binding="{Binding OffsetVoltage}" Width="*"/>
<DataGridTextColumn Header="电压当前值" Binding="{Binding CurrentVoltage}" Width="*"/>
<DataGridTextColumn Header="记录时间" Binding="{Binding CreateTime,StringFormat='yyyy-MM-dd HH:mm:ss'}" Width="1.5*"/>
</DataGrid.Columns>
</DataGrid>
<Button Content="关闭" Height="45" FontSize="28" Grid.Row="2" Click="Button_Click"></Button>
</Grid>
</Window>

View File

@ -0,0 +1,44 @@
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 WCS管理系统.Api;
namespace WCS管理系统
{
/// <summary>
/// CalibrationWindow.xaml 的交互逻辑
/// </summary>
public partial class StoreInfoHistoryVoltageWindow : System.Windows.Window
{
public StoreInfoHistoryVoltageWindow(List<StoreInfoHistoryVoltageModel> list,string storeCode)
{
InitializeComponent();
dataGrid.ItemsSource = list;
this.storeCodeTxt.Text = storeCode;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
}
}

View File

@ -32,7 +32,7 @@
<TextBlock Margin="5,0" Text="{Binding Title, FallbackValue=标题}" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<Button Grid.Column="1" Visibility="{Binding IsClose,Converter={StaticResource Boolean2VisibilityHiddenConverter}}" Style="{StaticResource ButtonIcon}" hc:IconElement.Geometry="{StaticResource CloseGeometry}" Click="closeClick"/>
</Grid>
<TextBlock Margin="5,0" Grid.Row="1" Text="{Binding Content, FallbackValue=我是内容}" FontSize="18" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<TextBox Margin="5,0" Grid.Row="1" Text="{Binding Content, Mode=OneWay}" FontSize="18" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<hc:UniformSpacingPanel x:Name="spacingPanel" Grid.Row="2" Margin="5,0,5,10" Spacing="10" Width="auto" ChildWrapping="Wrap" HorizontalAlignment="Center">
<Button Content="确认"/>
<Button Content="取消"/>

View File

@ -66,6 +66,19 @@ namespace 智能仓储WCS管理系统
return Show(content, title, new string[] { "确认", "忽略" }, _warning, isVisCloseBut);
}
/// <summary>
/// 显示提示框
/// </summary>
/// <param name="content">内容</param>
/// <param name="title">标题</param>
/// <param name="isVisCloseBut">界面右上角是否显示关闭按钮</param>
/// <returns>点击的按钮文本</returns>
public static WarningWindow ShowNoScanError(string content, string title, WebSocketMessageModel _warning, bool isVisCloseBut = true, Window owner = null)
{
content = content + "\r\n确认对应无物料可点击[屏蔽库位]按钮进行库位屏蔽!";
return Show(content, title, new string[] { "确认","屏蔽库位", "忽略" }, _warning, isVisCloseBut);
}
/// <summary>
/// 显示提示框
/// </summary>
@ -92,6 +105,14 @@ namespace 智能仓储WCS管理系统
Content = item,
};
button.Margin = new Thickness(10, 0, 10, 0);
button.FontSize = 18;
if (item == "屏蔽库位")
{
button.Foreground = Brushes.Red;
button.FontWeight = FontWeights.DemiBold;
//WaningWindow.Content = WaningWindow.Content + "\r\n确认对应无物料可点击[屏蔽库位]按钮进行库位屏蔽!";
}
button.Click += (s, e) =>
{
clikename = ((Button)s).Content.ToString();
@ -99,10 +120,26 @@ namespace 智能仓储WCS管理系统
#region /
try
{
var solveType = SolveTypeEnum.;
switch (clikename)
{
case "确认":
solveType = SolveTypeEnum.;
break;
case "忽略":
solveType = SolveTypeEnum.;
break;
case "屏蔽库位":
solveType = SolveTypeEnum.;
break;
default:
solveType = SolveTypeEnum.;
break;
}
var body = new SolveWarningRequest()
{
Guid = _warning.Guid,
SolveType = clikename == "确认" ? SolveTypeEnum. : SolveTypeEnum.,
SolveType = solveType,
UserName = LocalStatic.CurrentUser,
DeviceType = "WCS前端",
};

View File

@ -26,7 +26,14 @@ namespace 智能仓储WCS管理系统
Logs.Write($"【添加报警信息弹窗】报警类型:{warningModel.WarningType} 报警信息:{warningModel.WarningMessage} Guid:{warningModel.Guid}", LogsType.WebSocket);
Application.Current.Dispatcher.Invoke(new Action(() =>
{
warnings.Add(WarningWindow.Show(warningModel.WarningMessage, "报警信息", warningModel));
if (warningModel.WarningType == WarningTypeEnum. || warningModel.WarningType == WarningTypeEnum. || warningModel.WarningType == WarningTypeEnum.)
{
warnings.Add(WarningWindow.ShowNoScanError(warningModel.WarningMessage, "报警信息", warningModel));
}
else
{
warnings.Add(WarningWindow.Show(warningModel.WarningMessage, "报警信息", warningModel));
}
}));
}
}

View File

@ -8,8 +8,8 @@
<LangVersion>latest</LangVersion>
<Company>重庆盟讯电子科技有限公司</Company>
<Copyright>Copyright © 2024</Copyright>
<AssemblyVersion>1.0.0</AssemblyVersion>
<FileVersion>1.0.0</FileVersion>
<AssemblyVersion>1.0.4</AssemblyVersion>
<FileVersion>1.0.4</FileVersion>
<ApplicationIcon>Resources\Logo.ico</ApplicationIcon>
<Authors>重庆盟讯电子科技有限公司</Authors>
<Product>智能仓储WCS管理系统</Product>
@ -84,12 +84,12 @@
<Resource Include="Resources\Logo.ico" />
<Resource Include="Resources\Logo.png" />
<Resource Include="Resources\主页.png" />
<Resource Include="Resources\入库.png"/>
<Resource Include="Resources\出库.png"/>
<Resource Include="Resources\盘点.png"/>
<Resource Include="Resources\查询.png"/>
<Resource Include="Resources\货架.png"/>
<Resource Include="Resources\物料.png"/>
<Resource Include="Resources\入库.png" />
<Resource Include="Resources\出库.png" />
<Resource Include="Resources\盘点.png" />
<Resource Include="Resources\查询.png" />
<Resource Include="Resources\货架.png" />
<Resource Include="Resources\物料.png" />
<Resource Include="Resources\权限.png" />
<Resource Include="Resources\调试.png" />
</ItemGroup>
@ -104,6 +104,9 @@
<None Update="Excel\出库单据导入模板.xlsx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Excel\出库导入模板.xlsx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Excel\物料管理导入模板.xlsx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>