去除不需要的内容

This commit is contained in:
hehaibing-1996
2025-01-08 16:01:51 +08:00
parent 0576085e37
commit d90378f820
19 changed files with 4 additions and 1060 deletions

View File

@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace WCS.BLL.DbModels
{
///<summary>
///物料信息
///物料明细
///</summary>
[SugarTable("wcs_mat_info")]
public class MatInfo

View File

@ -1,22 +0,0 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WCS.BLL.DbModels
{
/// <summary>
/// 货架类型
/// </summary>
[SugarTable("wcs_shelf_type")]
public class ShelfTypeInfo
{
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
public int Id { get; set; }
[SugarColumn(ColumnName = "shelf_type_name", Length = 50, IsNullable = true, ColumnDescription = "货架类型名称")]
public string ShelfTypeName { get; set; }
}
}

View File

@ -1,141 +0,0 @@
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

@ -1,121 +0,0 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WCS.BLL.DbModels.Task;
using WCS.DAL.DbModels;
namespace WCS.BLL.DbModels
{
/// <summary>
/// 当前正在进行中的任务
/// </summary>
[SugarTable("wcs_current_task")]
public class CurrentTask
{
/// <summary>
/// 主键 自增Id
/// </summary>
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
public int Id { get; set; }
#region
/// <summary>
/// 入库的库位表ID
/// </summary>
[SugarColumn(ColumnName = "store_id", IsNullable = false, ColumnDescription = "库位ID")]
public int StoreId { get; set; }
/// <summary>
/// 入库的库位编码
/// </summary>
[SugarColumn(ColumnName = "store_code", Length = 50, IsNullable = false, ColumnDescription = "库位编码")]
public string StoreCode { get; set; }
[Navigate(NavigateType.OneToOne, nameof(StoreId))]
public StoreInfo StoreInfo { get; set; }
#endregion
#region
/// <summary>
/// 任务Id
/// </summary>
[SugarColumn(ColumnName = "task_id", IsNullable = false, ColumnDescription = "任务Id同一个库位只支持1-7")]
public int TaskID { get; set; } = 0;
/// <summary>
/// Guid
/// </summary>
[SugarColumn(ColumnName = "guid", IsNullable = false, ColumnDescription = "Guid 系统那边任务的唯一ID")]
public Guid Guid { get; set; }
/// <summary>
/// 任务模式:入库模式 = 0, 出库模式 = 1, 盘点模式 = 2
/// </summary>
[SugarColumn(ColumnName = "task_mode", IsNullable = false, ColumnDescription = "任务模式:入库模式 = 0, 出库模式 = 1, 盘点模式 = 2")]
public TaskModeEnum TaskMode { get; set; }
/// <summary>
/// 出库单据号
/// </summary>
[SugarColumn(ColumnName = "order_number", Length = 50, IsNullable = false, ColumnDescription = "出库单据号")]
public string OrderNumber { get; set; }
/// <summary>
/// 按钮颜色
/// </summary>
[SugarColumn(ColumnName = "button_color", IsNullable = false, ColumnDescription = "按钮颜色 红色 = 1, 绿色 = 2, 黄色 = 3, 蓝色 = 4, 紫色 = 5, 青色 = 6, 白色 = 7,")]
public ButtonColorEnum ButtonColor { get; set; }
/// <summary>
/// 物料编码
/// </summary>
[SugarColumn(ColumnName = "mat_code", Length = 100, IsNullable = true, ColumnDescription = "物料编号")]
public string MatCode { get; set; }
/// <summary>
/// 物料名称
/// </summary>
[SugarColumn(ColumnName = "mat_name", Length = 150, IsNullable = true, ColumnDescription = "物料名称")]
public string MatName { get; set; }
/// <summary>
/// 物料规格
/// </summary>
[SugarColumn(ColumnName = "mat_spec", Length = 150, IsNullable = true, ColumnDescription = "物料规格")]
public string MatSpec { get; set; }
/// <summary>
/// 物料批次
/// </summary>
[SugarColumn(ColumnName = "mat_batch", Length = 150, IsNullable = true, ColumnDescription = "物料批次")]
public string MatBatch { get; set; }
/// <summary>
/// 物料数量
/// </summary>
[SugarColumn(ColumnName = "qty", IsNullable = false, ColumnDescription = "目标数量")]
public int Qty { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnName = "create_time", IsNullable = false, ColumnDescription = "创建时间")]
public DateTime CreateTime { get; set; } = DateTime.Now;
/// <summary>
/// 任务是否被挂起 用于入库时取消入库,还没切换库位时 认为任务被挂起 同时只支持一个库位的任务被挂起
/// </summary>
[SugarColumn(ColumnName = "is_suspended", IsNullable = false, ColumnDescription = "任务是否被挂起 用于入库时取消入库,还没切换库位时 认为任务被挂起")]
public bool IsSuspended { get; set; } = false;
/// <summary>
/// 任务是否已发送至标签
/// </summary>
[SugarColumn(ColumnName = "is_sended", IsNullable = false, ColumnDescription = "任务是否已发送至标签")]
public bool IsSended { get; set; } = false;
#endregion
}
}

View File

@ -1,125 +0,0 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WCS.BLL.DbModels.Task;
using WCS.DAL.DbModels;
namespace WCS.BLL.DbModels
{
/// <summary>
/// 已完成未提交的任务
/// </summary>
[SugarTable("wcs_finished_task")]
public class FinishedTask
{
/// <summary>
/// 主键 自增Id
/// </summary>
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
public int Id { get; set; }
#region
/// <summary>
/// 入库的库位表ID
/// </summary>
[SugarColumn(ColumnName = "store_id", IsNullable = false, ColumnDescription = "库位ID")]
public int StoreId { get; set; }
/// <summary>
/// 入库的库位编码
/// </summary>
[SugarColumn(ColumnName = "store_code", Length = 50, IsNullable = false, ColumnDescription = "库位编码")]
public string StoreCode { get; set; }
[Navigate(NavigateType.OneToOne, nameof(StoreId))]
public StoreInfo StoreInfo { get; set; }
#endregion
#region
/// <summary>
/// 任务Id
/// </summary>
[SugarColumn(ColumnName = "task_id", IsNullable = false, ColumnDescription = "任务Id同一个库位只支持1-7")]
public int TaskID { get; set; }
/// <summary>
/// Guid
/// </summary>
[SugarColumn(ColumnName = "guid", IsNullable = false, ColumnDescription = "Guid 系统那边任务的唯一ID")]
public Guid Guid { get; set; }
/// <summary>
/// 任务模式:入库模式 = 0, 出库模式 = 1, 盘点模式 = 2
/// </summary>
[SugarColumn(ColumnName = "task_mode", IsNullable = false, ColumnDescription = "任务模式:入库模式 = 0, 出库模式 = 1, 盘点模式 = 2")]
public TaskModeEnum TaskMode { get; set; }
/// <summary>
/// 出库单据号
/// </summary>
[SugarColumn(ColumnName = "order_number", Length = 50, IsNullable = false, ColumnDescription = "出库单据号")]
public string OrderNumber { get; set; }
/// <summary>
/// 按钮颜色
/// </summary>
[SugarColumn(ColumnName = "button_color", IsNullable = false, ColumnDescription = "按钮颜色 红色 = 1, 绿色 = 2, 黄色 = 3, 蓝色 = 4, 紫色 = 5, 青色 = 6, 白色 = 7,")]
public ButtonColorEnum ButtonColor { get; set; }
/// <summary>
/// 物料编码
/// </summary>
[SugarColumn(ColumnName = "mat_code", Length = 100, IsNullable = true, ColumnDescription = "物料编号")]
public string MatCode { get; set; }
/// <summary>
/// 物料名称
/// </summary>
[SugarColumn(ColumnName = "mat_name", Length = 150, IsNullable = true, ColumnDescription = "物料名称")]
public string MatName { get; set; }
/// <summary>
/// 物料规格
/// </summary>
[SugarColumn(ColumnName = "mat_spec", Length = 150, IsNullable = true, ColumnDescription = "物料规格")]
public string MatSpec { get; set; }
/// <summary>
/// 物料批次
/// </summary>
[SugarColumn(ColumnName = "mat_batch", Length = 150, IsNullable = true, ColumnDescription = "物料批次")]
public string MatBatch { get; set; }
/// <summary>
/// 物料数量
/// </summary>
[SugarColumn(ColumnName = "qty", IsNullable = false, ColumnDescription = "目标数量")]
public int Qty { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnName = "create_time", IsNullable = false, ColumnDescription = "创建时间")]
public DateTime CreateTime { get; set; } = DateTime.Now;
/// <summary>
/// 创建人
/// </summary>
[SugarColumn(ColumnName = "create_user", Length = 100, IsNullable = true, ColumnDescription = "创建人")]
public string CreateUser { get; set; } = string.Empty;
/// <summary>
/// 完成时物料数量
/// </summary>
[SugarColumn(ColumnName = "finish_qty", IsNullable = false, ColumnDescription = "完成数量")]
public int FinishQty { get; set; } = 0;
/// <summary>
/// 完成时间
/// </summary>
[SugarColumn(ColumnName = "finish_time", IsNullable = false, ColumnDescription = "完成时间")]
public DateTime FinishTime { get; set; } = DateTime.Now;
#endregion
}
}

View File

@ -1,125 +0,0 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WCS.BLL.DbModels.Task;
using WCS.DAL.DbModels;
namespace WCS.BLL.DbModels
{
/// <summary>
/// 已完成已提交的历史任务
/// </summary>
[SugarTable("wcs_uploaded_task")]
public class UploadededTask
{
/// <summary>
/// 主键 自增Id
/// </summary>
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
public int Id { get; set; }
#region
/// <summary>
/// 入库的库位表ID
/// </summary>
[SugarColumn(ColumnName = "store_id", IsNullable = false, ColumnDescription = "库位ID")]
public int StoreId { get; set; }
/// <summary>
/// 入库的库位编码
/// </summary>
[SugarColumn(ColumnName = "store_code", Length = 50, IsNullable = false, ColumnDescription = "库位编码")]
public string StoreCode { get; set; }
[Navigate(NavigateType.OneToOne, nameof(StoreId))]
public StoreInfo StoreInfo { get; set; }
#endregion
#region
/// <summary>
/// 任务Id
/// </summary>
[SugarColumn(ColumnName = "task_id", IsNullable = false, ColumnDescription = "任务Id同一个库位只支持1-7")]
public int TaskID { get; set; }
/// <summary>
/// Guid
/// </summary>
[SugarColumn(ColumnName = "guid", IsNullable = false, ColumnDescription = "Guid 系统那边任务的唯一ID")]
public Guid Guid { get; set; }
/// <summary>
/// 任务模式:入库模式 = 0, 出库模式 = 1, 盘点模式 = 2
/// </summary>
[SugarColumn(ColumnName = "task_mode", IsNullable = false, ColumnDescription = "任务模式:入库模式 = 0, 出库模式 = 1, 盘点模式 = 2")]
public TaskModeEnum TaskMode { get; set; }
/// <summary>
/// 出库单据号
/// </summary>
[SugarColumn(ColumnName = "order_number", Length = 50, IsNullable = false, ColumnDescription = "出库单据号")]
public string OrderNumber { get; set; }
/// <summary>
/// 按钮颜色
/// </summary>
[SugarColumn(ColumnName = "button_color", IsNullable = false, ColumnDescription = "按钮颜色 红色 = 1, 绿色 = 2, 黄色 = 3, 蓝色 = 4, 紫色 = 5, 青色 = 6, 白色 = 7,")]
public ButtonColorEnum ButtonColor { get; set; }
/// <summary>
/// 物料编码
/// </summary>
[SugarColumn(ColumnName = "mat_code", Length = 100, IsNullable = true, ColumnDescription = "物料编号")]
public string MatCode { get; set; }
/// <summary>
/// 物料名称
/// </summary>
[SugarColumn(ColumnName = "mat_name", Length = 150, IsNullable = true, ColumnDescription = "物料名称")]
public string MatName { get; set; }
/// <summary>
/// 物料规格
/// </summary>
[SugarColumn(ColumnName = "mat_spec", Length = 150, IsNullable = true, ColumnDescription = "物料规格")]
public string MatSpec { get; set; }
/// <summary>
/// 物料批次
/// </summary>
[SugarColumn(ColumnName = "mat_batch", Length = 150, IsNullable = true, ColumnDescription = "物料批次")]
public string MatBatch { get; set; }
/// <summary>
/// 物料数量
/// </summary>
[SugarColumn(ColumnName = "qty", IsNullable = false, ColumnDescription = "目标数量")]
public int Qty { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnName = "create_time", IsNullable = false, ColumnDescription = "创建时间")]
public DateTime CreateTime { get; set; } = DateTime.Now;
/// <summary>
/// 创建人
/// </summary>
[SugarColumn(ColumnName = "create_user", Length = 100, IsNullable = true, ColumnDescription = "创建人")]
public string CreateUser { get; set; } = string.Empty;
/// <summary>
/// 完成时物料数量
/// </summary>
[SugarColumn(ColumnName = "finish_qty", IsNullable = false, ColumnDescription = "完成数量")]
public int FinishQty { get; set; } = 0;
/// <summary>
/// 完成时间
/// </summary>
[SugarColumn(ColumnName = "finish_time", IsNullable = false, ColumnDescription = "完成时间")]
public DateTime FinishTime { get; set; } = DateTime.Now;
#endregion
}
}

View File

@ -1703,36 +1703,6 @@ namespace WCS.BLL.HardWare
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;
}

View File

@ -70,9 +70,9 @@ namespace WCS.BLL.Manager
DbHelp.dbLog.DbMaintenance.CreateDatabase();
Logs.Write("【初始化数据库】创建数据库", LogsType.StartBoot);
DbHelp.db.CodeFirst.InitTables(typeof(ModuleInfo), typeof(ShelfInfo), typeof(StoreInfo),typeof(StoreInfoHistoryVoltage)
DbHelp.db.CodeFirst.InitTables(typeof(ModuleInfo), typeof(ShelfInfo), typeof(StoreInfo)
, typeof(InventoryDetail), typeof(OutOrder), typeof(OutOrderDetail), typeof(OutOrderMatDetail)
, typeof(ShelfTypeInfo), typeof(MatBaseInfo), typeof(MatInfo)
, typeof(MatBaseInfo), typeof(MatInfo)
, typeof(StockTakingOrder), typeof(StockTakingOrderMatDetail), typeof(InOutRecord)
, typeof(DocumentSerialNumber), typeof(OrderLight), typeof(MatInfoLog)
, typeof(AppVersion)
@ -102,21 +102,7 @@ namespace WCS.BLL.Manager
}
Logs.Write("【初始化数据库】DocumentSerialNumber", LogsType.StartBoot);
//初始化货架类型
if (!DbHelp.db.Queryable<ShelfTypeInfo>().Any())
{
var smartShelf = new ShelfTypeInfo()
{
ShelfTypeName = "智能货架"
};
var singleLight = new ShelfTypeInfo()
{
ShelfTypeName = "信息化货架"
};
DbHelp.db.Insertable(smartShelf).ExecuteCommand();
DbHelp.db.Insertable(singleLight).ExecuteCommand();
}
Logs.Write("【初始化数据库】初始化货架类型", LogsType.StartBoot);
//初始化权限数据库
AuthDbHelp.InitDb();

View File

@ -1,20 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WCS.Model;
using WCS.Model.ApiModel.MXL4;
using WCS.Model.ApiModel.SingleLight;
using WCS.Model.WebSocketModel;
namespace WCS.BLL.Services.IService
{
/// <summary>
/// 处理、查询报警使用的服务
/// </summary>
public interface IMXL4Service
{
public Task<ResponseCommon<object>> sysOrderMXL4(SysOrderMXL4Request request);
}
}

View File

@ -52,13 +52,6 @@ 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>

View File

@ -1,126 +0,0 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Xml.Xsl;
using TouchSocket.Core;
using WCS.BLL.DbModels;
using WCS.BLL.Manager;
using WCS.BLL.Services.IService;
using WCS.BLL.Tool;
using WCS.DAL;
using WCS.DAL.Db;
using WCS.DAL.Db.AuthDb;
using WCS.DAL.DbModels;
using WCS.Model;
using WCS.Model.ApiModel;
using WCS.Model.ApiModel.MXL4;
using WCS.Model.ApiModel.SingleLight;
using WCS.Model.ApiModel.User;
using WCS.Model.WebSocketModel;
using static System.Formats.Asn1.AsnWriter;
using static WCS.BLL.Tool.Helper;
namespace WCS.BLL.Services.Service
{
public class MXL4Service : IMXL4Service
{
public async Task<ResponseCommon<object>> sysOrderMXL4(SysOrderMXL4Request request)
{
try
{
//第一步:获取所有库位码 校验库位在数据库中是否都存在
var storeCodeList = request.List.Select(t => t.StoreCode)
.Distinct()
.ToList();
var stores = DbHelp.db.Queryable<StoreInfo>()
.LeftJoin<ShelfTypeInfo>((si, sti) => si.ShelfTypeId == sti.Id)
.Where((si, sti) => sti.ShelfTypeName == "液晶货架")
.Where((si, sti) => storeCodeList.Contains(si.StoreCode))
.Select((st, sti) => st)
.ToList();
if (stores.Count < storeCodeList.Count)
{
var storeCodesInDB = stores.Select(t => t.StoreCode).ToList();
storeCodeList.RemoveAll(t => storeCodesInDB.Contains(t));
return new ResponseCommon<object>
{
Code = 200,
Message = $"操作失败:库位【{string.Join(",", storeCodeList)}】不存在!",
};
}
//第二步 获取库位正在进行的任务
//模式相同视为可以继续发送任务
var currenTasks = DbHelp.db.Queryable<CurrentTask>()
.Where(t => storeCodeList.Contains(t.StoreCode))
.ToList();
var currenTasksNotThisMode = currenTasks.Where(t => t.TaskMode != request.OrderType).ToList(); ;
if (currenTasksNotThisMode.Any())
{
var task = currenTasksNotThisMode.First();
return new ResponseCommon<object>
{
Code = 200,
Message = $"操作失败:库位【{task.StoreCode}】当前在{task.TaskMode}",
};
}
var tasks = new List<CurrentTask>();
//生成任务数据
foreach (var orderDetail in request.List)
{
var store = stores.Where(t => t.StoreCode == orderDetail.StoreCode).First();
var task = new CurrentTask()
{
StoreId = store.Id,
StoreCode = store.StoreCode,
Guid = orderDetail.Guid,
TaskMode = request.OrderType,
OrderNumber = request.OrderNumber,
ButtonColor = request.Corlor,
MatCode = orderDetail.MatCode,
MatName = orderDetail.MatName,
MatSpec = orderDetail.MatSpec,
MatBatch = orderDetail.MatBatch,
Qty = orderDetail.Qty
};
tasks.Add(task);
}
try
{
DbHelp.db.BeginTran();
DbHelp.db.Insertable(tasks).ExecuteCommand();
DbHelp.db.CommitTran();
}
catch (Exception ex)
{
DbHelp.db.RollbackTran();
return new ResponseCommon<object>
{
Code = 300,
Message = $"操作失败:{ex.Message}"
};
}
//发送任务至各个标签
return new ResponseCommon<object>
{
Code = 200,
Message = "success"
};
}
catch (Exception ex)
{
return new ResponseCommon<object>
{
Code = 200,
Message = "操作失败:" + ex.Message,
};
}
}
}
}

View File

@ -78,23 +78,6 @@ namespace WCS.BLL.Services.Service
Message = "出库单据同步失败:缺少需要出库的物料类型!"
};
}
//补齐货架类型名称
if (string.IsNullOrEmpty(request.ShelfTypeName))
{
var shelfType = await DbHelp.db.Queryable<ShelfTypeInfo>()
.Where(t => t.Id == request.ShelfTypeId)
.FirstAsync();
if (shelfType == null)
{
return new ResponseBase()
{
Code = 201,
Message = $"出库单据同步失败缺少必要参数ShelfTypeId"
};
}
else
request.ShelfTypeName = shelfType.ShelfTypeName;
}
//保存数据
await DbHelp.db.BeginTranAsync();
@ -1410,26 +1393,6 @@ namespace WCS.BLL.Services.Service
};
}
//获取库位是否是信息化货架的库位
var shelf = await DbHelp.db.Queryable<StoreInfo>()
.LeftJoin<ShelfTypeInfo>((si, sti) => si.ShelfTypeId == sti.Id)
.Where((si, sti) => si.Id == invetoryDetail.StoreId)
.Select((si, sti) => new
{
ShelfId = si.ShelfId,
ShelfTypeName = sti.ShelfTypeName
})
.FirstAsync();
if (shelf != null && shelf.ShelfTypeName != "信息化货架")
{
return new ResponseCommon()
{
Code = 201,
Message = $"该物料库存不在信息化货架上,不能进行出库!",
Data = null
};
}
//物料需求明细校验
var outOrderDetail = await DbHelp.db.Queryable<OutOrderDetail>().Where(it => it.OrderNumber == request.OrderNumber)
@ -1470,26 +1433,6 @@ namespace WCS.BLL.Services.Service
outOrderDetail.OutQty += invetoryDetail.MatQty;
DbHelp.db.Updateable(outOrderDetail).ExecuteCommand();
//蜂鸣器提示
Task.Run(() =>
{
Logs.Write("【单灯出库蜂鸣器提示】开始");
if (shelf != null)
{
var Shelf = DbHelp.db.Queryable<ShelfInfo>().Where(t => t.Id == shelf.ShelfId).First();
if (Shelf != null)
{
TCPClient tCPClient = TCPClientManager.GetTCPClientByIPHost(Shelf.ClientIp);
byte[] lightOn = Helper.CommitOutstoreBee(Shelf.LightId);
tCPClient.Send(lightOn);
Logs.Write($"【单灯出库蜂鸣器提示】已发送指令");
}
else
Logs.Write($"【单灯出库蜂鸣器提示】Shelf == null ID为{shelf.ShelfId}");
}
else
Logs.Write("【单灯出库蜂鸣器提示】shelf == null");
});
return new ResponseCommon()

View File

@ -492,39 +492,6 @@ 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
@ -537,47 +504,6 @@ 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;
}

View File

@ -1,74 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
using WCS.BLL.DbModels.Task;
namespace WCS.Model.ApiModel.MXL4
{
public class SysOrderMXL4Request : RequestBase
{
/// <summary>
/// 按钮颜色
/// </summary>
public ButtonColorEnum Corlor { get; set; }
/// <summary>
/// 任务单号
/// </summary>
public string OrderNumber { get; set; }
/// <summary>
/// 任务类型 出库/入库/盘点
/// </summary>
public TaskModeEnum OrderType { get; set; }
/// <summary>
/// 单据明细
/// </summary>
public List<MXL4OrderDetail> List { get; set; }
}
public class MXL4OrderDetail
{
/// <summary>
/// Guid系统那边任务的主键
/// </summary>
public Guid Guid { get; set; }
/// <summary>
/// 库位编码
/// </summary>
public string StoreCode { get; set; }
/// <summary>
/// 物料编码
/// </summary>
public string MatCode { get; set; }
/// <summary>
/// 物料名称
/// </summary>
public string MatName { get; set; }
/// <summary>
/// 物料规格
/// </summary>
public string MatSpec { get; set; }
/// <summary>
/// 物料批次
/// </summary>
public string MatBatch { get; set; }
/// <summary>
/// 物料SN
/// </summary>
public string MatSN { get; set; }
/// <summary>
/// 数量
/// </summary>
public int Qty { get; set; }
}
}

View File

@ -1,29 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WCS.BLL.DbModels.Task
{
/// <summary>
/// 按键灯颜色
/// </summary>
public enum ButtonColorEnum
{
= 1,
绿 = 2,
= 3,
= 4,
= 5,
= 6,
= 7,
}
public enum TaskModeEnum
{
= 0,
= 1,
= 2
}
}

View File

@ -29,41 +29,6 @@ namespace WCS.WebApi.Controllers
_selfCheckService = selfCheckService;
}
[Route("getShelfTypes")]
[HttpPost(Name = "getShelfTypes")]
public async Task<ResponseBase> getShelfTypes(RequestBase request)
{
try
{
//直接获取当前所有货架类型并返回
var shelfTypes = DbHelp.db.Queryable<ShelfTypeInfo>()
.Select(t => new ShelfTypeModel()
{
Id = t.Id,
ShelfTypeName = t.ShelfTypeName
})
.ToList();
return new PageQueryResponse<ShelfTypeModel>()
{
Code = 200,
Message = "success",
Data = new PageQueryResponseData<ShelfTypeModel>
{
Lists = shelfTypes,
Count = shelfTypes.Count
}
};
}
catch (Exception ex)
{
return new PageQueryResponse<ShelfTypeModel>()
{
Code = 300,
Message = $"查询失败:{ex.Message}",
};
}
}
[Route("getShelfStatus")]
[HttpPost(Name = "getShelfStatus")]
public async Task<ResponseBase> getShelfStatus(GetShelfStatusRequest request)

View File

@ -1,49 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using WCS.BLL.Services.IService;
using WCS.BLL.Services.Service;
using WCS.Model;
using WCS.Model.ApiModel;
using WCS.Model.ApiModel.MXL4;
using WCS.Model.ApiModel.SelfCheck;
using WCS.Model.ApiModel.SingleLight;
using WCS.Model.ApiModel.Stocktaking;
using WCS.Model.ApiModel.User;
using WCS.Model.WebSocketModel;
namespace WCS.WebApi.Controllers
{
/// <summary>
/// 液晶面板 煤科院钻探分院项目
/// </summary>
[ApiController]
[Route("[controller]")]
public class MXL4Controller : ControllerBase
{
public IMXL4Service _mxl4Service { get; set; }
public MXL4Controller(IMXL4Service mxl4Service)
{
_mxl4Service = mxl4Service;
}
[Route("sysOrderMXL4")]
[HttpPost(Name = "sysOrderMXL4")]
public async Task<ResponseBase> sysOrderMXL4(SysOrderMXL4Request request)
{
try
{
return await _mxl4Service.sysOrderMXL4(request);
}
catch (Exception ex)
{
return new ResponseBase()
{
Code = 300,
Message = "操作失败:" + ex.Message,
};
}
}
}
}

View File

@ -66,12 +66,6 @@ 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")]

View File

@ -82,7 +82,6 @@ namespace WebApi
builder.Services.AddScoped<IInOutRecordService, InOutRecordService>();
builder.Services.AddScoped<IUploadService, UploadService>();
builder.Services.AddScoped<ISingleLightService, SingleLightService>();
builder.Services.AddScoped<IMXL4Service, MXL4Service>();
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA1A2><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ģʽ
builder.Services.AddSingleton<IGenerateService, GenerateService>();