1
This commit is contained in:
@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 工号
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnName = "user_name", Length = 50, IsNullable = true, ColumnDescription = "创建人")]
|
|
||||||
public string UserName { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
49
WCS.BLL/DbModels/MatInfoLog.cs
Normal file
49
WCS.BLL/DbModels/MatInfoLog.cs
Normal file
@ -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
|
||||||
|
{
|
||||||
|
///<summary>
|
||||||
|
///物料信息表
|
||||||
|
///</summary>
|
||||||
|
[SugarTable("wcs_mat_info_log")]
|
||||||
|
public class MatInfoLog
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 主键 Id 自增
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料编码
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "mat_Sn", Length = 200, IsNullable = false, ColumnDescription = "物料唯一码")]
|
||||||
|
public string MatSn { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新信息
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "info", Length = 200, IsNullable = false, ColumnDescription = "更新信息")]
|
||||||
|
public string Info { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料数量
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "mat_qty", IsNullable = false, ColumnDescription = "物料数量")]
|
||||||
|
public int MatQty { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:更新时间
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "modify_time", IsNullable = true, ColumnDescription = "更新时间")]
|
||||||
|
public DateTime? ModifyTime { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
121
WCS.BLL/DbModels/Task/CurrentTask.cs
Normal file
121
WCS.BLL/DbModels/Task/CurrentTask.cs
Normal file
@ -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
|
||||||
|
{
|
||||||
|
/// <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
|
||||||
|
}
|
||||||
|
}
|
125
WCS.BLL/DbModels/Task/FinishedTask.cs
Normal file
125
WCS.BLL/DbModels/Task/FinishedTask.cs
Normal file
@ -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
|
||||||
|
{
|
||||||
|
/// <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
|
||||||
|
}
|
||||||
|
}
|
125
WCS.BLL/DbModels/Task/UploadedTask.cs
Normal file
125
WCS.BLL/DbModels/Task/UploadedTask.cs
Normal file
@ -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
|
||||||
|
{
|
||||||
|
/// <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
|
||||||
|
}
|
||||||
|
}
|
@ -72,7 +72,7 @@ namespace WCS.BLL.Manager
|
|||||||
, typeof(InventoryDetail), typeof(OutOrder), typeof(OutOrderDetail), typeof(OutOrderMatDetail)
|
, typeof(InventoryDetail), typeof(OutOrder), typeof(OutOrderDetail), typeof(OutOrderMatDetail)
|
||||||
, typeof(ShelfTypeInfo), typeof(MatBaseInfo), typeof(MatInfo)
|
, typeof(ShelfTypeInfo), typeof(MatBaseInfo), typeof(MatInfo)
|
||||||
, typeof(StockTakingOrder), typeof(StockTakingOrderMatDetail), typeof(InOutRecord)
|
, typeof(StockTakingOrder), typeof(StockTakingOrderMatDetail), typeof(InOutRecord)
|
||||||
, typeof(DocumentSerialNumber),typeof(OrderLight)
|
, typeof(DocumentSerialNumber),typeof(OrderLight),typeof(MatInfoLog)
|
||||||
);
|
);
|
||||||
Logs.Write("【初始化数据库】db建表", LogsType.StartBoot);
|
Logs.Write("【初始化数据库】db建表", LogsType.StartBoot);
|
||||||
|
|
||||||
|
@ -60,6 +60,14 @@ namespace WCS.BLL.Manager
|
|||||||
return EasyTask.CompletedTask;
|
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++)
|
for (int index = 0; index < data.Length - TcpCleint.PreFixLength; index++)
|
||||||
{
|
{
|
||||||
//协议拆包 通过前缀校验是否为完整数据包
|
//协议拆包 通过前缀校验是否为完整数据包
|
||||||
|
20
WCS.BLL/Services/IService/IMXL4Service.cs
Normal file
20
WCS.BLL/Services/IService/IMXL4Service.cs
Normal file
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 处理、查询报警使用的服务
|
||||||
|
/// </summary>
|
||||||
|
public interface IMXL4Service
|
||||||
|
{
|
||||||
|
public Task<ResponseCommon<object>> sysOrderMXL4(SysOrderMXL4Request request);
|
||||||
|
}
|
||||||
|
}
|
19
WCS.BLL/Services/IService/ISingleLightService.cs
Normal file
19
WCS.BLL/Services/IService/ISingleLightService.cs
Normal file
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 处理、查询报警使用的服务
|
||||||
|
/// </summary>
|
||||||
|
public interface ISingleLightService
|
||||||
|
{
|
||||||
|
public Task<ResponseCommon<object>> SingleLightControl(SingleLightControlRequest request);
|
||||||
|
}
|
||||||
|
}
|
22
WCS.BLL/Services/IService/IUploadService.cs
Normal file
22
WCS.BLL/Services/IService/IUploadService.cs
Normal file
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 处理、查询报警使用的服务
|
||||||
|
/// </summary>
|
||||||
|
public interface IUploadService
|
||||||
|
{
|
||||||
|
public Task<ResponseBase> UploadReelInfo(UploadReelInfoRequest request);
|
||||||
|
|
||||||
|
public Task<ResponseBase> GetReelInfo(string MatSn);
|
||||||
|
}
|
||||||
|
}
|
@ -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<ResponseBase> queryByMatSn(QueryByMatSnRequest request)
|
|
||||||
{
|
|
||||||
//判断物料是否已入库
|
|
||||||
var inventory = await DbHelp.db.Queryable<InventoryDetail>().Where(t => t.MatSN == request.MatSn).FirstAsync();
|
|
||||||
if (inventory != null)
|
|
||||||
{
|
|
||||||
return new ResponseCommon<MatInfo>()
|
|
||||||
{
|
|
||||||
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<MatInfo>()
|
|
||||||
{
|
|
||||||
Code = 201,
|
|
||||||
Message = $"操作失败:货架[{request.ShelfCode}]不存在!",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
//判断当前是否是入库模式
|
|
||||||
if (shelf.CurrentMode != Mode.入库模式)
|
|
||||||
{
|
|
||||||
return new ResponseCommon<MatInfo>()
|
|
||||||
{
|
|
||||||
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<ResponseCommon<List<queryByBarResponse>>>("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<MatInfo>()
|
|
||||||
{
|
|
||||||
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<MatInfo>()
|
|
||||||
{
|
|
||||||
Code = 200,
|
|
||||||
Data = matInfo,
|
|
||||||
Message = "success"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ResponseCommon<MatInfo>()
|
|
||||||
{
|
|
||||||
Code = 201,
|
|
||||||
Message = $"操作失败:调用Mes接口未获取到物料信息!",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return new ResponseCommon<MatInfo>()
|
|
||||||
{
|
|
||||||
Code = 201,
|
|
||||||
Message = $"操作失败:调用Mes接口失败!",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return new ResponseCommon<MatInfo>()
|
|
||||||
{
|
|
||||||
Code = 300,
|
|
||||||
Message = $"操作失败:调用Mes接口发生异常{e.Message}",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
//查询数据库是否存在这个物料
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var matInfo = await DbHelp.db.Queryable<MatInfo>().Where(t => t.MatSn == request.MatSn).FirstAsync();
|
|
||||||
if (matInfo != null)
|
|
||||||
{
|
|
||||||
//TODO 改成wcs的实体
|
|
||||||
if (!request.SingleLightIn && shelf != null)
|
|
||||||
shelf.InStoreData = new MatInfoResponse()
|
|
||||||
{
|
|
||||||
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<MatInfo>()
|
|
||||||
{
|
|
||||||
Code = 200,
|
|
||||||
Data = matInfo,
|
|
||||||
Message = "success"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return new ResponseCommon<MatInfo>()
|
|
||||||
{
|
|
||||||
Code = 201,
|
|
||||||
Data = null,
|
|
||||||
Message = $"不存在物料{request.MatSn}"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 单灯出库时查询物料信息 这里返回库存的数据
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="request"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task<ResponseBase> queryByMatSnOut(QueryByMatSnRequest request)
|
|
||||||
{
|
|
||||||
//判断物料是否已入库
|
|
||||||
var inventory = await DbHelp.db.Queryable<InventoryDetail>().Where(t => t.MatSN == request.MatSn).FirstAsync();
|
|
||||||
if (inventory == null)
|
|
||||||
{
|
|
||||||
return new ResponseCommon<MatInfo>()
|
|
||||||
{
|
|
||||||
Code = 201,
|
|
||||||
Message = $"操作失败:物料不在库存内,无法进行出库!",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return new ResponseCommon<MatInfo>()
|
|
||||||
{
|
|
||||||
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<ResponseBase> 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<InventoryDetail>()
|
|
||||||
.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<ResponseBase> 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<ModuleInfo> MI = DbHelp.db.Queryable<ModuleInfo>().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<Detail>();
|
|
||||||
|
|
||||||
string sendIP = MI[0].CleintIp; //单灯IP
|
|
||||||
int PCBId = MI[0].BoardId; //单灯PCB板ID
|
|
||||||
|
|
||||||
List<StoreInfo> SI = DbHelp.db.Queryable<StoreInfo>().Where(it => it.ModuleCode == request.ShelfCode).ToList();
|
|
||||||
|
|
||||||
List<ShelfInfo> si = DbHelp.db.Queryable<ShelfInfo>().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,
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
125
WCS.BLL/Services/Service/MXL4Service.cs
Normal file
125
WCS.BLL/Services/Service/MXL4Service.cs
Normal file
@ -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<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,
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -386,9 +386,9 @@ namespace WCS.BLL.Services.Service
|
|||||||
if (request.IsFromBaseData)
|
if (request.IsFromBaseData)
|
||||||
{
|
{
|
||||||
matCodeList = await DbHelp.db.Queryable<MatBaseInfo>()
|
matCodeList = await DbHelp.db.Queryable<MatBaseInfo>()
|
||||||
|
.OrderBy(t => t.MatCode)
|
||||||
.Select(t => t.MatCode)
|
.Select(t => t.MatCode)
|
||||||
.Distinct()
|
.Distinct()
|
||||||
.OrderBy(t => t)
|
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -396,7 +396,6 @@ namespace WCS.BLL.Services.Service
|
|||||||
matCodeList = await DbHelp.db.Queryable<InventoryDetail>()
|
matCodeList = await DbHelp.db.Queryable<InventoryDetail>()
|
||||||
.Select(t => t.MatCode)
|
.Select(t => t.MatCode)
|
||||||
.Distinct()
|
.Distinct()
|
||||||
.OrderBy(t => t)
|
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
return new ResponseCommon<List<string>>()
|
return new ResponseCommon<List<string>>()
|
||||||
|
@ -1345,7 +1345,7 @@ namespace WCS.BLL.Services.Service
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//发送间隔
|
//发送间隔
|
||||||
Thread.Sleep(300);
|
//Thread.Sleep(300);
|
||||||
foreach (string shelfcode in WarnLightShelfCode)
|
foreach (string shelfcode in WarnLightShelfCode)
|
||||||
{
|
{
|
||||||
List<ShelfInfo> si = DbHelp.db.Queryable<ShelfInfo>().Where(it => it.ShelfCode == shelfcode).ToList();
|
List<ShelfInfo> si = DbHelp.db.Queryable<ShelfInfo>().Where(it => it.ShelfCode == shelfcode).ToList();
|
||||||
@ -1353,12 +1353,11 @@ namespace WCS.BLL.Services.Service
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < si.Count; i++)
|
for (int i = 0; i < si.Count; i++)
|
||||||
{
|
{
|
||||||
|
Thread.Sleep(250);
|
||||||
TCPClient tCPClient = TCPClientManager.GetTCPClientByIPHost(si[i].ClientIp);
|
TCPClient tCPClient = TCPClientManager.GetTCPClientByIPHost(si[i].ClientIp);
|
||||||
//byte[] warnlightOn = Helper.OutstoreWarnLight(si[i].LightId, LightColor, 0, 0);
|
|
||||||
byte[] warnlightOn = Helper.OutstoreWarnLight_1(si[i].LightId, LightColor, 0, 0);
|
byte[] warnlightOn = Helper.OutstoreWarnLight_1(si[i].LightId, LightColor, 0, 0);
|
||||||
tCPClient.Send(warnlightOn);
|
tCPClient.Send(warnlightOn);
|
||||||
Logs.Write("出库,报警灯灭:" + BitConverter.ToString(warnlightOn));
|
Logs.Write("出库,报警灯灭:" + BitConverter.ToString(warnlightOn));
|
||||||
Thread.Sleep(100);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
152
WCS.BLL/Services/Service/SingleLightService.cs
Normal file
152
WCS.BLL/Services/Service/SingleLightService.cs
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using TouchSocket.Core;
|
||||||
|
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.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 SingleLightService : ISingleLightService
|
||||||
|
{
|
||||||
|
public async Task<ResponseCommon<object>> SingleLightControl(SingleLightControlRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//传入数据校验
|
||||||
|
if (request.StoreList == null || request.StoreList.Count == 0)
|
||||||
|
{
|
||||||
|
return new ResponseCommon<object>()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = "操作失败:没有需要控制的库位",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
//对应库位
|
||||||
|
var storeCodes = request.StoreList.Select(t => t.StoreCode)
|
||||||
|
.Distinct()
|
||||||
|
.ToList();
|
||||||
|
var stores = DbHelp.db.Queryable<StoreInfo>().Where(t => storeCodes.Contains(t.StoreCode))
|
||||||
|
.ToList();
|
||||||
|
if (stores == null || stores.Count == 0)
|
||||||
|
{
|
||||||
|
return new ResponseCommon<object>
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"操作失败:所有库位不存在!"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
//对应货架(获取TCP和报警灯ID)
|
||||||
|
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();
|
||||||
|
|
||||||
|
//加载请求参数中的库位灯 板子ID和货架ID
|
||||||
|
foreach (var store in request.StoreList)
|
||||||
|
{
|
||||||
|
var storeInDb = stores.Where(t => t.StoreCode == store.StoreCode).FirstOrDefault();
|
||||||
|
if (storeInDb == null)
|
||||||
|
{
|
||||||
|
return new ResponseCommon<object>
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"操作失败:库位{store.StoreCode}不存在(store)!"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
store.ShelfId = storeInDb.ShelfId;
|
||||||
|
|
||||||
|
var moduleInDb = modules.Where(t => t.Id == storeInDb.ModuleId).FirstOrDefault();
|
||||||
|
if (moduleInDb == null)
|
||||||
|
{
|
||||||
|
return new ResponseCommon<object>
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"操作失败:库位{store.StoreCode}不存在(module)!"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
store.BoardId = moduleInDb.BoardId;
|
||||||
|
}
|
||||||
|
|
||||||
|
//合并:同一个货架的库位合并
|
||||||
|
var shelfModels = new List<SingleLightShelfModel>();
|
||||||
|
foreach (var shelf in shelfs)
|
||||||
|
{
|
||||||
|
var shelfModel = new SingleLightShelfModel();
|
||||||
|
//报警灯
|
||||||
|
shelfModel.WarningLightMode = request.WarningLightMode;
|
||||||
|
shelfModel.WarningBuzzerMode = request.WarningBuzzerMode;
|
||||||
|
shelfModel.WarningLightColor = request.WarningLightColor;
|
||||||
|
shelfModel.WarningBoardId = shelf.LightId;
|
||||||
|
shelfModel.ClientIp = shelf.ClientIp;
|
||||||
|
//库位
|
||||||
|
var storesThisShelf = request.StoreList
|
||||||
|
.Where(t => t.ShelfId == shelf.Id)
|
||||||
|
.ToList();
|
||||||
|
foreach (var storeThisShelf in storesThisShelf)
|
||||||
|
{
|
||||||
|
shelfModel.StoreList.Add(new SingleLightStoreModel()
|
||||||
|
{
|
||||||
|
BoardId = storeThisShelf.BoardId,
|
||||||
|
LightColor = storeThisShelf.LightColor,
|
||||||
|
LightMode = storeThisShelf.LightMode,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
shelfModels.Add(shelfModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
//合并:同一个TCP的货架合并 报警灯和库位灯统一只发送一条指令
|
||||||
|
var clientIpList = shelfs.Select(t => t.ClientIp)
|
||||||
|
.Distinct()
|
||||||
|
.ToList();
|
||||||
|
foreach (var clientIp in clientIpList)
|
||||||
|
{
|
||||||
|
var shelfModelsInOneIp = shelfModels.Where(t => t.ClientIp == clientIp).ToList();
|
||||||
|
var sendData = Helper.SingleLightControl(shelfModelsInOneIp);
|
||||||
|
|
||||||
|
TCPClient tCPClient = TCPClientManager.GetTCPClientByIPHost(clientIp);
|
||||||
|
tCPClient.Send(sendData);
|
||||||
|
Logs.Write("【单灯单独控制】发送指令" + BitConverter.ToString(sendData));
|
||||||
|
}
|
||||||
|
|
||||||
|
//返回成功
|
||||||
|
return new ResponseCommon<object>()
|
||||||
|
{
|
||||||
|
Code = 200,
|
||||||
|
Message = "success",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
//操作失败
|
||||||
|
return new ResponseCommon<object>()
|
||||||
|
{
|
||||||
|
Code = 300,
|
||||||
|
Message = $"操作失败:{ex.Message}",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
136
WCS.BLL/Services/Service/UploadService.cs
Normal file
136
WCS.BLL/Services/Service/UploadService.cs
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
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.SingleLight;
|
||||||
|
using WCS.Model.ApiModel.UpLoad;
|
||||||
|
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 UploadService : IUploadService
|
||||||
|
{
|
||||||
|
public async Task<ResponseBase> GetReelInfo(string MatSn)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(MatSn))
|
||||||
|
{
|
||||||
|
return new ResponseBase<object>()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = "操作失败:条码不能为空"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询物料条码是否存在
|
||||||
|
var matInfo = await DbHelp.db.Queryable<MatInfo>()
|
||||||
|
.Where(t => t.MatSn == MatSn)
|
||||||
|
.FirstAsync();
|
||||||
|
return new ResponseBase<object>()
|
||||||
|
{
|
||||||
|
Code = 200,
|
||||||
|
Message = "success",
|
||||||
|
Data = new
|
||||||
|
{
|
||||||
|
MatSN = matInfo?.MatSn,
|
||||||
|
Qty = matInfo?.MatQty
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ResponseBase> UploadReelInfo(UploadReelInfoRequest request)
|
||||||
|
{
|
||||||
|
//校验参数
|
||||||
|
if (string.IsNullOrEmpty(request.MatSN) || request.Qty <= 0)
|
||||||
|
{
|
||||||
|
return new ResponseBase()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = "操作失败:条码或数量不合法!"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询物料条码是否存在
|
||||||
|
var matInfo = await DbHelp.db.Queryable<MatInfo>()
|
||||||
|
.Where(t => t.MatSn == request.MatSN)
|
||||||
|
.FirstAsync();
|
||||||
|
|
||||||
|
if (matInfo == null)
|
||||||
|
{
|
||||||
|
return new ResponseBase()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"操作失败:不存在此条码【{request.MatSN}】"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
//是否在库存中
|
||||||
|
var inventoryDetail = await DbHelp.db.Queryable<InventoryDetail>()
|
||||||
|
.Where(t => t.MatSN == request.MatSN)
|
||||||
|
.FirstAsync();
|
||||||
|
|
||||||
|
if (inventoryDetail != null)
|
||||||
|
{
|
||||||
|
return new ResponseBase()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"操作失败:此条码在库位{inventoryDetail.StoreCode}上,请下架后再进行操作。"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DbHelp.db.BeginTran();
|
||||||
|
|
||||||
|
//记录日志
|
||||||
|
var MatInfoLog = new MatInfoLog()
|
||||||
|
{
|
||||||
|
MatQty = request.Qty,
|
||||||
|
MatSn = request.MatSN,
|
||||||
|
Info = $"[{request.IPAddress}]数量从{matInfo.MatQty}修改为{request.Qty}!"
|
||||||
|
};
|
||||||
|
DbHelp.db.Insertable(MatInfoLog).ExecuteCommand();
|
||||||
|
|
||||||
|
|
||||||
|
//修改数量
|
||||||
|
matInfo.MatQty = request.Qty;
|
||||||
|
DbHelp.db.Updateable(matInfo).ExecuteCommand();
|
||||||
|
|
||||||
|
DbHelp.db.CommitTran();
|
||||||
|
return new ResponseBase()
|
||||||
|
{
|
||||||
|
Code = 200,
|
||||||
|
Message = "success"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
DbHelp.db.RollbackTran();
|
||||||
|
return new ResponseBase()
|
||||||
|
{
|
||||||
|
Code = 300,
|
||||||
|
Message = "操作失败:" + ex.Message
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using Newtonsoft.Json.Linq;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -83,7 +84,6 @@ namespace WCS.BLL.Tool
|
|||||||
}
|
}
|
||||||
return data.ToArray();
|
return data.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] Query()
|
public static byte[] Query()
|
||||||
{
|
{
|
||||||
byte[] data2 = new byte[4];
|
byte[] data2 = new byte[4];
|
||||||
@ -94,7 +94,6 @@ namespace WCS.BLL.Tool
|
|||||||
byte[] senddata2 = Tool.Helper.Crc16(data2, data2.Length, true);
|
byte[] senddata2 = Tool.Helper.Crc16(data2, data2.Length, true);
|
||||||
return senddata2;
|
return senddata2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] SetId()
|
public static byte[] SetId()
|
||||||
{
|
{
|
||||||
byte[] data2 = new byte[6];
|
byte[] data2 = new byte[6];
|
||||||
@ -107,7 +106,6 @@ namespace WCS.BLL.Tool
|
|||||||
byte[] senddata2 = Tool.Helper.Crc16(data2, data2.Length, true);
|
byte[] senddata2 = Tool.Helper.Crc16(data2, data2.Length, true);
|
||||||
return senddata2;
|
return senddata2;
|
||||||
}
|
}
|
||||||
|
|
||||||
//出库库位灯亮灯
|
//出库库位灯亮灯
|
||||||
public static byte[] OutstoreLight(List<int> board_id, string lightcolor, int status)
|
public static byte[] OutstoreLight(List<int> board_id, string lightcolor, int status)
|
||||||
{
|
{
|
||||||
@ -155,7 +153,6 @@ namespace WCS.BLL.Tool
|
|||||||
byte[] data = Crc16(data1, data1.Length, true);
|
byte[] data = Crc16(data1, data1.Length, true);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
//出库警示灯亮灯
|
//出库警示灯亮灯
|
||||||
public static byte[] OutstoreWarnLight(int lightid, string lightcolor, int status, int beestatus)
|
public static byte[] OutstoreWarnLight(int lightid, string lightcolor, int status, int beestatus)
|
||||||
{
|
{
|
||||||
@ -240,8 +237,6 @@ namespace WCS.BLL.Tool
|
|||||||
byte[] senddata1 = Tool.Helper.Crc16(data1, data1.Length, true);
|
byte[] senddata1 = Tool.Helper.Crc16(data1, data1.Length, true);
|
||||||
return senddata1;
|
return senddata1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static byte[] InstoreLightAndWarnLight(int board_id, int lightid)
|
public static byte[] InstoreLightAndWarnLight(int board_id, int lightid)
|
||||||
{
|
{
|
||||||
byte[] data1 = new byte[8 + 3 * 7];
|
byte[] data1 = new byte[8 + 3 * 7];
|
||||||
@ -340,6 +335,92 @@ namespace WCS.BLL.Tool
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 单灯货架控制
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="board_id"></param>
|
||||||
|
/// <param name="lightcolor"></param>
|
||||||
|
/// <param name="status"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static byte[] SingleLightControl(List<SingleLightShelfModel> shelfs)
|
||||||
|
{
|
||||||
|
byte[] dataBase = new byte[5];
|
||||||
|
dataBase[0] = 0xff;
|
||||||
|
dataBase[1] = 0x01;
|
||||||
|
|
||||||
|
//一个报警灯一个货架
|
||||||
|
var lightCount = 0;
|
||||||
|
foreach (var shelf in shelfs)
|
||||||
|
{
|
||||||
|
//6个报警灯需要发送指令
|
||||||
|
|
||||||
|
if (shelf.WarningLightMode != -1)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 6; i++)
|
||||||
|
{
|
||||||
|
var singleLightData = GenerateSingleLightData(shelf.WarningBoardId + i, shelf.WarningLightMode, shelf.WarningLightColor);
|
||||||
|
lightCount++;
|
||||||
|
dataBase = dataBase.Concat(singleLightData).ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//蜂鸣器需要发送指令
|
||||||
|
if (shelf.WarningBuzzerMode != -1)
|
||||||
|
{
|
||||||
|
var singleLightData = GenerateSingleLightData(shelf.WarningBoardId + 6, shelf.WarningBuzzerMode, shelf.WarningLightColor);
|
||||||
|
lightCount++;
|
||||||
|
dataBase = dataBase.Concat(singleLightData).ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
//库位灯指令
|
||||||
|
if (shelf.StoreList != null && shelf.StoreList.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var store in shelf.StoreList)
|
||||||
|
{
|
||||||
|
var singleLightData = GenerateSingleLightData(store.BoardId, store.LightMode, store.LightColor);
|
||||||
|
lightCount++;
|
||||||
|
dataBase = dataBase.Concat(singleLightData).ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] length_base = BitConverter.GetBytes(dataBase.Length + 2);
|
||||||
|
dataBase[2] = length_base[1];
|
||||||
|
dataBase[3] = length_base[0];
|
||||||
|
//控制灯的数量
|
||||||
|
dataBase[4] = (byte)lightCount;
|
||||||
|
|
||||||
|
byte[] dataWithCRC = Crc16(dataBase, dataBase.Length, true);
|
||||||
|
return dataWithCRC;
|
||||||
|
}
|
||||||
|
//单独拼接一个灯的协议
|
||||||
|
public static byte[] GenerateSingleLightData(int lightId, int lightMode, int lightColor)
|
||||||
|
{
|
||||||
|
var data = new byte[3];
|
||||||
|
|
||||||
|
data[0] = (byte)lightId;
|
||||||
|
data[1] = (byte)lightMode;
|
||||||
|
data[2] = (byte)lightColor;
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SingleLightShelfModel
|
||||||
|
{
|
||||||
|
public string ClientIp { get; set; } = string.Empty;
|
||||||
|
public int WarningBoardId { get; set; }
|
||||||
|
public int WarningLightMode { get; set; }
|
||||||
|
public int WarningBuzzerMode { get; set; }
|
||||||
|
public int WarningLightColor { get; set; }
|
||||||
|
public List<SingleLightStoreModel> StoreList { get; set; } = new List<SingleLightStoreModel>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SingleLightStoreModel
|
||||||
|
{
|
||||||
|
public int BoardId { get; set; }
|
||||||
|
public int LightMode { get; set; }
|
||||||
|
public int LightColor { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 返回数据处理
|
/// 返回数据处理
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -396,9 +477,9 @@ namespace WCS.BLL.Tool
|
|||||||
data1[6 + i * 3] = (byte)status;
|
data1[6 + i * 3] = (byte)status;
|
||||||
data1[7 + i * 3] = color;
|
data1[7 + i * 3] = color;
|
||||||
}
|
}
|
||||||
//data1[5 + 3 * 7 - 3] = (byte)(lightid + 6);
|
//dataBase[5 + 3 * 7 - 3] = (byte)(lightid + 6);
|
||||||
//data1[5 + 3 * 7 - 2] =(byte)beestatus;
|
//dataBase[5 + 3 * 7 - 2] =(byte)beestatus;
|
||||||
//data1[5 + 3 * 7 - 1] = 0x00;
|
//dataBase[5 + 3 * 7 - 1] = 0x00;
|
||||||
byte[] data2 = Crc16(data1, data1.Length, true);
|
byte[] data2 = Crc16(data1, data1.Length, true);
|
||||||
return data2;
|
return data2;
|
||||||
}
|
}
|
||||||
|
@ -100,17 +100,21 @@ namespace WCS.BLL
|
|||||||
{
|
{
|
||||||
//查询当前板子是否有待验证的指令
|
//查询当前板子是否有待验证的指令
|
||||||
var message = new MessageDto();
|
var message = new MessageDto();
|
||||||
var firstMessage = MessageList.Select(t => new { Id = t.Key ,Value = t.Value })
|
var firstMessage = MessageList.Select(t => new { Id = t.Key, Value = t.Value })
|
||||||
.OrderBy(t => t.Value.CreateTime)
|
.OrderBy(t => t.Value.CreateTime)
|
||||||
.First();
|
.First();
|
||||||
if (firstMessage != null)
|
if (firstMessage != null)
|
||||||
{
|
{
|
||||||
MessageList.TryRemove(firstMessage.Id, out message);
|
MessageList.TryRemove(firstMessage.Id, out message);
|
||||||
Logs.Write($"【信息化货架】以下指令已不重发:{BitConverter.ToString(firstMessage.Value.Message)}");
|
Logs.Write($"【信息化货架】以下指令已不重发:{BitConverter.ToString(firstMessage.Value.Message)}", LogsType.InstructionResend);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (ShelfTypeName == "液晶货架")
|
||||||
|
{
|
||||||
|
Logs.Write($"【液晶货架】接收到指令{BitConverter.ToString(data)}", LogsType.InstructionResend);
|
||||||
|
}
|
||||||
//智能货架
|
//智能货架
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -235,7 +239,7 @@ namespace WCS.BLL
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logs.Write("【发送指令时发生异常】" + ex.Message , LogsType.Instructions);
|
Logs.Write("【发送指令时发生异常】" + ex.Message, LogsType.Instructions);
|
||||||
//因异常断连时(网线已经被断了) 手动重连一次
|
//因异常断连时(网线已经被断了) 手动重连一次
|
||||||
if (ex is NotConnectedException)
|
if (ex is NotConnectedException)
|
||||||
{
|
{
|
||||||
|
69
WCS.Model/ApiModel/MXL4/SysOrderMXL4Request.cs
Normal file
69
WCS.Model/ApiModel/MXL4/SysOrderMXL4Request.cs
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
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>
|
||||||
|
/// 数量
|
||||||
|
/// </summary>
|
||||||
|
public int Qty { get; set; }
|
||||||
|
}
|
||||||
|
}
|
29
WCS.Model/ApiModel/MXL4/TaskEnum.cs
Normal file
29
WCS.Model/ApiModel/MXL4/TaskEnum.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
52
WCS.Model/ApiModel/SingleLight/SingleLightControlRequest.cs
Normal file
52
WCS.Model/ApiModel/SingleLight/SingleLightControlRequest.cs
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace WCS.Model.ApiModel.SingleLight
|
||||||
|
{
|
||||||
|
public class SingleLightControlRequest : RequestBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 巷道灯颜色 如果不传 默认为-1 不发送对应指令
|
||||||
|
/// </summary>
|
||||||
|
public int WarningLightColor { get; set; } = -1;
|
||||||
|
public int WarningLightMode { get; set; } = -1;
|
||||||
|
/// <summary>
|
||||||
|
/// 巷道灯蜂鸣器模式 如果不传 默认为-1 不发送对应指令
|
||||||
|
/// </summary>
|
||||||
|
public int WarningBuzzerMode { get; set; } = -1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 库位灯控制
|
||||||
|
/// </summary>
|
||||||
|
public List<StoreListItem> StoreList { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class StoreListItem
|
||||||
|
{
|
||||||
|
#region
|
||||||
|
/// <summary>
|
||||||
|
/// 库位编码
|
||||||
|
/// </summary>
|
||||||
|
public string StoreCode { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 货架Id
|
||||||
|
/// </summary>
|
||||||
|
public int ShelfId { get; set; } = 0;
|
||||||
|
/// <summary>
|
||||||
|
/// 板子Id
|
||||||
|
/// </summary>
|
||||||
|
public int BoardId { get; set; } = 0;
|
||||||
|
/// <summary>
|
||||||
|
/// 亮灯模式
|
||||||
|
/// </summary>
|
||||||
|
public int LightMode { get; set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 亮灯颜色
|
||||||
|
/// </summary>
|
||||||
|
public int LightColor { get; set; } = 0;
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
15
WCS.Model/ApiModel/UpLoad/UploadReelInfoRequest.cs
Normal file
15
WCS.Model/ApiModel/UpLoad/UploadReelInfoRequest.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace WCS.Model.ApiModel.UpLoad
|
||||||
|
{
|
||||||
|
public class UploadReelInfoRequest
|
||||||
|
{
|
||||||
|
public string MatSN { get; set; }
|
||||||
|
|
||||||
|
public int Qty { get; set; }
|
||||||
|
|
||||||
|
public string IPAddress { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,31 +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.Stocktaking;
|
|
||||||
using WCS.Model.ApiModel.User;
|
|
||||||
using WCS.Model.WebSocketModel;
|
|
||||||
|
|
||||||
namespace WCS.WebApi.Controllers
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 本地化Controller
|
|
||||||
/// </summary>
|
|
||||||
[ApiController]
|
|
||||||
[Route("[controller]")]
|
|
||||||
public class DIYController : ControllerBase
|
|
||||||
{
|
|
||||||
public DIYController()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Route("getStockTakingOrders")]
|
|
||||||
[HttpPost(Name = "getStockTakingOrders")]
|
|
||||||
public async Task<ResponseBase> getStockTakingOrders(GetStockTakingOrdersRequest request)
|
|
||||||
{
|
|
||||||
return await _stockTakingService.getStockTakingOrders(request);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
49
WCS.WebApi/Controllers/MXL4Controller.cs
Normal file
49
WCS.WebApi/Controllers/MXL4Controller.cs
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
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,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
48
WCS.WebApi/Controllers/SingleLightController.cs
Normal file
48
WCS.WebApi/Controllers/SingleLightController.cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
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.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 SingleLightController : ControllerBase
|
||||||
|
{
|
||||||
|
|
||||||
|
public ISingleLightService _singleLightService { get; set; }
|
||||||
|
|
||||||
|
public SingleLightController(ISingleLightService singleLightService)
|
||||||
|
{
|
||||||
|
_singleLightService = singleLightService;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Route("singleLightControl")]
|
||||||
|
[HttpPost(Name = "singleLightControl")]
|
||||||
|
public async Task<ResponseBase> SingleLightControl(SingleLightControlRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _singleLightService.SingleLightControl(request);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return new ResponseBase()
|
||||||
|
{
|
||||||
|
Code = 300,
|
||||||
|
Message = "操作失败:" + ex.Message,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
68
WCS.WebApi/Controllers/UpLoadController.cs
Normal file
68
WCS.WebApi/Controllers/UpLoadController.cs
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
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.SingleLight;
|
||||||
|
using WCS.Model.ApiModel.Stocktaking;
|
||||||
|
using WCS.Model.ApiModel.UpLoad;
|
||||||
|
using WCS.Model.ApiModel.User;
|
||||||
|
using WCS.Model.WebSocketModel;
|
||||||
|
|
||||||
|
namespace WCS.WebApi.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 本地化Controller 离线点料机上传数据
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("[controller]")]
|
||||||
|
public class UpLoadController : ControllerBase
|
||||||
|
{
|
||||||
|
public IUploadService _uploadService { get; set; }
|
||||||
|
public UpLoadController(IUploadService uploadService)
|
||||||
|
{
|
||||||
|
_uploadService = uploadService;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[Route("uploadReelInfo")]
|
||||||
|
[HttpPost(Name = "uploadReelInfo")]
|
||||||
|
public async Task<ResponseBase> uploadReelInfo(UploadReelInfoRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var IPAdress = HttpContext?.Connection?.RemoteIpAddress?.ToString();
|
||||||
|
request.IPAddress = IPAdress;
|
||||||
|
|
||||||
|
return await _uploadService.UploadReelInfo(request);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return new ResponseBase()
|
||||||
|
{
|
||||||
|
Code = 300,
|
||||||
|
Message = "操作失败:" + ex.Message,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Route("getReelInfo")]
|
||||||
|
[HttpGet(Name = "getReelInfo")]
|
||||||
|
public async Task<ResponseBase> getReelInfo(string MatSN)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _uploadService.GetReelInfo(MatSN);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return new ResponseBase()
|
||||||
|
{
|
||||||
|
Code = 300,
|
||||||
|
Message = "操作失败:" + ex.Message,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -70,6 +70,11 @@ namespace WebApi
|
|||||||
builder.Services.AddScoped<ISelfCheckService, SelfCheckService>();
|
builder.Services.AddScoped<ISelfCheckService, SelfCheckService>();
|
||||||
builder.Services.AddScoped<IWarningService, WarningService>();
|
builder.Services.AddScoped<IWarningService, WarningService>();
|
||||||
builder.Services.AddScoped<IInOutRecordService, InOutRecordService>();
|
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>ģʽ
|
//<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>();
|
builder.Services.AddSingleton<IGenerateService, GenerateService>();
|
||||||
|
|
||||||
|
@ -126,6 +126,7 @@ namespace 货架标准上位机.ViewModel
|
|||||||
FilterItems(value);
|
FilterItems(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ManualObservableCollection<DataModel> Items { get; set; } = new();
|
public ManualObservableCollection<DataModel> Items { get; set; } = new();
|
||||||
private List<DataModel> matCodes = new List<DataModel>();
|
private List<DataModel> matCodes = new List<DataModel>();
|
||||||
private void FilterItems(string key)
|
private void FilterItems(string key)
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
using HandyControl.Controls;
|
using HandyControl.Collections;
|
||||||
|
using HandyControl.Controls;
|
||||||
using HandyControl.Tools.Extension;
|
using HandyControl.Tools.Extension;
|
||||||
using Ping9719.WpfEx.Mvvm;
|
using Ping9719.WpfEx.Mvvm;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Security.Cryptography;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
@ -30,8 +33,68 @@ namespace 货架标准上位机.ViewModel
|
|||||||
get => matCode; set
|
get => matCode; set
|
||||||
{
|
{
|
||||||
SetProperty(ref matCode, value);
|
SetProperty(ref matCode, value);
|
||||||
|
|
||||||
|
App.Current.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
FilterItems(value);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (matCode.Length >= 8
|
||||||
|
|| matCodes.Where(t => t.MatCode == matCode).Any() )
|
||||||
|
{
|
||||||
|
GetMatBaseInfoRequest();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public ManualObservableCollection<DataModel> Items { get; set; } = new();
|
||||||
|
private List<DataModel> matCodes = new List<DataModel>();
|
||||||
|
private void FilterItems(string key)
|
||||||
|
{
|
||||||
|
//至少输入三个字符 避免删除或输入时界面变卡
|
||||||
|
if (string.IsNullOrEmpty(key) || key.Length < 3)
|
||||||
|
{
|
||||||
|
Items.Clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
key = key.ToUpper();
|
||||||
|
Items.CanNotify = false;
|
||||||
|
Items.Clear();
|
||||||
|
foreach (var matCode in matCodes)
|
||||||
|
{
|
||||||
|
if (matCode.MatCode.ToUpper().Contains(key))
|
||||||
|
{
|
||||||
|
Items.Add(matCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Items.CanNotify = true;
|
||||||
|
}
|
||||||
|
public class DataModel
|
||||||
|
{
|
||||||
|
public string MatCode { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InitMatCode()
|
||||||
|
{
|
||||||
|
//调用接口更新!
|
||||||
|
Task.Run(() =>
|
||||||
|
{
|
||||||
|
var body = new GetMatCodeListRequest()
|
||||||
|
{
|
||||||
|
IsFromBaseData = true,
|
||||||
|
UserName = LocalStatic.CurrentUser,
|
||||||
|
DeviceType = LocalFile.Config.DeviceType,
|
||||||
|
};
|
||||||
|
|
||||||
|
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<List<string>>>(LocalFile.Config.ApiIpHost + "matBaseInfo/getMatCodeList", body, "POST");
|
||||||
|
if (Result != null && Result.Data != null && Result.Data.Count() > 0)
|
||||||
|
{
|
||||||
|
matCodes = Result.Data.Select(t => new DataModel()
|
||||||
|
{
|
||||||
|
MatCode = t
|
||||||
|
}).ToList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private string matName;
|
private string matName;
|
||||||
public string MatName
|
public string MatName
|
||||||
@ -164,6 +227,12 @@ namespace 货架标准上位机.ViewModel
|
|||||||
#region 调用接口获取物料 MatBaseInfo
|
#region 调用接口获取物料 MatBaseInfo
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (MatQty == 0)
|
||||||
|
{
|
||||||
|
HandyControl.Controls.MessageBox.Show("数量不能为0!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var body = new JinChuanCommitMatInfoRequest()
|
var body = new JinChuanCommitMatInfoRequest()
|
||||||
{
|
{
|
||||||
MatId = MatBaseInfo.Id,
|
MatId = MatBaseInfo.Id,
|
||||||
@ -267,7 +336,7 @@ namespace 货架标准上位机.ViewModel
|
|||||||
// 提取第一个字段 CPN物料编码
|
// 提取第一个字段 CPN物料编码
|
||||||
//string firstField = Regex.Match(input, @"^[0-9,a-z,A-Z, ]{9}{").Value;
|
//string firstField = Regex.Match(input, @"^[0-9,a-z,A-Z, ]{9}{").Value;
|
||||||
string firstField = Regex.Match(input, LocalFile.Config.RegexMatCode).Value;
|
string firstField = Regex.Match(input, LocalFile.Config.RegexMatCode).Value;
|
||||||
MatCode = firstField.Replace("{", "").Replace(" ", "");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -289,6 +358,12 @@ namespace 货架标准上位机.ViewModel
|
|||||||
MatBatch = thirdField.Replace("{", "").Replace(" ", ""); ;
|
MatBatch = thirdField.Replace("{", "").Replace(" ", ""); ;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
MatCode = firstField.Replace("{", "").Replace(" ", "");
|
||||||
|
//GetMatBaseInfoRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GetMatBaseInfoRequest()
|
||||||
|
{
|
||||||
//调用接口获取物料信息
|
//调用接口获取物料信息
|
||||||
#region 调用接口获取物料 MatBaseInfo
|
#region 调用接口获取物料 MatBaseInfo
|
||||||
try
|
try
|
||||||
|
@ -39,8 +39,7 @@ namespace 货架标准上位机
|
|||||||
{
|
{
|
||||||
viewModel.SelectedataGridItem.IsSelected = !viewModel.SelectedataGridItem.IsSelected;
|
viewModel.SelectedataGridItem.IsSelected = !viewModel.SelectedataGridItem.IsSelected;
|
||||||
dataGrid.UnselectAllCells();//取消选中 避免手动点击check选项时反选失败 和重新点击该项时反选失败
|
dataGrid.UnselectAllCells();//取消选中 避免手动点击check选项时反选失败 和重新点击该项时反选失败
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Height="400" Width="340" WindowStyle="None" BorderThickness="0" Background="{x:Null}" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Opacity="1">
|
Loaded="UserControlBase_Loaded"
|
||||||
|
Height="400" Width="340" WindowStyle="None" BorderThickness="0" Background="{x:Null}" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Opacity="1">
|
||||||
<Border BorderBrush="Gray" Background="WhiteSmoke" CornerRadius="5" BorderThickness="1">
|
<Border BorderBrush="Gray" Background="WhiteSmoke" CornerRadius="5" BorderThickness="1">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
@ -35,7 +36,14 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Orientation="Horizontal" Margin="5">
|
<StackPanel Orientation="Horizontal" Margin="5">
|
||||||
<TextBlock Text="物料编码:" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
|
<TextBlock Text="物料编码:" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
|
||||||
<TextBlock Text="{Binding MatCode}" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
|
<!--<TextBlock Text="{Binding MatCode}" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>-->
|
||||||
|
<hc:AutoCompleteTextBox Grid.Row="1" Grid.Column="1" MinWidth="120" FontSize="18" IsEditable="True"
|
||||||
|
Height="20"
|
||||||
|
IsTextSearchEnabled="True"
|
||||||
|
Name="cbxMatCode" Margin="1"
|
||||||
|
ItemsSource="{Binding Items}"
|
||||||
|
Text="{Binding MatCode}"
|
||||||
|
DisplayMemberPath="MatCode"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal" Margin="5">
|
<StackPanel Orientation="Horizontal" Margin="5">
|
||||||
|
@ -69,5 +69,10 @@ namespace 货架标准上位机
|
|||||||
txtTotalCount.Focus();
|
txtTotalCount.Focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UserControlBase_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
viewModel.InitMatCode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ namespace 货架标准上位机
|
|||||||
if (viewModel.SelectedataGridItem != null)
|
if (viewModel.SelectedataGridItem != null)
|
||||||
{
|
{
|
||||||
viewModel.SelectedataGridItem.IsSelected = !viewModel.SelectedataGridItem.IsSelected;
|
viewModel.SelectedataGridItem.IsSelected = !viewModel.SelectedataGridItem.IsSelected;
|
||||||
//dataGrid.UnselectAllCells();
|
dataGrid.UnselectAllCells();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,7 @@
|
|||||||
<DataGrid.ContextMenu>
|
<DataGrid.ContextMenu>
|
||||||
<ContextMenu Name="dgmenu1" StaysOpen="true">
|
<ContextMenu Name="dgmenu1" StaysOpen="true">
|
||||||
<MenuItem Header="查询当前标定值/电压值" Click="MenuItem_Click"/>
|
<MenuItem Header="查询当前标定值/电压值" Click="MenuItem_Click"/>
|
||||||
|
<MenuItem Header="手动标定" Click="MenuItem_Click"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</DataGrid.ContextMenu>
|
</DataGrid.ContextMenu>
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
|
Reference in New Issue
Block a user