数据库设计
This commit is contained in:
100
WCS.BLL/DbModels/STZL/AgvTask.cs
Normal file
100
WCS.BLL/DbModels/STZL/AgvTask.cs
Normal file
@ -0,0 +1,100 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WCS.DAL.DbModels;
|
||||
|
||||
namespace WCS.BLL.DbModels
|
||||
{
|
||||
/// <summary>
|
||||
/// 当前库存存量表
|
||||
/// </summary>
|
||||
[SugarTable("wcs_agv_task")]
|
||||
public class AgvTask
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键 自增Id
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
#region 任务属性
|
||||
/// <summary>
|
||||
/// 请求任务时的任务号 需要保证唯一性
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "request_code", Length = 64, IsNullable = false, ColumnDescription = "请求任务时的任务号 需要保证唯一性")]
|
||||
public string RequestCode { get; set; } = Guid.NewGuid().ToString();
|
||||
|
||||
/// <summary>
|
||||
/// 任务类型
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "task_type", Length = 64, IsNullable = false, ColumnDescription = "任务类型")]
|
||||
public string TaskType { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 货架ID
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "start_location_id", IsNullable = true, ColumnDescription = "起点位置ID")]
|
||||
public int StratLocationId { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 起点位置编码
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "start_location_code", Length = 64, IsNullable = true, ColumnDescription = "起点位置编码")]
|
||||
public string StartLocationCode { get; set; } = string.Empty ;
|
||||
|
||||
/// <summary>
|
||||
/// 货架ID
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "end_location_id", IsNullable = true, ColumnDescription = "终点位置ID")]
|
||||
public int EndLocationId { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 终点位置编码
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "end_location_code", Length = 64, IsNullable = true, ColumnDescription = "终点位置编码")]
|
||||
public string EndLocationCode { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// AGV编号
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "agv_code", Length = 64, IsNullable = true, ColumnDescription = "AGV编号")]
|
||||
public string AgvCode { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 任务发起人
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "create_user", IsNullable = true, Length = 64, ColumnDescription = "任务发起人")]
|
||||
public string? CreateUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 任务创建时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "create_time", IsNullable = true, ColumnDescription = "任务创建时间")]
|
||||
public DateTime? CreateTime { get; set; } = DateTime.Now;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 序号
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public int RowNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否已经选择
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public bool IsSelected { get; set; }
|
||||
}
|
||||
|
||||
//1-已创建,2-正在执行,5-取消完成,9-已结束, 10-被打断
|
||||
public enum TaskStatusEnum
|
||||
{
|
||||
已创建 = 1,
|
||||
正在执行 = 2,
|
||||
取消完成 = 5,
|
||||
已结束 = 9,
|
||||
被打断 = 10,
|
||||
}
|
||||
}
|
86
WCS.BLL/DbModels/STZL/LocationInfo.cs
Normal file
86
WCS.BLL/DbModels/STZL/LocationInfo.cs
Normal file
@ -0,0 +1,86 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WCS.BLL.HardWare;
|
||||
|
||||
namespace WCS.DAL.DbModels
|
||||
{
|
||||
[SugarTable("wcs_location_info")]
|
||||
public class LocationInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键 自增Id
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 位置编码
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "location_code", Length = 64, IsNullable = false, ColumnDescription = "位置编码")]
|
||||
public string LocationCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 位置区域
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "location_area", Length = 64, IsNullable = false, ColumnDescription = "位置区域")]
|
||||
public string LocationArea { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// RCS库位编号
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "rcs_store_code", Length = 64, IsNullable = true, ColumnDescription = "RCS库位编号")]
|
||||
public string RcsStoreCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可放置货架类型
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "allow_shelf_types", Length = 512, IsNullable = true, ColumnDescription = "可放置货架类型")]
|
||||
public string AllowShelfTypes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新人
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "modify_user", Length = 128, IsNullable = true, ColumnDescription = "更新人")]
|
||||
public string ModifyUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "modify_time", IsNullable = false, ColumnDescription = "更新时间")]
|
||||
public DateTime ModifyTime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "is_enable", IsNullable = false, ColumnDescription = "是否启用")]
|
||||
public bool IsEnable { get; set; } = true;
|
||||
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public string IsEnableStr
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IsEnable)
|
||||
return "启用";
|
||||
else
|
||||
return "禁用";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 序号
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public int RowNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否已经选择
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public bool IsSelected { get; set; }
|
||||
}
|
||||
}
|
@ -13,73 +13,49 @@ namespace WCS.BLL.DbModels
|
||||
[SugarTable("wcs_mat_base_info")]
|
||||
public partial class MatBaseInfo
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Desc:
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
/// ID
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料编码
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "mat_code", Length = 100, IsNullable = false, ColumnDescription = "物料编号")]
|
||||
[SugarColumn(ColumnName = "mat_code", Length = 128, IsNullable = false, ColumnDescription = "物料编码")]
|
||||
public string MatCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "mat_name", Length = 150, IsNullable = false, ColumnDescription = "物料名称")]
|
||||
[SugarColumn(ColumnName = "mat_name", Length = 128, IsNullable = false, ColumnDescription = "物料名称")]
|
||||
public string MatName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料规格
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "mat_spec", Length = 150, IsNullable = true, ColumnDescription = "物料规格")]
|
||||
[SugarColumn(ColumnName = "mat_spec", Length = 128, IsNullable = true, ColumnDescription = "物料规格")]
|
||||
public string? MatSpec { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:物料单位
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// 物料单位
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "mat_unit", Length = 100, IsNullable = true, ColumnDescription = "物料单位")]
|
||||
[SugarColumn(ColumnName = "mat_unit", Length = 64, IsNullable = true, ColumnDescription = "物料单位")]
|
||||
public string? MatUnit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料批次
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "mat_batch", Length = 150, IsNullable = true, ColumnDescription = "物料批次")]
|
||||
public string? MatBatch { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料供应商
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "mat_supplier", Length = 150, IsNullable = true, ColumnDescription = "物料供应商")]
|
||||
[SugarColumn(ColumnName = "mat_supplier", Length = 128, IsNullable = true, ColumnDescription = "物料供应商")]
|
||||
public string? MatSupplier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料客户
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "mat_customer", Length = 150, IsNullable = true, ColumnDescription = "物料客户")]
|
||||
[SugarColumn(ColumnName = "mat_customer", Length = 128, IsNullable = true, ColumnDescription = "物料客户")]
|
||||
public string? MatCustomer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 默认数量
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "default_qty", IsNullable = false, ColumnDescription = "默认数量")]
|
||||
public int DefaultQty { get; set; } = 1000;
|
||||
/// <summary>
|
||||
/// 默认盘数
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "default_count", IsNullable = false, ColumnDescription = "默认盘数")]
|
||||
public int DefaultCount { get; set; } = 100;
|
||||
|
||||
/// <summary>
|
||||
/// 当前序列号
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "serial_number", IsNullable = false, DefaultValue = "0", ColumnDescription = "默认盘数")]
|
||||
public int SerialNumber { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Desc:更新人
|
117
WCS.BLL/DbModels/STZL/MatDetailCurrentInfo.cs
Normal file
117
WCS.BLL/DbModels/STZL/MatDetailCurrentInfo.cs
Normal file
@ -0,0 +1,117 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WCS.DAL.DbModels;
|
||||
|
||||
namespace WCS.BLL.DbModels
|
||||
{
|
||||
/// <summary>
|
||||
/// 当前库存存量表
|
||||
/// </summary>
|
||||
[SugarTable("wcs_mat_detail_current_info")]
|
||||
public class MatDetailCurrentInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键 自增Id
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
#region 货架属性
|
||||
/// <summary>
|
||||
/// 货架ID
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "shelf_id", IsNullable = false, ColumnDescription = "货架ID")]
|
||||
public int ShlefId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货架编码 对应二维码
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "shelf_code", Length = 64, IsNullable = false, ColumnDescription = "货架编码")]
|
||||
public string ShelfCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货架类型
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "shelf_type", Length = 64, IsNullable = true, ColumnDescription = "货架类型")]
|
||||
public string ShelfType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货架区域
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "shelf_area", Length = 64, IsNullable = true, ColumnDescription = "货架区域")]
|
||||
public string ShelfArea { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region 物料属性
|
||||
/// <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_qty", IsNullable = false, ColumnDescription = "物料数量")]
|
||||
public int MatQty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料供应商
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "mat_supplier", Length = 128, IsNullable = true, ColumnDescription = "物料供应商")]
|
||||
public string? MatSupplier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料客户
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "mat_customer", Length = 128, IsNullable = true, ColumnDescription = "物料客户")]
|
||||
public string? MatCustomer { get; set; }
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 站位编号 用于物料批量绑定时区分是哪个工位绑定的明细
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "station_code", Length = 64, IsNullable = true, ColumnDescription = "站位编号")]
|
||||
public string StationCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新人
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "modify_user", IsNullable = true, Length = 50, ColumnDescription = "更新人")]
|
||||
public string? ModifyUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "modify_time", IsNullable = true, ColumnDescription = "更新时间")]
|
||||
public DateTime? ModifyTime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 序号
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public int RowNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否已经选择
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public bool IsSelected { get; set; }
|
||||
}
|
||||
}
|
130
WCS.BLL/DbModels/STZL/MatDetailHistoryInfo.cs
Normal file
130
WCS.BLL/DbModels/STZL/MatDetailHistoryInfo.cs
Normal file
@ -0,0 +1,130 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WCS.DAL.DbModels;
|
||||
|
||||
namespace WCS.BLL.DbModels
|
||||
{
|
||||
/// <summary>
|
||||
/// 当前库存盘点表
|
||||
/// </summary>
|
||||
[SugarTable("wcs_mat_detail_history_info")]
|
||||
public class MatDetailHistoryInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键 自增Id
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货架库存明细当前的ID
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "mat_detail_current_id", IsNullable = false, ColumnDescription = "库存明细当前的ID")]
|
||||
public int MatDetailCurrentId { get; set; }
|
||||
|
||||
#region 货架属性
|
||||
/// <summary>
|
||||
/// 货架ID
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "shelf_id", IsNullable = false, ColumnDescription = "货架ID")]
|
||||
public int ShlefId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货架编码 对应二维码
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "shelf_code", Length = 64, IsNullable = false, ColumnDescription = "货架编码")]
|
||||
public string ShelfCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货架类型
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "shelf_type", Length = 64, IsNullable = true, ColumnDescription = "货架类型")]
|
||||
public string ShelfType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货架区域
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "shelf_area", Length = 64, IsNullable = true, ColumnDescription = "货架区域")]
|
||||
public string ShelfArea { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region 物料属性
|
||||
/// <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 = "before_qty", IsNullable = false, ColumnDescription = "物料数量(更新前物料数量)")]
|
||||
public int BeforeQty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料数量(更新后物料数量)
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "after_qty", IsNullable = false, ColumnDescription = "物料数量(更新后物料数量)")]
|
||||
public int AfterQty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料供应商
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "mat_supplier", Length = 128, IsNullable = true, ColumnDescription = "物料供应商")]
|
||||
public string? MatSupplier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料客户
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "mat_customer", Length = 128, IsNullable = true, ColumnDescription = "物料客户")]
|
||||
public string? MatCustomer { get; set; }
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 更新人
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "modify_user", IsNullable = true, Length = 50, ColumnDescription = "更新人")]
|
||||
public string? ModifyUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "modify_time", IsNullable = false, ColumnDescription = "更新时间")]
|
||||
public DateTime? ModifyTime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 是否已删除
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "is_delete", IsNullable = false, ColumnDescription = "是否已删除")]
|
||||
public bool IsDelete { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 序号
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public int RowNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否已经选择
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public bool IsSelected { get; set; }
|
||||
}
|
||||
|
||||
}
|
135
WCS.BLL/DbModels/STZL/MatDetailStocktakingInfo.cs
Normal file
135
WCS.BLL/DbModels/STZL/MatDetailStocktakingInfo.cs
Normal file
@ -0,0 +1,135 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WCS.DAL.DbModels;
|
||||
|
||||
namespace WCS.BLL.DbModels
|
||||
{
|
||||
/// <summary>
|
||||
/// 当前库存盘点表
|
||||
/// </summary>
|
||||
[SugarTable("wcs_mat_detail_stocktaking_info")]
|
||||
public class MatDetailStocktakingInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键 自增Id
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货架库存明细当前的ID
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "mat_detail_current_id", IsNullable = false, ColumnDescription = "库存明细当前的ID")]
|
||||
public int MatDetailCurrentId { get; set; }
|
||||
|
||||
#region 货架属性
|
||||
/// <summary>
|
||||
/// 货架ID
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "shelf_id", IsNullable = false, ColumnDescription = "货架ID")]
|
||||
public int ShlefId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货架编码 对应二维码
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "shelf_code", Length = 64, IsNullable = false, ColumnDescription = "货架编码")]
|
||||
public string ShelfCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货架类型
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "shelf_type", Length = 64, IsNullable = true, ColumnDescription = "货架类型")]
|
||||
public string ShelfType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货架区域
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "shelf_area", Length = 64, IsNullable = true, ColumnDescription = "货架区域")]
|
||||
public string ShelfArea { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region 物料属性
|
||||
/// <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_qty", IsNullable = false, ColumnDescription = "物料数量(原始数量)")]
|
||||
public int MatQty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料数量(盘点数量)
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "stocktaking_qty", IsNullable = false, ColumnDescription = "物料数量(盘点数量)")]
|
||||
public int StocktakingQty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料供应商
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "mat_supplier", Length = 128, IsNullable = true, ColumnDescription = "物料供应商")]
|
||||
public string? MatSupplier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料客户
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "mat_customer", Length = 128, IsNullable = true, ColumnDescription = "物料客户")]
|
||||
public string? MatCustomer { get; set; }
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 盘点人
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "stocktaking_user", IsNullable = false, Length = 50, ColumnDescription = "盘点人")]
|
||||
public string? StocktakingUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 盘点时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "stocktaking_time", IsNullable = false, ColumnDescription = "盘点时间")]
|
||||
public DateTime? StocktakingTime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 盘点状态
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "stocktaking_status", IsNullable = false, ColumnDescription = "盘点状态")]
|
||||
public StocktakingStatusEnum StocktakingStatus { get; set; } = StocktakingStatusEnum.未提交;
|
||||
|
||||
/// <summary>
|
||||
/// 序号
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public int RowNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否已经选择
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public bool IsSelected { get; set; }
|
||||
}
|
||||
|
||||
public enum StocktakingStatusEnum
|
||||
{
|
||||
未提交 = 0,
|
||||
已提交 = 1,
|
||||
}
|
||||
}
|
118
WCS.BLL/DbModels/STZL/ShelfInfo.cs
Normal file
118
WCS.BLL/DbModels/STZL/ShelfInfo.cs
Normal file
@ -0,0 +1,118 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WCS.BLL.HardWare;
|
||||
|
||||
namespace WCS.DAL.DbModels
|
||||
{
|
||||
[SugarTable("wcs_shelf_info")]
|
||||
public class ShelfInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键 自增Id
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货架编码 对应二维码
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "shelf_code", Length = 64, IsNullable = false, ColumnDescription = "货架编码")]
|
||||
public string ShelfCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货架类型
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "shelf_type", Length = 64, IsNullable = true, ColumnDescription = "货架类型")]
|
||||
public string ShelfType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货架状态 货架当前的状态空货架/非空货架
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "shelf_status", IsNullable = true, ColumnDescription = "货架状态")]
|
||||
public ShelfStatusEnum ShelfStatus { get; set; } = ShelfStatusEnum.空货架;
|
||||
|
||||
/// <summary>
|
||||
/// 货架区域
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "shelf_area", Length = 64, IsNullable = true, ColumnDescription = "货架区域")]
|
||||
public string ShelfArea { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货架尺寸
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "shelf_size", Length = 256, IsNullable = true, ColumnDescription = "货架尺寸")]
|
||||
public string ShelfSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "remark", Length = 128, IsNullable = true, ColumnDescription = "备注")]
|
||||
public string Remark { get; set; }
|
||||
|
||||
#region 当前位置信息
|
||||
/// <summary>
|
||||
/// 当前位置ID
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "current_location_id", IsNullable = true, ColumnDescription = "当前位置ID")]
|
||||
public int CurrentLocationId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 当前位置编码
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "current_location_code", Length = 64, IsNullable = true, ColumnDescription = "当前位置编码")]
|
||||
public string CurrentLocaiotnCode { get; set; } = string.Empty;
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 更新人
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "modify_user", Length = 128, IsNullable = true, ColumnDescription = "更新人")]
|
||||
public string ModifyUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "modify_time", IsNullable = false, ColumnDescription = "更新时间")]
|
||||
public DateTime ModifyTime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "is_enable", IsNullable = false, ColumnDescription = "是否启用")]
|
||||
public bool IsEnable { get; set; } = true;
|
||||
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public string IsEnableStr
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IsEnable)
|
||||
return "启用";
|
||||
else
|
||||
return "禁用";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 序号
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public int RowNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否已经选择
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public bool IsSelected { get; set; }
|
||||
}
|
||||
|
||||
public enum ShelfStatusEnum
|
||||
{
|
||||
空货架 = 0,
|
||||
非空货架 = 1,
|
||||
}
|
||||
}
|
@ -1,99 +0,0 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WCS.BLL.HardWare;
|
||||
|
||||
namespace WCS.DAL.DbModels
|
||||
{
|
||||
[SugarTable("wcs_shelf_info")]
|
||||
public class ShelfInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键 自增Id
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货架编码
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "shelf_code", Length = 50, IsNullable = false, ColumnDescription = "货架编码")]
|
||||
public string ShelfCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货架类型名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "shelf_type", Length = 50, IsNullable = false, ColumnDescription = "货架类型")]
|
||||
public string ShelfType { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 货架行数
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "row_counts", IsNullable = false, ColumnDescription = "货架行数")]
|
||||
public int Rowcounts { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货架列数
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "column_counts", IsNullable = false, ColumnDescription = "货架列数")]
|
||||
public int Columncounts { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货架对应警示灯的Id
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "light_id", IsNullable = false, ColumnDescription = "货架对应警示灯的Id")]
|
||||
public int LightId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货架对应Can模块的Ip
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "client_ip", Length = 50, IsNullable = false, ColumnDescription = "货架对应Can模块的Ip")]
|
||||
public string ClientIp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 连接Can模块的端口号
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "port", Length = 50, IsNullable = true, ColumnDescription = "连接Can模块的端口号")]
|
||||
public string Port { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货架对应后端的Ip
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "server_ip", Length = 50, IsNullable = false, ColumnDescription = "货架对应后端服务的Ip")]
|
||||
public string ServerIp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货架的组别、区域(区分单个软件管哪些货架的,前端的配置文件配置一个组别,查询时只显示当前组别的货架)
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "group_name", Length = 50, IsNullable = false, ColumnDescription = "货架的组别、区域(区分单个软件管哪些货架的,前端的配置文件配置一个组别,查询时只显示当前组别的货架)")]
|
||||
public string GroupName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否串联绑定
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "is_bind", IsNullable = false, ColumnDescription = "是否串联绑定")]
|
||||
public bool IsBind { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 串联绑定后的大货架编码
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "Bind_shelf_code", IsNullable = true, ColumnDescription = "串联绑定后的大货架编码")]
|
||||
public string? BigShelfCode { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 序号
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public int RowNumber { get; set; }
|
||||
/// <summary>
|
||||
/// 是否已经选择
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public bool IsSelected { get; set; }
|
||||
}
|
||||
}
|
@ -16,13 +16,7 @@ namespace WCS.BLL.HardWare
|
||||
{
|
||||
public SingleLightShelf(ShelfInfo shelfInfo)
|
||||
{
|
||||
ShelfId = shelfInfo.Id;
|
||||
ShelfCode = shelfInfo.ShelfCode;
|
||||
RowCounts = shelfInfo.Rowcounts;
|
||||
ColumnCounts = shelfInfo.Columncounts;
|
||||
SetCurrentMode(Mode.待机模式);
|
||||
ClientIp = shelfInfo.ClientIp;
|
||||
LightId = shelfInfo.LightId;
|
||||
|
||||
}
|
||||
|
||||
public int ShelfId { get; set; }
|
||||
|
@ -19,14 +19,8 @@ namespace WCS.BLL.HardWare
|
||||
{
|
||||
public SmartShelf(ShelfInfo shelfInfo)
|
||||
{
|
||||
ShelfId = shelfInfo.Id;
|
||||
ShelfCode = shelfInfo.ShelfCode;
|
||||
RowCounts = shelfInfo.Rowcounts;
|
||||
ColumnCounts = shelfInfo.Columncounts;
|
||||
SetCurrentMode(Mode.待机模式);
|
||||
ClientIp = shelfInfo.ClientIp;
|
||||
LightId = shelfInfo.LightId;
|
||||
WarningLight = new WarningLight() { LightId = shelfInfo.LightId };
|
||||
//ShelfId = shelfInfo.Id;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -23,9 +23,7 @@ namespace WCS.BLL.Manager
|
||||
{
|
||||
Logs.Write("【InitShelves】开始", LogsType.StartBoot);
|
||||
|
||||
var shelvesInDbQueryable = DbHelp.db.Queryable<ShelfInfo>();
|
||||
if (LocalFile.Config.IsMx)
|
||||
shelvesInDbQueryable = shelvesInDbQueryable.Where(t => t.GroupName == LocalFile.Config.GroupName);
|
||||
var shelvesInDbQueryable = DbHelp.db.Queryable<ShelfInfo>();
|
||||
var shelvesInDb = shelvesInDbQueryable.ToList();
|
||||
foreach (var shelfInDb in shelvesInDb)
|
||||
{
|
||||
|
@ -23,169 +23,7 @@ namespace WCS.BLL.Manager
|
||||
/// </summary>
|
||||
public static List<TCPClient> TCPClients = new List<TCPClient>();
|
||||
|
||||
public static void InitTcpClient()
|
||||
{
|
||||
Logs.Write("【InitTcpClient】开始", LogsType.StartBoot);
|
||||
|
||||
var clientsInDB = DbHelp.db.Queryable<ShelfInfo>()
|
||||
.WhereIF(!string.IsNullOrEmpty(LocalFile.Config.GroupName), t => t.GroupName == LocalFile.Config.GroupName)
|
||||
.Select(t => new
|
||||
{
|
||||
IP = t.ClientIp,
|
||||
ShelfTypeName = t.ShelfType,
|
||||
Port = t.Port,
|
||||
})
|
||||
.Distinct()
|
||||
.ToList();
|
||||
Logs.Write($"【InitTcpClient】需要连接的服务端地址如下:\r\n{string.Join(";", clientsInDB)}", LogsType.StartBoot);
|
||||
foreach (var cleientInDB in clientsInDB)
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
var tcpCleint = new TCPClient(cleientInDB.IP, cleientInDB.Port, cleientInDB.ShelfTypeName);
|
||||
tcpCleint.tcpClient.Received += (client, e) =>
|
||||
{
|
||||
var clientIpHost = client.IP + ":" + client.Port;
|
||||
var TcpCleint = TCPClientManager.GetTCPClientByIPHost(clientIpHost);
|
||||
if (TcpCleint == null)
|
||||
{
|
||||
return EasyTask.CompletedTask;
|
||||
}
|
||||
|
||||
var data = e.ByteBlock.Buffer.Take((int)e.ByteBlock.Length).ToArray();
|
||||
|
||||
|
||||
Logs.Write($"【接收{clientIpHost}】{BitConverter.ToString(data)}", LogsType.Instructions);
|
||||
|
||||
e.ByteBlock.Clear();
|
||||
var len = data.Length;
|
||||
|
||||
if (tcpCleint.ShelfTypeName == "信息化货架")
|
||||
{
|
||||
Logs.Write($"【信息化货架开始处理接收数据】{BitConverter.ToString(data)}", LogsType.InstructionsProcess);
|
||||
Helper.ReturnDataProcess(TcpCleint, data);
|
||||
Logs.Write($"【信息化货架完成处理接收数据】{BitConverter.ToString(data)}", LogsType.InstructionsProcess);
|
||||
return EasyTask.CompletedTask;
|
||||
}
|
||||
|
||||
if (tcpCleint.ShelfTypeName == "液晶货架")
|
||||
{
|
||||
Logs.Write($"【液晶货架开始处理接收数据】{BitConverter.ToString(data)}", LogsType.InstructionsProcess);
|
||||
//Helper.ReturnDataProcess(TcpCleint, data);
|
||||
Logs.Write($"【液晶货架完成处理接收数据】{BitConverter.ToString(data)}", LogsType.InstructionsProcess);
|
||||
return EasyTask.CompletedTask;
|
||||
}
|
||||
|
||||
for (int index = 0; index < data.Length - TcpCleint.PreFixLength; index++)
|
||||
{
|
||||
//协议拆包 通过前缀校验是否为完整数据包
|
||||
var prefixInData = data.Skip(index).Take(TcpCleint.PreFixLength);
|
||||
var isEqual = prefixInData.SequenceEqual(TcpCleint.Prefix);
|
||||
if (isEqual)
|
||||
{
|
||||
var dataTemp = data.Skip(index).Take(TcpCleint.PreFixLength + TcpCleint.DataLength).ToArray();
|
||||
if (dataTemp.Length < TcpCleint.PreFixLength + TcpCleint.DataLength)//拆包后不满足一条指令的长度
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Logs.Write($"【处理单条指令 开始】{BitConverter.ToString(dataTemp)}", LogsType.InstructionsProcess);
|
||||
index += (TcpCleint.PreFixLength + TcpCleint.DataLength - 1);//每次循环index会+1 所以这里-1
|
||||
//获取板子ID
|
||||
var boardId = (dataTemp[TcpCleint.PreFixLength + 0] << 8) + dataTemp[TcpCleint.PreFixLength + 1];
|
||||
var lightNumber = Convert.ToInt32(dataTemp[TcpCleint.PreFixLength + 3]);
|
||||
//报警灯 返回来就修改对应的灯的颜色
|
||||
if (dataTemp[TcpCleint.PreFixLength + 2] == 0x20)
|
||||
{
|
||||
var shelf = ShelfManager.Shelves.Where(t => t.ClientIp == clientIpHost)
|
||||
.Where(t => t.LightId == boardId)
|
||||
.FirstOrDefault();
|
||||
var smartShelf = shelf as SmartShelf;
|
||||
smartShelf?.WarningLightProcess(dataTemp, boardId, lightNumber);
|
||||
}
|
||||
//!= 0x20 货架类型协议返回
|
||||
else
|
||||
{
|
||||
var shelf = ShelfManager.Shelves
|
||||
.Where(t => t.ClientIp == clientIpHost)
|
||||
.Where(t => t.ModuleIds != null && t.ModuleIds.Contains(boardId))
|
||||
.FirstOrDefault();
|
||||
var smartShelf = shelf as SmartShelf;
|
||||
smartShelf?.ProtocolProcess(dataTemp, boardId, lightNumber);
|
||||
}
|
||||
Logs.Write($"【处理单条指令 结束】{BitConverter.ToString(dataTemp)}", LogsType.InstructionsProcess);
|
||||
}
|
||||
}
|
||||
return EasyTask.CompletedTask;
|
||||
};
|
||||
//配置首次连接后复位操作
|
||||
tcpCleint.tcpClient.Connected += (client, e) =>
|
||||
{
|
||||
Logs.Write($"【TcpClient】{client.IP}完成连接,端口号{client.Port}", LogsType.StartBoot);
|
||||
var clientIpHost = client.IP + ":" + client.Port;
|
||||
var TcpCleint = TCPClientManager.GetTCPClientByIPHost(clientIpHost);
|
||||
if (TcpCleint == null)
|
||||
{
|
||||
return EasyTask.CompletedTask;
|
||||
}
|
||||
//首次连接
|
||||
if (TcpCleint.IsFirstConnected == false)
|
||||
{
|
||||
Logs.Write($"【InitTcpClient】{clientIpHost}完成首次连接", LogsType.StartBoot);
|
||||
|
||||
|
||||
|
||||
Console.WriteLine($"【InitTcpClient】{clientIpHost}完成首次连接");
|
||||
InitStatus(TcpCleint);
|
||||
TcpCleint.IsFirstConnected = true;
|
||||
//获取剩余未完成连接的tcp
|
||||
var noFirstConnectedTcps = TCPClientManager.TCPClients.Where(t => t.IsFirstConnected == false)
|
||||
.Select(t => t.RemoteIPHost)
|
||||
.ToList();
|
||||
Logs.Write($"【InitTcpClient】剩余未完成连接的TCP为{string.Join(";", noFirstConnectedTcps)}", LogsType.StartBoot);
|
||||
}
|
||||
return EasyTask.CompletedTask;
|
||||
};
|
||||
|
||||
lock (TCPClients)//避免添加失败的情况
|
||||
{
|
||||
TCPClients.Add(tcpCleint);
|
||||
}
|
||||
|
||||
tcpCleint.Connect();
|
||||
});
|
||||
}
|
||||
|
||||
//启动线程监听所有TCP是否已经完成首次连接
|
||||
Task.Run(() =>
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
var noFirstConnectedClients = TCPClientManager.TCPClients.Where(t => t.IsFirstConnected == false)
|
||||
.ToList();
|
||||
if (noFirstConnectedClients.Count == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"存在tcp未完成首次连接,继续重连!");
|
||||
noFirstConnectedClients.ForEach(t =>
|
||||
{
|
||||
t.ReConnectAsync();
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
Logs.Write("【InitTcpClient】完成 后台继续连接", LogsType.StartBoot);
|
||||
}
|
||||
|
||||
//后台启动时给所有板子、警示灯发送复位操作 保持状态一致
|
||||
public static void InitStatus()
|
||||
@ -217,10 +55,7 @@ namespace WCS.BLL.Manager
|
||||
//后台启动时给所有板子、警示灯发送复位操作 保持状态一致
|
||||
public static void InitStatus(TCPClient tcpClient)
|
||||
{
|
||||
var shelfInfo = DbHelp.db.Queryable<ShelfInfo>().Where(t => t.ClientIp == tcpClient.RemoteIPHost).ToList();
|
||||
if (shelfInfo.Count != 0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
|
@ -53,67 +53,72 @@ namespace WCS.BLL.Services.Service
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
|
||||
//生成条码
|
||||
lock (matFlag)
|
||||
return new ResponseCommon<List<MatInfo>>()
|
||||
{
|
||||
try
|
||||
{
|
||||
DbHelp.db.BeginTran();
|
||||
var startNumber = ++matBaseInfo.SerialNumber;
|
||||
var matInfoList = new List<MatInfo>();
|
||||
for (var i = 0; i < request.TotalCount; i++)
|
||||
{
|
||||
var matInfo = new MatInfo()
|
||||
{
|
||||
MatSn = GetMatSn(matBaseInfo, startNumber + i),
|
||||
MatCode = matBaseInfo.MatCode,
|
||||
MatName = matBaseInfo.MatName,
|
||||
MatBatch = request.MatBatch,
|
||||
MatSpec = matBaseInfo.MatSpec,
|
||||
MatUnit = matBaseInfo.MatUnit,
|
||||
MatSupplier = matBaseInfo.MatSupplier,
|
||||
Code = 201,
|
||||
Message = $"生成失败:该物料已被禁用",
|
||||
Data = null
|
||||
};
|
||||
////生成条码
|
||||
//lock (matFlag)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// DbHelp.db.BeginTran();
|
||||
// var startNumber = ++matBaseInfo.SerialNumber;
|
||||
// var matInfoList = new List<MatInfo>();
|
||||
// for (var i = 0; i < request.TotalCount; i++)
|
||||
// {
|
||||
// var matInfo = new MatInfo()
|
||||
// {
|
||||
// MatSn = GetMatSn(matBaseInfo, startNumber + i),
|
||||
// MatCode = matBaseInfo.MatCode,
|
||||
// MatName = matBaseInfo.MatName,
|
||||
// MatBatch = request.MatBatch,
|
||||
// MatSpec = matBaseInfo.MatSpec,
|
||||
// MatUnit = matBaseInfo.MatUnit,
|
||||
// MatSupplier = matBaseInfo.MatSupplier,
|
||||
|
||||
MatCustomer = matBaseInfo.MatCustomer,
|
||||
MatQty = request.MatQty,
|
||||
ModifyUser = request.UserName
|
||||
};
|
||||
matInfo.Id = DbHelp.db.Insertable(matInfo).ExecuteReturnIdentity();
|
||||
matInfoList.Add(matInfo);
|
||||
}
|
||||
// MatCustomer = matBaseInfo.MatCustomer,
|
||||
// MatQty = request.MatQty,
|
||||
// ModifyUser = request.UserName
|
||||
// };
|
||||
// matInfo.Id = DbHelp.db.Insertable(matInfo).ExecuteReturnIdentity();
|
||||
// matInfoList.Add(matInfo);
|
||||
// }
|
||||
|
||||
matBaseInfo.SerialNumber = startNumber + request.TotalCount;
|
||||
DbHelp.db.Updateable(matBaseInfo).ExecuteCommand();
|
||||
DbHelp.db.CommitTran();
|
||||
return new ResponseCommon<List<MatInfo>>()
|
||||
{
|
||||
Code = 200,
|
||||
Message = "success",
|
||||
Data = matInfoList
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
DbHelp.db.RollbackTran();
|
||||
return new ResponseCommon<List<MatInfo>>()
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"生成失败:{ex.Message}",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
}
|
||||
// matBaseInfo.SerialNumber = startNumber + request.TotalCount;
|
||||
// DbHelp.db.Updateable(matBaseInfo).ExecuteCommand();
|
||||
// DbHelp.db.CommitTran();
|
||||
// return new ResponseCommon<List<MatInfo>>()
|
||||
// {
|
||||
// Code = 200,
|
||||
// Message = "success",
|
||||
// Data = matInfoList
|
||||
// };
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// DbHelp.db.RollbackTran();
|
||||
// return new ResponseCommon<List<MatInfo>>()
|
||||
// {
|
||||
// Code = 201,
|
||||
// Message = $"生成失败:{ex.Message}",
|
||||
// Data = null
|
||||
// };
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
private string GetMatSn(MatBaseInfo matBaseInfo, int serialNumber)
|
||||
{
|
||||
var gongshi = "=A1&\"-\"&A2&A3";
|
||||
Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
|
||||
keyValuePairs.Add("A1", matBaseInfo.MatCode);
|
||||
keyValuePairs.Add("A2", string.IsNullOrEmpty(matBaseInfo.MatBatch) ? "" : matBaseInfo.MatBatch);
|
||||
keyValuePairs.Add("A3", serialNumber.ToString().PadLeft(6, '0'));
|
||||
var matSn = PnHelp.Jx(gongshi, keyValuePairs);
|
||||
return matSn;
|
||||
//var gongshi = "=A1&\"-\"&A2&A3";
|
||||
//Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
|
||||
//keyValuePairs.Add("A1", matBaseInfo.MatCode);
|
||||
//keyValuePairs.Add("A2", string.IsNullOrEmpty(matBaseInfo.MatBatch) ? "" : matBaseInfo.MatBatch);
|
||||
//keyValuePairs.Add("A3", serialNumber.ToString().PadLeft(6, '0'));
|
||||
//var matSn = PnHelp.Jx(gongshi, keyValuePairs);
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public async Task<string> generateStockTakingNumber()
|
||||
@ -229,17 +234,17 @@ namespace WCS.BLL.Services.Service
|
||||
if (matBaseInfo != null)
|
||||
{
|
||||
//存在此物料的情况下 判断当前的数量
|
||||
if (request.CurrentSerilNumber != matBaseInfo.SerialNumber + 1)
|
||||
{
|
||||
return new ResponseBase<MatInfo>()
|
||||
{
|
||||
Code = 201,
|
||||
Message = "操作失败:当前物料流水号冲突!请重新扫码!",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
//if (request.CurrentSerilNumber != matBaseInfo.SerialNumber + 1)
|
||||
//{
|
||||
// return new ResponseBase<MatInfo>()
|
||||
// {
|
||||
// Code = 201,
|
||||
// Message = "操作失败:当前物料流水号冲突!请重新扫码!",
|
||||
// Data = null
|
||||
// };
|
||||
//}
|
||||
//流水号不冲突
|
||||
else
|
||||
//else
|
||||
{
|
||||
var matInfoList = new List<MatInfo>();
|
||||
|
||||
@ -249,7 +254,7 @@ namespace WCS.BLL.Services.Service
|
||||
for (int i = 0; i < request.TotalPan; i++)
|
||||
{
|
||||
//保存matBaseInfo
|
||||
matBaseInfo.SerialNumber++;
|
||||
//matBaseInfo.SerialNumber++;
|
||||
|
||||
//保存条码信息
|
||||
var matInfo = new MatInfo()
|
||||
|
@ -19,11 +19,8 @@ namespace WCS.BLL.Services.Service
|
||||
{
|
||||
//直接获取数据库数据 分组进行返回
|
||||
var data = await DbHelp.db.Queryable<ShelfInfo>()
|
||||
.Where(t => !string.IsNullOrEmpty(t.BigShelfCode))
|
||||
.Select(t => new GetShelfServerResponseItem()
|
||||
{
|
||||
BigShelfCode = t.BigShelfCode,
|
||||
ServerIp = t.ServerIp,
|
||||
})
|
||||
.Distinct()
|
||||
.ToListAsync();
|
||||
|
@ -30,7 +30,7 @@ namespace WCS.BLL.Services.Service
|
||||
try
|
||||
{
|
||||
var recordsQueryable = DbHelp.db.Queryable<ShelfInfo>()
|
||||
.WhereIF(!string.IsNullOrEmpty(request.ShelfCode), t => t.ShelfCode.Contains(request.ShelfCode));
|
||||
;
|
||||
|
||||
var totalCount = await recordsQueryable.CountAsync();
|
||||
var records = await recordsQueryable
|
||||
@ -69,7 +69,6 @@ namespace WCS.BLL.Services.Service
|
||||
try
|
||||
{
|
||||
var shelfnfo = await DbHelp.db.Queryable<ShelfInfo>()
|
||||
.Where(t => t.ShelfCode == request.ShelfInfo.ShelfCode)
|
||||
.FirstAsync();
|
||||
//修改货架信息
|
||||
if (request.AddOrUpdate == AddOrUpdate.Update)
|
||||
@ -84,7 +83,7 @@ namespace WCS.BLL.Services.Service
|
||||
return new ResponseCommon<Object>
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"更新货架信息失败:货架{request.ShelfInfo.ShelfCode}不存在!",
|
||||
Message = $"更新货架信息失败:货架不存在!",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
@ -93,20 +92,12 @@ namespace WCS.BLL.Services.Service
|
||||
return new ResponseCommon<Object>
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"更新货架信息失败:已存在货架编码{request.ShelfInfo.ShelfCode}!",
|
||||
Message = $"更新货架信息失败:已存在货架编码!",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
shelfnfo.ShelfCode = request.ShelfInfo.ShelfCode;
|
||||
shelfnfo.Rowcounts = request.ShelfInfo.Rowcounts;
|
||||
shelfnfo.Columncounts = request.ShelfInfo.Columncounts;
|
||||
shelfnfo.LightId = request.ShelfInfo.LightId;
|
||||
shelfnfo.ClientIp = request.ShelfInfo.ClientIp;
|
||||
shelfnfo.GroupName = request.ShelfInfo.GroupName;
|
||||
shelfnfo.IsBind = request.ShelfInfo.IsBind;
|
||||
shelfnfo.BigShelfCode = request.ShelfInfo.BigShelfCode;
|
||||
|
||||
var rowNum = await DbHelp.db.Updateable(shelfnfo).ExecuteCommandAsync();
|
||||
if (rowNum == 0)
|
||||
@ -136,7 +127,7 @@ namespace WCS.BLL.Services.Service
|
||||
return new ResponseCommon<Object>
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"货架信息失败:货架{request.ShelfInfo.ShelfCode}已存在!",
|
||||
Message = $"货架信息失败:货架已存在!",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
@ -144,14 +135,7 @@ namespace WCS.BLL.Services.Service
|
||||
{
|
||||
var newShelfInfo = new ShelfInfo()
|
||||
{
|
||||
ShelfCode = request.ShelfInfo.ShelfCode,
|
||||
Rowcounts = request.ShelfInfo.Rowcounts,
|
||||
Columncounts = request.ShelfInfo.Columncounts,
|
||||
LightId = request.ShelfInfo.LightId,
|
||||
ClientIp = request.ShelfInfo.ClientIp,
|
||||
GroupName = request.ShelfInfo.GroupName,
|
||||
IsBind = request.ShelfInfo.IsBind,
|
||||
BigShelfCode = request.ShelfInfo.BigShelfCode,
|
||||
|
||||
};
|
||||
var rowNum = await DbHelp.db.Insertable(newShelfInfo).ExecuteCommandAsync();
|
||||
if (rowNum == 0)
|
||||
|
Reference in New Issue
Block a user