diff --git a/WCS.BLL/DbModels/DingDingSendUser.cs b/WCS.BLL/DbModels/DingDingSendUser.cs
deleted file mode 100644
index d19c848..0000000
--- a/WCS.BLL/DbModels/DingDingSendUser.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using SqlSugar;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace WCS.BLL.DbModels
-{
- [SugarTable("ding_ding_send_user")]
- public class DingDingSendUser
- {
- ///
- /// 工号
- ///
- [SugarColumn(ColumnName = "user_name", Length = 50, IsNullable = true, ColumnDescription = "创建人")]
- public string UserName { get; set; }
- }
-}
diff --git a/WCS.BLL/DbModels/MatInfoLog.cs b/WCS.BLL/DbModels/MatInfoLog.cs
new file mode 100644
index 0000000..aa6c178
--- /dev/null
+++ b/WCS.BLL/DbModels/MatInfoLog.cs
@@ -0,0 +1,49 @@
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WCS.BLL.DbModels
+{
+ ///
+ ///物料信息表
+ ///
+ [SugarTable("wcs_mat_info_log")]
+ public class MatInfoLog
+ {
+ ///
+ /// 主键 Id 自增
+ ///
+ [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
+ public int Id { get; set; }
+
+ ///
+ /// 物料编码
+ ///
+ [SugarColumn(ColumnName = "mat_Sn", Length = 200, IsNullable = false, ColumnDescription = "物料唯一码")]
+ public string MatSn { get; set; }
+
+ ///
+ /// 更新信息
+ ///
+ [SugarColumn(ColumnName = "info", Length = 200, IsNullable = false, ColumnDescription = "更新信息")]
+ public string Info { get; set; }
+
+ ///
+ /// 物料数量
+ ///
+ [SugarColumn(ColumnName = "mat_qty", IsNullable = false, ColumnDescription = "物料数量")]
+ public int MatQty { get; set; }
+
+ ///
+ /// Desc:更新时间
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName = "modify_time", IsNullable = true, ColumnDescription = "更新时间")]
+ public DateTime? ModifyTime { get; set; } = DateTime.Now;
+
+ }
+}
diff --git a/WCS.BLL/DbModels/Task/CurrentTask.cs b/WCS.BLL/DbModels/Task/CurrentTask.cs
new file mode 100644
index 0000000..6bc009b
--- /dev/null
+++ b/WCS.BLL/DbModels/Task/CurrentTask.cs
@@ -0,0 +1,121 @@
+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
+{
+ ///
+ /// 当前正在进行中的任务
+ ///
+ [SugarTable("wcs_current_task")]
+ public class CurrentTask
+ {
+ ///
+ /// 主键 自增Id
+ ///
+ [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
+ public int Id { get; set; }
+
+ #region 库位属性
+ ///
+ /// 入库的库位表ID
+ ///
+ [SugarColumn(ColumnName = "store_id", IsNullable = false, ColumnDescription = "库位ID")]
+ public int StoreId { get; set; }
+
+ ///
+ /// 入库的库位编码
+ ///
+ [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 任务属性
+ ///
+ /// 任务Id
+ ///
+ [SugarColumn(ColumnName = "task_id", IsNullable = false, ColumnDescription = "任务Id,同一个库位只支持1-7")]
+ public int TaskID { get; set; } = 0;
+
+ ///
+ /// Guid
+ ///
+ [SugarColumn(ColumnName = "guid", IsNullable = false, ColumnDescription = "Guid 系统那边任务的唯一ID")]
+ public Guid Guid { get; set; }
+
+ ///
+ /// 任务模式:入库模式 = 0, 出库模式 = 1, 盘点模式 = 2
+ ///
+ [SugarColumn(ColumnName = "task_mode", IsNullable = false, ColumnDescription = "任务模式:入库模式 = 0, 出库模式 = 1, 盘点模式 = 2")]
+ public TaskModeEnum TaskMode { get; set; }
+
+ ///
+ /// 出库单据号
+ ///
+ [SugarColumn(ColumnName = "order_number", Length = 50, IsNullable = false, ColumnDescription = "出库单据号")]
+ public string OrderNumber { get; set; }
+
+ ///
+ /// 按钮颜色
+ ///
+ [SugarColumn(ColumnName = "button_color", IsNullable = false, ColumnDescription = "按钮颜色 红色 = 1, 绿色 = 2, 黄色 = 3, 蓝色 = 4, 紫色 = 5, 青色 = 6, 白色 = 7,")]
+ public ButtonColorEnum ButtonColor { get; set; }
+
+ ///
+ /// 物料编码
+ ///
+ [SugarColumn(ColumnName = "mat_code", Length = 100, IsNullable = true, ColumnDescription = "物料编号")]
+ public string MatCode { get; set; }
+
+ ///
+ /// 物料名称
+ ///
+ [SugarColumn(ColumnName = "mat_name", Length = 150, IsNullable = true, ColumnDescription = "物料名称")]
+ public string MatName { get; set; }
+
+ ///
+ /// 物料规格
+ ///
+ [SugarColumn(ColumnName = "mat_spec", Length = 150, IsNullable = true, ColumnDescription = "物料规格")]
+ public string MatSpec { get; set; }
+
+ ///
+ /// 物料批次
+ ///
+ [SugarColumn(ColumnName = "mat_batch", Length = 150, IsNullable = true, ColumnDescription = "物料批次")]
+ public string MatBatch { get; set; }
+
+ ///
+ /// 物料数量
+ ///
+ [SugarColumn(ColumnName = "qty", IsNullable = false, ColumnDescription = "目标数量")]
+ public int Qty { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "create_time", IsNullable = false, ColumnDescription = "创建时间")]
+ public DateTime CreateTime { get; set; } = DateTime.Now;
+
+ ///
+ /// 任务是否被挂起 用于入库时取消入库,还没切换库位时 认为任务被挂起 同时只支持一个库位的任务被挂起
+ ///
+ [SugarColumn(ColumnName = "is_suspended", IsNullable = false, ColumnDescription = "任务是否被挂起 用于入库时取消入库,还没切换库位时 认为任务被挂起")]
+ public bool IsSuspended { get; set; } = false;
+
+ ///
+ /// 任务是否已发送至标签
+ ///
+ [SugarColumn(ColumnName = "is_sended", IsNullable = false, ColumnDescription = "任务是否已发送至标签")]
+ public bool IsSended { get; set; } = false;
+ #endregion
+ }
+}
diff --git a/WCS.BLL/DbModels/Task/FinishedTask.cs b/WCS.BLL/DbModels/Task/FinishedTask.cs
new file mode 100644
index 0000000..c3a7e59
--- /dev/null
+++ b/WCS.BLL/DbModels/Task/FinishedTask.cs
@@ -0,0 +1,125 @@
+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
+{
+ ///
+ /// 已完成未提交的任务
+ ///
+ [SugarTable("wcs_finished_task")]
+ public class FinishedTask
+ {
+ ///
+ /// 主键 自增Id
+ ///
+ [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
+ public int Id { get; set; }
+
+ #region 库位属性
+ ///
+ /// 入库的库位表ID
+ ///
+ [SugarColumn(ColumnName = "store_id", IsNullable = false, ColumnDescription = "库位ID")]
+ public int StoreId { get; set; }
+
+ ///
+ /// 入库的库位编码
+ ///
+ [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 任务属性
+ ///
+ /// 任务Id
+ ///
+ [SugarColumn(ColumnName = "task_id", IsNullable = false, ColumnDescription = "任务Id,同一个库位只支持1-7")]
+ public int TaskID { get; set; }
+
+ ///
+ /// Guid
+ ///
+ [SugarColumn(ColumnName = "guid", IsNullable = false, ColumnDescription = "Guid 系统那边任务的唯一ID")]
+ public Guid Guid { get; set; }
+
+ ///
+ /// 任务模式:入库模式 = 0, 出库模式 = 1, 盘点模式 = 2
+ ///
+ [SugarColumn(ColumnName = "task_mode", IsNullable = false, ColumnDescription = "任务模式:入库模式 = 0, 出库模式 = 1, 盘点模式 = 2")]
+ public TaskModeEnum TaskMode { get; set; }
+
+ ///
+ /// 出库单据号
+ ///
+ [SugarColumn(ColumnName = "order_number", Length = 50, IsNullable = false, ColumnDescription = "出库单据号")]
+ public string OrderNumber { get; set; }
+
+ ///
+ /// 按钮颜色
+ ///
+ [SugarColumn(ColumnName = "button_color", IsNullable = false, ColumnDescription = "按钮颜色 红色 = 1, 绿色 = 2, 黄色 = 3, 蓝色 = 4, 紫色 = 5, 青色 = 6, 白色 = 7,")]
+ public ButtonColorEnum ButtonColor { get; set; }
+
+ ///
+ /// 物料编码
+ ///
+ [SugarColumn(ColumnName = "mat_code", Length = 100, IsNullable = true, ColumnDescription = "物料编号")]
+ public string MatCode { get; set; }
+ ///
+ /// 物料名称
+ ///
+ [SugarColumn(ColumnName = "mat_name", Length = 150, IsNullable = true, ColumnDescription = "物料名称")]
+ public string MatName { get; set; }
+
+ ///
+ /// 物料规格
+ ///
+ [SugarColumn(ColumnName = "mat_spec", Length = 150, IsNullable = true, ColumnDescription = "物料规格")]
+ public string MatSpec { get; set; }
+
+ ///
+ /// 物料批次
+ ///
+ [SugarColumn(ColumnName = "mat_batch", Length = 150, IsNullable = true, ColumnDescription = "物料批次")]
+ public string MatBatch { get; set; }
+
+ ///
+ /// 物料数量
+ ///
+ [SugarColumn(ColumnName = "qty", IsNullable = false, ColumnDescription = "目标数量")]
+ public int Qty { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "create_time", IsNullable = false, ColumnDescription = "创建时间")]
+ public DateTime CreateTime { get; set; } = DateTime.Now;
+
+ ///
+ /// 创建人
+ ///
+ [SugarColumn(ColumnName = "create_user", Length = 100, IsNullable = true, ColumnDescription = "创建人")]
+ public string CreateUser { get; set; } = string.Empty;
+
+ ///
+ /// 完成时物料数量
+ ///
+ [SugarColumn(ColumnName = "finish_qty", IsNullable = false, ColumnDescription = "完成数量")]
+ public int FinishQty { get; set; } = 0;
+ ///
+ /// 完成时间
+ ///
+ [SugarColumn(ColumnName = "finish_time", IsNullable = false, ColumnDescription = "完成时间")]
+ public DateTime FinishTime { get; set; } = DateTime.Now;
+ #endregion
+ }
+}
diff --git a/WCS.BLL/DbModels/Task/UploadedTask.cs b/WCS.BLL/DbModels/Task/UploadedTask.cs
new file mode 100644
index 0000000..f6b7ebd
--- /dev/null
+++ b/WCS.BLL/DbModels/Task/UploadedTask.cs
@@ -0,0 +1,125 @@
+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
+{
+ ///
+ /// 已完成已提交的历史任务
+ ///
+ [SugarTable("wcs_uploaded_task")]
+ public class UploadededTask
+ {
+ ///
+ /// 主键 自增Id
+ ///
+ [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
+ public int Id { get; set; }
+
+ #region 库位属性
+ ///
+ /// 入库的库位表ID
+ ///
+ [SugarColumn(ColumnName = "store_id", IsNullable = false, ColumnDescription = "库位ID")]
+ public int StoreId { get; set; }
+
+ ///
+ /// 入库的库位编码
+ ///
+ [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 任务属性
+ ///
+ /// 任务Id
+ ///
+ [SugarColumn(ColumnName = "task_id", IsNullable = false, ColumnDescription = "任务Id,同一个库位只支持1-7")]
+ public int TaskID { get; set; }
+
+ ///
+ /// Guid
+ ///
+ [SugarColumn(ColumnName = "guid", IsNullable = false, ColumnDescription = "Guid 系统那边任务的唯一ID")]
+ public Guid Guid { get; set; }
+
+ ///
+ /// 任务模式:入库模式 = 0, 出库模式 = 1, 盘点模式 = 2
+ ///
+ [SugarColumn(ColumnName = "task_mode", IsNullable = false, ColumnDescription = "任务模式:入库模式 = 0, 出库模式 = 1, 盘点模式 = 2")]
+ public TaskModeEnum TaskMode { get; set; }
+
+ ///
+ /// 出库单据号
+ ///
+ [SugarColumn(ColumnName = "order_number", Length = 50, IsNullable = false, ColumnDescription = "出库单据号")]
+ public string OrderNumber { get; set; }
+
+ ///
+ /// 按钮颜色
+ ///
+ [SugarColumn(ColumnName = "button_color", IsNullable = false, ColumnDescription = "按钮颜色 红色 = 1, 绿色 = 2, 黄色 = 3, 蓝色 = 4, 紫色 = 5, 青色 = 6, 白色 = 7,")]
+ public ButtonColorEnum ButtonColor { get; set; }
+
+ ///
+ /// 物料编码
+ ///
+ [SugarColumn(ColumnName = "mat_code", Length = 100, IsNullable = true, ColumnDescription = "物料编号")]
+ public string MatCode { get; set; }
+ ///
+ /// 物料名称
+ ///
+ [SugarColumn(ColumnName = "mat_name", Length = 150, IsNullable = true, ColumnDescription = "物料名称")]
+ public string MatName { get; set; }
+
+ ///
+ /// 物料规格
+ ///
+ [SugarColumn(ColumnName = "mat_spec", Length = 150, IsNullable = true, ColumnDescription = "物料规格")]
+ public string MatSpec { get; set; }
+
+ ///
+ /// 物料批次
+ ///
+ [SugarColumn(ColumnName = "mat_batch", Length = 150, IsNullable = true, ColumnDescription = "物料批次")]
+ public string MatBatch { get; set; }
+
+ ///
+ /// 物料数量
+ ///
+ [SugarColumn(ColumnName = "qty", IsNullable = false, ColumnDescription = "目标数量")]
+ public int Qty { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "create_time", IsNullable = false, ColumnDescription = "创建时间")]
+ public DateTime CreateTime { get; set; } = DateTime.Now;
+
+ ///
+ /// 创建人
+ ///
+ [SugarColumn(ColumnName = "create_user", Length = 100, IsNullable = true, ColumnDescription = "创建人")]
+ public string CreateUser { get; set; } = string.Empty;
+
+ ///
+ /// 完成时物料数量
+ ///
+ [SugarColumn(ColumnName = "finish_qty", IsNullable = false, ColumnDescription = "完成数量")]
+ public int FinishQty { get; set; } = 0;
+ ///
+ /// 完成时间
+ ///
+ [SugarColumn(ColumnName = "finish_time", IsNullable = false, ColumnDescription = "完成时间")]
+ public DateTime FinishTime { get; set; } = DateTime.Now;
+ #endregion
+ }
+}
diff --git a/WCS.BLL/Manager/DbInit.cs b/WCS.BLL/Manager/DbInit.cs
index 69b92e8..ccba627 100644
--- a/WCS.BLL/Manager/DbInit.cs
+++ b/WCS.BLL/Manager/DbInit.cs
@@ -72,7 +72,7 @@ namespace WCS.BLL.Manager
, typeof(InventoryDetail), typeof(OutOrder), typeof(OutOrderDetail), typeof(OutOrderMatDetail)
, typeof(ShelfTypeInfo), typeof(MatBaseInfo), typeof(MatInfo)
, typeof(StockTakingOrder), typeof(StockTakingOrderMatDetail), typeof(InOutRecord)
- , typeof(DocumentSerialNumber),typeof(OrderLight)
+ , typeof(DocumentSerialNumber),typeof(OrderLight),typeof(MatInfoLog)
);
Logs.Write("【初始化数据库】db建表", LogsType.StartBoot);
diff --git a/WCS.BLL/Manager/TCPClientManager.cs b/WCS.BLL/Manager/TCPClientManager.cs
index 955ca1a..cfbd4fa 100644
--- a/WCS.BLL/Manager/TCPClientManager.cs
+++ b/WCS.BLL/Manager/TCPClientManager.cs
@@ -60,6 +60,14 @@ namespace WCS.BLL.Manager
return EasyTask.CompletedTask;
}
+ if (tcpCleint.ShelfTypeName == "液晶货架")
+ {
+ Logs.Write($"【液晶货架开始处理接收数据】{BitConverter.ToString(data)}", LogsType.Instructions);
+ //Helper.ReturnDataProcess(TcpCleint, data);
+ Logs.Write($"【液晶货架完成处理接收数据】{BitConverter.ToString(data)}", LogsType.Instructions);
+ return EasyTask.CompletedTask;
+ }
+
for (int index = 0; index < data.Length - TcpCleint.PreFixLength; index++)
{
//协议拆包 通过前缀校验是否为完整数据包
diff --git a/WCS.BLL/Services/IService/IMXL4Service.cs b/WCS.BLL/Services/IService/IMXL4Service.cs
new file mode 100644
index 0000000..08e9a61
--- /dev/null
+++ b/WCS.BLL/Services/IService/IMXL4Service.cs
@@ -0,0 +1,20 @@
+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
+{
+ ///
+ /// 处理、查询报警使用的服务
+ ///
+ public interface IMXL4Service
+ {
+ public Task> sysOrderMXL4(SysOrderMXL4Request request);
+ }
+}
diff --git a/WCS.BLL/Services/IService/ISingleLightService.cs b/WCS.BLL/Services/IService/ISingleLightService.cs
new file mode 100644
index 0000000..16efc4e
--- /dev/null
+++ b/WCS.BLL/Services/IService/ISingleLightService.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WCS.Model;
+using WCS.Model.ApiModel.SingleLight;
+using WCS.Model.WebSocketModel;
+
+namespace WCS.BLL.Services.IService
+{
+ ///
+ /// 处理、查询报警使用的服务
+ ///
+ public interface ISingleLightService
+ {
+ public Task> SingleLightControl(SingleLightControlRequest request);
+ }
+}
diff --git a/WCS.BLL/Services/IService/IUploadService.cs b/WCS.BLL/Services/IService/IUploadService.cs
new file mode 100644
index 0000000..bfe5967
--- /dev/null
+++ b/WCS.BLL/Services/IService/IUploadService.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WCS.Model;
+using WCS.Model.ApiModel.SingleLight;
+using WCS.Model.ApiModel.UpLoad;
+using WCS.Model.WebSocketModel;
+
+namespace WCS.BLL.Services.IService
+{
+ ///
+ /// 处理、查询报警使用的服务
+ ///
+ public interface IUploadService
+ {
+ public Task UploadReelInfo(UploadReelInfoRequest request);
+
+ public Task GetReelInfo(string MatSn);
+ }
+}
diff --git a/WCS.BLL/Services/Service/InstoreService.cs.orig b/WCS.BLL/Services/Service/InstoreService.cs.orig
deleted file mode 100644
index b0977c8..0000000
--- a/WCS.BLL/Services/Service/InstoreService.cs.orig
+++ /dev/null
@@ -1,552 +0,0 @@
-using OracleInternal.SqlAndPlsqlParser.LocalParsing;
-using System.ComponentModel.DataAnnotations.Schema;
-using System.Runtime.InteropServices;
-using System.Text.RegularExpressions;
-using WCS.BLL.Config;
-using WCS.BLL.DbModels;
-using WCS.BLL.HardWare;
-using WCS.BLL.Manager;
-using WCS.BLL.Services.IService;
-using WCS.BLL.Tool;
-using WCS.BLL.Tool.Api.ApiModel;
-using WCS.DAL.Db;
-using WCS.DAL.DbModels;
-using WCS.Model;
-using WCS.Model.ApiModel.InOutRecord;
-using WCS.Model.ApiModel.MXBackgroundThread;
-
-namespace WCS.BLL.Services.Service
-{
- public class InstoreService : IInstoreService
- {
- public InstoreService() { }
-
- public ResponseBase shelfGoInInStore(ShelfGoInInstoreRequest request)
- {
- //校验货架编码规则
- //取配置文件中得货架编码规则
- bool isValid = false;
- var patterns = LocalFile.Config.ModuleCodePatterns;
- if (patterns != null && patterns.Count > 0)
- {
- foreach (var pattern in patterns)
- {
- isValid = Regex.IsMatch(request.ModuleCode, pattern);
- //匹配到第一个符合条件的货架码 就直接退出循环 认为匹配成功
- if (isValid)
- break;
- }
- }
- //如果配置文件缺失 使用默认正则进行匹配
- else
- {
- isValid = Regex.IsMatch(request.ModuleCode, LocalFile.DefaultModuleCodePattern);
- }
-
- if (!isValid)
- {
- return new ResponseBase()
- {
- Code = 202,
- Message = $"模组编码{request.ModuleCode}不满足模组编码规则!",
- };
- }
- //找到模组对应的货架
- var shelf = ShelfManager.Shelves.Where(t => t.ModulesStr.Contains(request.ModuleCode)).FirstOrDefault();
- if (shelf == null)//未找到
- {
- return new ResponseBase()
- {
- Code = 201,
- Message = "未找到模组对应的货架",
- };
- }
- //已找到模组对应货架
- shelf.GoInInstore(request.IpAdress);
-
- if (shelf.CurrentMode == Mode.入库模式)
- //成功进入入库模式
- return new ShelfGoInInstoreResponse()
- {
- Code = 200,
- Message = $"货架进入入库模式成功!{string.Join(",", shelf.ExceptionMessages)}",
- Data = new ShelfGoInInstoreDto()
- {
- ShelfCode = shelf.ShelfCode,
- ModulesStr = shelf.ModulesStr,
- }
- };
- else
- return new ShelfGoInInstoreResponse()
- {
- Code = 201,
- Message = $"货架进入入库模式失败:{string.Join(",", shelf.ExceptionMessages)}",
- Data = null
- };
-
- }
-
- public ResponseBase shelfGoOutInStore(ShelfGoOutInStoreRequest request)
- {
- //获取货架
- var shelf = ShelfManager.Shelves.Where(t => t.ShelfCode == request.ShelfCode).FirstOrDefault();
- if (shelf == null)//货架不存在
- {
- return new ResponseCommon()
- {
- Code = 201,
- Message = $"退出入库模式失败:货架[{request.ShelfCode}]不存在!",
- };
- }
-
- //判断扫码枪 是否被其他扫码枪所占用 如果占用 直接退出入库模式 不发指令
- shelf.GoOutInstore();
-
- if (shelf.ExceptionMessages == null || shelf.ExceptionMessages.Count == 0)
- //已退出
- return new ResponseCommon()
- {
- Code = 200,
- Message = $"货架[{request.ShelfCode}]已退出入库模式!",
- };
- else
- return new ResponseCommon()
- {
- Code = 200,
- Message = $"货架[{request.ShelfCode}]已退出入库模式!{string.Join(",", shelf.ExceptionMessages)}",
- };
- }
-
- public async Task queryByMatSn(QueryByMatSnRequest request)
- {
- //判断物料是否已入库
- var inventory = await DbHelp.db.Queryable().Where(t => t.MatSN == request.MatSn).FirstAsync();
- if (inventory != null)
- {
- return new ResponseCommon()
- {
- Code = 201,
- Message = $"操作失败:物料{inventory.MatSN}已入库!库位为{inventory.StoreCode}",
- };
- }
-
- IShelfBase shelf = null;
- if (!request.SingleLightIn)
- {
- //获取货架
- shelf = ShelfManager.Shelves.Where(t => t.ShelfCode == request.ShelfCode).FirstOrDefault();
- if (shelf == null)//货架不存在
- {
- return new ResponseCommon()
- {
- Code = 201,
- Message = $"操作失败:货架[{request.ShelfCode}]不存在!",
- };
- }
- //判断当前是否是入库模式
- if (shelf.CurrentMode != Mode.入库模式)
- {
- return new ResponseCommon()
- {
- Code = 201,
- Message = $"操作失败:货架[{request.ShelfCode}]不在入库模式!\r\n当前为{shelf.CurrentMode}",
- };
- }
- }
-
- #region 获取物料数据 //调用接口或者直接查询数据库
- // 调用接口
- if (LocalFile.Config.IsAccessWMS)
- {
- #region 调用WMS接口获取物料信息
- try
- {
- var body = new
- {
- materialBar = request.MatSn
- };
- var Result = ApiHelp.GetDataFromHttp>>("http://192.168.2.23:9213/integrate/instock/queryBybar", body, "POST", true);
-
- //查询到物料信息
- if (Result != null && Result.Code == 200 && Result.Data != null && Result.Data.Count > 0)
- {
- var data = Result.Data.First();
- if (!request.SingleLightIn && shelf != null)
- shelf.InStoreData = new MatInfoResponse()
- {
- materialBar = data.materialBar,
- materialCode = data.materialCode,
- materialName = data.materialName,
- materialQty = data.materialQty,
- materialSpec = data.materialSpec,
- batchNo = data.batchNo,
- supplier = "",
- customer = "",
-
- InstoreUser = request.UserName
- };
-
- var matInfo = new MatInfo()
- {
- MatSn = data.materialBar,
- MatCode = data.materialCode,
- MatName = data.materialName,
- MatBatch = data.batchNo,
- MatQty = (int)data.materialQty,
- MatSpec = data.materialSpec,
- MatSupplier = "",
- MatCustomer = "",
- };
-
- return new ResponseCommon()
- {
- Code = 200,
- Data = matInfo,
- Message = "success"
- };
- }
- else if (Result != null && Result.Code == 200 && Result.Data == null)
- {
- //Mes系统中未获取到物料信息
-
- //简单校验看是否满足海康物料
- //海康物料 只扫了外箱码 未扫条码
- if ((request.MatSn.Length == 54 || request.MatSn.Length == 56) && !request.MatSn.Contains("\\") && !request.MatSn.Contains("/"))
- {
-
- if (!request.SingleLightIn && shelf != null)
- shelf.InStoreData = new MatInfoResponse()
- {
- materialBar = request.MatSn,
- materialCode = "暂时未知",
- materialName = "暂时未知",
- materialQty = 0,
- materialSpec = "暂时未知",
- batchNo = "暂时未知",
- supplier = "",
- customer = "",
-
- InstoreUser = request.UserName
- };
-
- var matInfo = new MatInfo()
- {
- MatSn = request.MatSn,
- MatCode = "暂时未知",
- MatName = "暂时未知",
- MatBatch = "暂时未知",
- MatQty = 0,
- MatSpec = "暂时未知",
- MatSupplier = "",
- MatCustomer = "",
- };
-
- return new ResponseCommon()
- {
- Code = 200,
- Data = matInfo,
- Message = "success"
- };
- }
-
- return new ResponseCommon()
- {
- Code = 201,
- Message = $"操作失败:调用Mes接口未获取到物料信息!",
- };
- }
- else
- {
- return new ResponseCommon()
- {
- Code = 201,
- Message = $"操作失败:调用Mes接口失败!",
- };
- }
- }
- catch (Exception e)
- {
- return new ResponseCommon()
- {
- Code = 300,
- Message = $"操作失败:调用Mes接口发生异常{e.Message}",
- };
- }
- #endregion
- }
- //查询数据库是否存在这个物料
- else
- {
- var matInfo = await DbHelp.db.Queryable().Where(t => t.MatSn == request.MatSn).FirstAsync();
- if (matInfo != null)
- {
- //TODO 改成wcs的实体
- if (!request.SingleLightIn && shelf != null)
- shelf.InStoreData = new MatInfoResponse()
- {
- materialBar = matInfo.MatSn,
- materialCode = matInfo.MatCode,
- materialName = matInfo.MatName,
- materialQty = matInfo.MatQty,
- materialSpec = matInfo.MatSpec,
- batchNo = matInfo.MatBatch,
- supplier = matInfo.MatSupplier,
- customer = matInfo.MatCustomer,
-
- InstoreUser = request.UserName
- };
-
- return new ResponseCommon()
- {
- Code = 200,
- Data = matInfo,
- Message = "success"
- };
- }
- else
- return new ResponseCommon()
- {
- Code = 201,
- Data = null,
- Message = $"不存在物料{request.MatSn}"
- };
- }
- #endregion
- }
-
- ///
- /// 单灯出库时查询物料信息 这里返回库存的数据
- ///
- ///
- ///
- public async Task queryByMatSnOut(QueryByMatSnRequest request)
- {
- //判断物料是否已入库
- var inventory = await DbHelp.db.Queryable().Where(t => t.MatSN == request.MatSn).FirstAsync();
- if (inventory == null)
- {
- return new ResponseCommon()
- {
- Code = 201,
- Message = $"操作失败:物料不在库存内,无法进行出库!",
- };
- }
- else
- {
- return new ResponseCommon()
- {
- Code = 200,
- Message = $"Success",
- Data = new MatInfo()
- {
- MatSn = inventory.MatSN,
- MatCode = inventory.MatCode,
- MatName = inventory.MatName,
- MatBatch = inventory.MatBatch,
- MatQty = inventory.MatQty,
- MatSpec = inventory.MatSpec,
- MatSupplier = inventory.MatSupplier,
- MatCustomer = inventory.MatCustomer,
- }
- };
- }
- }
-
- public async Task queryInstoreStatus(QueryByMatSnRequest request)
- {
- //获取货架
- var shelf = ShelfManager.Shelves.Where(t => t.ShelfCode == request.ShelfCode).FirstOrDefault();
- if (shelf == null)//货架不存在
- {
- return new ResponseCommon()
- {
- Code = 201,
- Message = $"货架[{request.ShelfCode}]不存在!",
- };
- }
-
- //判断当前是否是入库模式
- if (shelf.CurrentMode != Mode.入库模式)
- {
- return new ResponseCommon()
- {
- Code = 201,
- Message = $"货架[{request.ShelfCode}]已退出入库模式!\r\n当前为{shelf.CurrentMode}",
- };
- }
-
- //TODO 配置这个时间相当于需要入库扫码后需要等待的时间
- var timeOut = 5000;
- var timeSpan = TimeSpan.FromMilliseconds(0);
- var beginTime = DateTime.Now;
- while (timeSpan <= TimeSpan.FromMilliseconds(timeOut))
- {
- timeSpan = DateTime.Now - beginTime;
- //已入库当前扫码的物料时 查询数据库
- if (shelf.InStoreData == null || (shelf.InStoreData as object) == null)
- {
- await Task.Delay(50);
- var inventoryDetail = DbHelp.db.Queryable()
- .Where(t => t.MatSN == request.MatSn)
- .First();
- if (inventoryDetail != null)
- {
- return new ResponseCommon()
- {
- Code = 200,
- Message = $"入库成功!物料已放入库位{inventoryDetail.StoreCode}",
- Data = new
- {
- StoreCode = inventoryDetail.StoreCode,
- }
- };
- }
- else
- break;
- }
- //延时处理
- Thread.Sleep(50);
- }
- //超时未成功入库
- shelf.InStoreData = null;
- return new ResponseCommon()
- {
- Code = 201,
- Message = $"超时未入库!请重新扫码后入库!",
- Data = new
- {
- StoreCode = string.Empty,
- }
- };
- }
-
- public async Task queryInstoreStatusSingle(QueryByMatSnRequestSingle request)
- {
- //获取货架
- //var shelf = ShelfManager.Shelves.Where(t => t.ShelfCode == request.ShelfCode).FirstOrDefault();
- //if (shelf == null)//货架不存在
- //{
- // return new ResponseCommon()
- // {
- // Code = 201,
- // Message = $"货架[{request.ShelfCode}]不存在!",
- // };
- //}
- List MI = DbHelp.db.Queryable().Where(it => it.ModuleCode == request.ShelfCode).ToList();
- if (MI.Count == 0)
- {
- return new ResponseCommonSingle()
- {
- Code = 201,
- Message = $"货架[{request.ShelfCode}]不存在!",
- };
- }
- ResponseCommonSingle rcs = new ResponseCommonSingle();
- rcs.Data = new List();
-
- string sendIP = MI[0].CleintIp; //单灯IP
- int PCBId = MI[0].BoardId; //单灯PCB板ID
-
- List SI = DbHelp.db.Queryable().Where(it => it.ModuleCode == request.ShelfCode).ToList();
-
- List si = DbHelp.db.Queryable().Where(it => it.ShelfCode == MI[0].ShelfCode).ToList();
- int warnLightID = si[0].LightId;
-
- foreach (QueryByMatSnRequestSingle.MatSnListDetail matSnListDetail in request.MatSnList)
- {
- Detail detail = new Detail();
- try
- {
- InventoryDetail inventoryDetail = new InventoryDetail();
- inventoryDetail.MatSN = matSnListDetail.MatSn;
- inventoryDetail.MatCode = matSnListDetail.MatCode;
- inventoryDetail.MatName = matSnListDetail.MatName;
- inventoryDetail.MatSpec = matSnListDetail.MatSpec;
- inventoryDetail.MatBatch = matSnListDetail.MatBatch;
- inventoryDetail.MatQty = matSnListDetail.MatQty;
- inventoryDetail.MatCustomer = matSnListDetail.MatCustomer;
- inventoryDetail.MatSupplier = matSnListDetail.MatSupplier;
- inventoryDetail.StoreCode = request.ShelfCode;
- inventoryDetail.StoreId = SI[0].Id;
-
- int count = DbHelp.db.Insertable(inventoryDetail).ExecuteCommand();
-
- InOutRecord ior = new InOutRecord();
- ior.MatSN = matSnListDetail.MatSn;
- ior.MatCode = matSnListDetail.MatCode;
- ior.MatName = matSnListDetail.MatName;
- ior.MatSpec = matSnListDetail.MatSpec;
- ior.MatBatch = matSnListDetail.MatBatch;
- ior.MatQty = matSnListDetail.MatQty;
- ior.MatCustomer = matSnListDetail.MatCustomer;
- ior.MatSupplier = matSnListDetail.MatSupplier;
- ior.StoreCode = request.ShelfCode;
- ior.StoreId = SI[0].Id;
- ior.Direction = DirectionEnum.入库;
- ior.OperateTime = DateTime.Now;
- ior.OperateUser = request.UserName;
- int count1 = DbHelp.db.Insertable(ior).ExecuteCommand();
-
- detail.matsn = matSnListDetail.MatSn;
- detail.result = "入库成功";
- rcs.Data.Add(detail);
- }
- catch (Exception ee)
- {
- detail.matsn = matSnListDetail.MatSn;
- detail.result = "入库失败";
- detail.reason = ee.Message;
- rcs.Data.Add(detail);
- }
- }
- //亮灯
- TCPClient tCPClient = TCPClientManager.GetTCPClientByIPHost(sendIP);
-<<<<<<< HEAD
- //byte[] data1 = new byte[8];
- //data1[0] = 0xff;
- //data1[1] = 0x02;
- //data1[2] = 0x00;
- //data1[3] = 0x0a;
- //data1[4] = (byte)warnLightID;
- //data1[5] = 0x03;
- //data1[6] = 0x02;
- //data1[7] = 0x02;
- //byte[] senddata1 = Tool.Helper.Crc16(data1, data1.Length, true);
- byte[] senddata1 = Tool.Helper.InstoreWarnLight(warnLightID);
-=======
- byte[] data1 = new byte[8];
- data1[0] = 0xff;
- data1[1] = 0x02;
- data1[2] = 0x00;
- data1[3] = 0x0a;
- data1[4] = (byte)warnLightID;
- data1[5] = 0x03;
- data1[6] = 0x02;
- data1[7] = 0x02;
- byte[] senddata1 = Tool.Helper.Crc16(data1, data1.Length, false);
->>>>>>> 11
- tCPClient.Send(senddata1); //报警灯短亮一次
-
- //byte[] data2 = new byte[8];
- //data2[0] = 0xff;
- //data2[1] = 0x01;
- //data2[2] = 0x00;
- //data2[3] = 0x0a;
- //data2[4] = 0x01;
- //data2[5] = (byte)PCBId;
- //data2[6] = 0x03;
- //data2[7] = 0x02;
- //byte[] senddata2 = Tool.Helper.Crc16(data2, data2.Length, true);
- byte[] senddata2 = Tool.Helper.InstoreLight(PCBId);
- tCPClient.Send(senddata2); //库位灯短亮一次
-
- return new ResponseCommonSingle()
- {
- Code = 200,
- Message = $"入库成功!",
- Data = rcs.Data,
- };
-
- }
- }
-}
diff --git a/WCS.BLL/Services/Service/MXL4Service.cs b/WCS.BLL/Services/Service/MXL4Service.cs
new file mode 100644
index 0000000..7bc3678
--- /dev/null
+++ b/WCS.BLL/Services/Service/MXL4Service.cs
@@ -0,0 +1,125 @@
+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> sysOrderMXL4(SysOrderMXL4Request request)
+ {
+ try
+ {
+ //第一步:获取所有库位码 校验库位在数据库中是否都存在
+ var storeCodeList = request.List.Select(t => t.StoreCode)
+ .Distinct()
+ .ToList();
+ var stores = DbHelp.db.Queryable()
+ .LeftJoin((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