提交代码
This commit is contained in:
@ -1,4 +1,5 @@
|
|||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
using WCS.Model.ApiModel.OutStore;
|
||||||
|
|
||||||
namespace WCS.BLL.DbModels
|
namespace WCS.BLL.DbModels
|
||||||
{
|
{
|
||||||
@ -24,7 +25,14 @@ namespace WCS.BLL.DbModels
|
|||||||
/// 单据状态
|
/// 单据状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnName = "order_status", IsNullable = false, ColumnDescription = "单据状态")]
|
[SugarColumn(ColumnName = "order_status", IsNullable = false, ColumnDescription = "单据状态")]
|
||||||
public OutOrderStatus OrderStatus { get; set; } = OutOrderStatus.未出库;
|
public OutOrderStatus OrderStatus { get; set; } = OutOrderStatus.未发料;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 单据执行状态: 待发料, 开始发料, 暂停发料, 发料完成
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "order_exe_status", IsNullable = true, ColumnDescription = "执行状态:\t待发料,\t开始发料,\t暂停发料,\t发料完成")]
|
||||||
|
public OutOrderExeStatus OutOrderExeStatus { get; set; } = OutOrderExeStatus.待发料;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 单据来源
|
/// 单据来源
|
||||||
@ -41,8 +49,8 @@ namespace WCS.BLL.DbModels
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 单据同步类型
|
/// 单据同步类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnName = "sync_type", Length = 50, IsNullable = true, ColumnDescription = "单据同步类型:ByMatCode,ByMatSn")]
|
[SugarColumn(ColumnName = "sync_type",IsNullable = false, ColumnDescription = "单据同步类型:ByMatCode,ByMatSn")]
|
||||||
public string SyncType { get; set; } = string.Empty;
|
public SyncTypeEnum SyncType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建时间
|
/// 创建时间
|
||||||
@ -56,13 +64,17 @@ namespace WCS.BLL.DbModels
|
|||||||
[SugarColumn(ColumnName = "create_user", Length = 100, IsNullable = true, ColumnDescription = "操作员")]
|
[SugarColumn(ColumnName = "create_user", Length = 100, IsNullable = true, ColumnDescription = "操作员")]
|
||||||
public string CreateUser { get; set; }
|
public string CreateUser { get; set; }
|
||||||
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// 用于绑定DataGrid中是否选择
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsIgnore = true)]
|
||||||
|
public bool IsSelected { get; set; }
|
||||||
|
|
||||||
public enum OutOrderStatus
|
/// <summary>
|
||||||
{
|
/// 用于绑定中显示序号
|
||||||
未出库 = 0,
|
/// </summary>
|
||||||
部分出库 = 1,
|
[SugarColumn(IsIgnore = true)]
|
||||||
全部出库 = 2
|
public int RowNumber { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,11 @@ namespace WCS.BLL.DbModels
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnName = "mat_code", Length = 100, IsNullable = true, ColumnDescription = "物料编号")]
|
[SugarColumn(ColumnName = "mat_code", Length = 100, IsNullable = true, ColumnDescription = "物料编号")]
|
||||||
public string MatCode { get; set; }
|
public string MatCode { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 物料名称
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "mat_name", Length = 150, IsNullable = true, ColumnDescription = "物料名称")]
|
||||||
|
public string MatName { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 物料批次
|
/// 物料批次
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -45,6 +49,12 @@ namespace WCS.BLL.DbModels
|
|||||||
[SugarColumn(ColumnName = "req_qty", IsNullable = false, ColumnDescription = "物料需求数量")]
|
[SugarColumn(ColumnName = "req_qty", IsNullable = false, ColumnDescription = "物料需求数量")]
|
||||||
public int ReqQty { get; set; }
|
public int ReqQty { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料已出库数量
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "out_qty", IsNullable = false, DefaultValue = "0", ColumnDescription = "物料已出库数量")]
|
||||||
|
public int OutQty { get; set; } = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建时间
|
/// 创建时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -56,5 +66,11 @@ namespace WCS.BLL.DbModels
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnName = "create_user", Length = 100, IsNullable = true, ColumnDescription = "操作员")]
|
[SugarColumn(ColumnName = "create_user", Length = 100, IsNullable = true, ColumnDescription = "操作员")]
|
||||||
public string CreateUser { get; set; }
|
public string CreateUser { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 用于绑定中显示序号
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsIgnore = true)]
|
||||||
|
public int RowNumber { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ namespace WCS.BLL.DbModels
|
|||||||
public int OutOrderDetailId { get; set; }
|
public int OutOrderDetailId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 库存的ID
|
/// 库存数据的ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnName = "inventory_detail_id", IsNullable = true)]
|
[SugarColumn(ColumnName = "inventory_detail_id", IsNullable = true)]
|
||||||
public int InventoryDetailId { get; set; }
|
public int InventoryDetailId { get; set; }
|
||||||
@ -126,5 +126,11 @@ namespace WCS.BLL.DbModels
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnName = "create_user", Length = 100, IsNullable = true, ColumnDescription = "操作员")]
|
[SugarColumn(ColumnName = "create_user", Length = 100, IsNullable = true, ColumnDescription = "操作员")]
|
||||||
public string CreateUser { get; set; }
|
public string CreateUser { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 用于绑定中显示序号
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsIgnore = true)]
|
||||||
|
public int RowNumber { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using WCS.BLL.DbModels;
|
||||||
using WCS.Model;
|
using WCS.Model;
|
||||||
|
|
||||||
namespace WCS.BLL.HardWare
|
namespace WCS.BLL.HardWare
|
||||||
@ -75,7 +76,7 @@ namespace WCS.BLL.HardWare
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 货架进入出库模式
|
/// 货架进入出库模式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void GoInOutstore();
|
public void GoInOutstore(List<OutOrderMatDetail> MatDetails, OutOrder outOrder);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 货架退出出库模式
|
/// 货架退出出库模式
|
||||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using WCS.BLL.DbModels;
|
||||||
using WCS.Model;
|
using WCS.Model;
|
||||||
|
|
||||||
namespace WCS.BLL.HardWare
|
namespace WCS.BLL.HardWare
|
||||||
@ -29,7 +30,7 @@ namespace WCS.BLL.HardWare
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GoInOutstore()
|
public void GoInOutstore(List<OutOrderMatDetail> MatDetails, OutOrder outOrder)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ using WCS.DAL;
|
|||||||
using WCS.DAL.Db;
|
using WCS.DAL.Db;
|
||||||
using WCS.DAL.DbModels;
|
using WCS.DAL.DbModels;
|
||||||
using WCS.Model;
|
using WCS.Model;
|
||||||
|
using static System.Formats.Asn1.AsnWriter;
|
||||||
|
|
||||||
namespace WCS.BLL.HardWare
|
namespace WCS.BLL.HardWare
|
||||||
{
|
{
|
||||||
@ -48,7 +49,7 @@ namespace WCS.BLL.HardWare
|
|||||||
}
|
}
|
||||||
ModulesStr = string.Join(";", Modules.Select(t => t.ModuleCode));
|
ModulesStr = string.Join(";", Modules.Select(t => t.ModuleCode));
|
||||||
|
|
||||||
ModuleIds = Modules.Select(t => t.ModuleId).ToList();
|
ModuleIds = Modules.Select(t => t.BoardId).ToList();
|
||||||
});
|
});
|
||||||
|
|
||||||
////初始化TCPCleint
|
////初始化TCPCleint
|
||||||
@ -72,14 +73,14 @@ namespace WCS.BLL.HardWare
|
|||||||
// }
|
// }
|
||||||
// index += (TcpCleint.PreFixLength + TcpCleint.DataLength - 1);//每次循环index会+1 所以这里-1
|
// index += (TcpCleint.PreFixLength + TcpCleint.DataLength - 1);//每次循环index会+1 所以这里-1
|
||||||
// //获取板子ID
|
// //获取板子ID
|
||||||
// var boardId = (data[TcpCleint.PreFixLength + 0] << 8) + data[TcpCleint.PreFixLength + 1];
|
// var boardIds = (data[TcpCleint.PreFixLength + 0] << 8) + data[TcpCleint.PreFixLength + 1];
|
||||||
// var lightNumber = Convert.ToInt32(data[TcpCleint.PreFixLength + 3]);
|
// var lightNumber = Convert.ToInt32(data[TcpCleint.PreFixLength + 3]);
|
||||||
|
|
||||||
// //协议处理 判断功能位
|
// //协议处理 判断功能位
|
||||||
// switch (dataTemp[TcpCleint.PreFixLength + 2])
|
// switch (dataTemp[TcpCleint.PreFixLength + 2])
|
||||||
// {
|
// {
|
||||||
// case 0x01://进入入库模式信号
|
// case 0x01://进入入库模式信号
|
||||||
// GoInInstoreProcess(dataTemp, boardId, lightNumber);
|
// GoInInstoreProcess(dataTemp, boardIds, lightNumber);
|
||||||
// break;
|
// break;
|
||||||
// case 0x03://正常入库信号
|
// case 0x03://正常入库信号
|
||||||
// InStoreReturnProcess(dataTemp);
|
// InStoreReturnProcess(dataTemp);
|
||||||
@ -107,12 +108,22 @@ namespace WCS.BLL.HardWare
|
|||||||
|
|
||||||
public int LightId { get; set; }
|
public int LightId { get; set; }
|
||||||
public WarningLight WarningLight { get; set; }
|
public WarningLight WarningLight { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 自检异常、未响应对应模式的异常
|
||||||
|
/// </summary>
|
||||||
public List<string> ExceptionMessages { get; set; } = new List<string>();
|
public List<string> ExceptionMessages { get; set; } = new List<string>();
|
||||||
|
/// <summary>
|
||||||
|
/// 过程中异常 入库过程中异常/出库过程中异常
|
||||||
|
/// </summary>
|
||||||
|
public List<ProcessingExceptionType> ProcessingExceptions { get; set; } = new List<ProcessingExceptionType>();
|
||||||
public string? InstoreIpAddress { get; set; } = string.Empty;
|
public string? InstoreIpAddress { get; set; } = string.Empty;
|
||||||
|
|
||||||
public MatInfoResponse InStoreData { get; set; }
|
public MatInfoResponse InStoreData { get; set; }
|
||||||
|
|
||||||
|
public List<string> CurrentOutStoreMatSNs { get; set; } = new List<string>();
|
||||||
|
|
||||||
|
public OutOrder CurrentOutOrder { get; set; }
|
||||||
|
|
||||||
public string OrderNumber { get; set; }
|
public string OrderNumber { get; set; }
|
||||||
|
|
||||||
|
|
||||||
@ -122,53 +133,92 @@ namespace WCS.BLL.HardWare
|
|||||||
#region 协议处理
|
#region 协议处理
|
||||||
public void GoInInstore(string? IPAddress)
|
public void GoInInstore(string? IPAddress)
|
||||||
{
|
{
|
||||||
//判断当前模式是否为待机模式
|
try
|
||||||
if (this.CurentMode != Mode.待机模式)
|
|
||||||
{
|
{
|
||||||
return;
|
if (this.CurentMode == Mode.入库模式)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.CurentMode = Mode.入库模式;
|
|
||||||
}
|
|
||||||
//清空错误
|
|
||||||
ExceptionMessages.Clear();
|
|
||||||
//货架所有模组发送指令进入入库模式
|
|
||||||
foreach (var module in Modules.Where(t => t.IsEnable).ToList())
|
|
||||||
{
|
|
||||||
module.GoInInstoreMode(TcpCleint);
|
|
||||||
}
|
|
||||||
//延时获取异常
|
|
||||||
var timeOut = 3000;
|
|
||||||
var timeSpan = TimeSpan.FromMilliseconds(0);
|
|
||||||
var beginTime = DateTime.Now;
|
|
||||||
while (timeSpan <= TimeSpan.FromMilliseconds(timeOut))
|
|
||||||
{
|
|
||||||
timeSpan = DateTime.Now - beginTime;
|
|
||||||
//接收到第一个异常就不继续循环了
|
|
||||||
if (ExceptionMessages.Count() > 0)
|
|
||||||
{
|
{
|
||||||
var deficientTime = timeOut - (int)timeSpan.TotalMilliseconds;
|
InstoreIpAddress = IPAddress;
|
||||||
if (deficientTime > 0)
|
|
||||||
Thread.Sleep(deficientTime);
|
|
||||||
//出现异常的未进入入库模式,有红灯进行指引
|
|
||||||
this.CurentMode = Mode.待机模式;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//延时处理
|
//判断当前模式是否为待机模式
|
||||||
Thread.Sleep(50);
|
else if (this.CurentMode != Mode.待机模式)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.CurentMode = Mode.入库模式;
|
||||||
|
}
|
||||||
|
//清空错误
|
||||||
|
ExceptionMessages.Clear();
|
||||||
|
ProcessingExceptions.Clear();
|
||||||
|
//货架所有模组发送指令进入入库模式
|
||||||
|
foreach (var module in Modules.Where(t => t.IsEnable).ToList())
|
||||||
|
{
|
||||||
|
module.GoInInstoreMode(TcpCleint);
|
||||||
|
}
|
||||||
|
//延时获取异常
|
||||||
|
var timeOut = 3000;
|
||||||
|
var timeSpan = TimeSpan.FromMilliseconds(0);
|
||||||
|
var beginTime = DateTime.Now;
|
||||||
|
while (timeSpan <= TimeSpan.FromMilliseconds(timeOut))
|
||||||
|
{
|
||||||
|
timeSpan = DateTime.Now - beginTime;
|
||||||
|
|
||||||
|
//所有板子成功进入入库模式 表示进入入库模式成功,跳出循环
|
||||||
|
var isExistsNotInstore = Modules.Where(t => t.CurrentMode != Mode.入库模式)
|
||||||
|
.Where(t => t.IsEnable)
|
||||||
|
.Any();
|
||||||
|
if (!isExistsNotInstore)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//接收到第一个异常就不继续循环了
|
||||||
|
if (ExceptionMessages.Count() > 0)
|
||||||
|
{
|
||||||
|
var deficientTime = timeOut - (int)timeSpan.TotalMilliseconds;
|
||||||
|
if (deficientTime > 0)
|
||||||
|
Thread.Sleep(deficientTime);
|
||||||
|
//出现异常的未进入入库模式,有红灯进行指引
|
||||||
|
this.CurentMode = Mode.待机模式;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//循环延时处理
|
||||||
|
Thread.Sleep(50);
|
||||||
|
}
|
||||||
|
|
||||||
|
//循环结束后判断当前板子状态
|
||||||
|
var notInstoreList = Modules.Where(t => t.CurrentMode != Mode.入库模式)
|
||||||
|
.Where(t => t.IsEnable).ToList();
|
||||||
|
|
||||||
|
if (notInstoreList.Count > 0)
|
||||||
|
{
|
||||||
|
CurentMode = Mode.待机模式;
|
||||||
|
foreach (var item in notInstoreList)
|
||||||
|
{
|
||||||
|
ExceptionMessages.Add($"模组{item.ModuleCode}未进入入库模式!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//警示灯亮起
|
||||||
|
WarningLight.BlueLight(TcpCleint);
|
||||||
|
//绑定当前进入入库PDA/WCS前端的IP
|
||||||
|
InstoreIpAddress = IPAddress;
|
||||||
|
//返回成功
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
GoOutInstore();
|
||||||
|
throw ex;
|
||||||
}
|
}
|
||||||
//警示灯亮起
|
|
||||||
WarningLight.BlueLight(TcpCleint);
|
|
||||||
//绑定当前进入入库PDA/WCS前端的IP
|
|
||||||
InstoreIpAddress = IPAddress;
|
|
||||||
//返回成功
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GoOutInstore()
|
public void GoOutInstore()
|
||||||
{
|
{
|
||||||
//看货架是否为入库模式
|
//当前货架是否为入库模式
|
||||||
if (CurentMode != Mode.入库模式)
|
if (CurentMode != Mode.入库模式)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -178,20 +228,81 @@ namespace WCS.BLL.HardWare
|
|||||||
this.CurentMode = Mode.待机模式;
|
this.CurentMode = Mode.待机模式;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//清空错误
|
||||||
|
ExceptionMessages.Clear();
|
||||||
//货架所有模组发送指令退出入库模式
|
//货架所有模组发送指令退出入库模式
|
||||||
foreach (var module in Modules.Where(t => t.IsEnable)
|
foreach (var module in Modules.Where(t => t.IsEnable)
|
||||||
//.Where(t => t.CurrentMode == Mode.入库模式)
|
|
||||||
.ToList())
|
.ToList())
|
||||||
{
|
{
|
||||||
module.GoOutInstoreMode(TcpCleint);
|
if (module.CurrentMode == Mode.入库模式)
|
||||||
|
module.GoOutInstoreMode(TcpCleint);
|
||||||
|
}
|
||||||
|
|
||||||
|
var timeOut = 3000;
|
||||||
|
var timeSpan = TimeSpan.FromMilliseconds(0);
|
||||||
|
var beginTime = DateTime.Now;
|
||||||
|
while (timeSpan <= TimeSpan.FromMilliseconds(timeOut))
|
||||||
|
{
|
||||||
|
timeSpan = DateTime.Now - beginTime;
|
||||||
|
//所有板子是否成功退出入库模式
|
||||||
|
var isExistsInstore = Modules.Where(t => t.CurrentMode != Mode.待机模式)
|
||||||
|
.Where(t => t.IsEnable)
|
||||||
|
.Any();
|
||||||
|
if (!isExistsInstore)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//循环延时处理
|
||||||
|
Thread.Sleep(50);
|
||||||
|
}
|
||||||
|
|
||||||
|
//循环结束后判断当前板子状态
|
||||||
|
var list = Modules.Where(t => t.CurrentMode != Mode.待机模式)
|
||||||
|
.Where(t => t.IsEnable)
|
||||||
|
.ToList();
|
||||||
|
if (list.Count > 0)
|
||||||
|
{
|
||||||
|
CurentMode = Mode.待机模式;
|
||||||
|
foreach (var item in list)
|
||||||
|
{
|
||||||
|
ExceptionMessages.Add($"模组{item.ModuleCode}未成功退出入库模式!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//报警灯熄灭
|
//报警灯熄灭
|
||||||
WarningLight.CloseLight(TcpCleint);
|
WarningLight.CloseLight(TcpCleint);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GoInOutstore()
|
public void GoInOutstore(List<OutOrderMatDetail> MatDetails, OutOrder outOrder)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
//第一步:设置货架当前模式
|
||||||
|
if (CurentMode != Mode.待机模式)
|
||||||
|
{
|
||||||
|
Modules.ForEach(t => { t.Reset(TcpCleint); });
|
||||||
|
}
|
||||||
|
CurentMode = Mode.出库模式;
|
||||||
|
|
||||||
|
//第二步:货架添加需要出的SN 出库的领料单号
|
||||||
|
//移除货架所有现有待出库的MatSN
|
||||||
|
CurrentOutStoreMatSNs.Clear();
|
||||||
|
////添加属于当前货架的物料
|
||||||
|
CurrentOutStoreMatSNs.AddRange(MatDetails.Select(t => t.MatSN).ToList());
|
||||||
|
////记录当前出库的发料单
|
||||||
|
CurrentOutOrder = outOrder;
|
||||||
|
|
||||||
|
////第三步:对应的模组进入出库模式
|
||||||
|
var boardIds = MatDetails.Select(t => t.StoreInfo.BoardId)
|
||||||
|
.Distinct()
|
||||||
|
.ToList();
|
||||||
|
var outModules = Modules.Where(t => boardIds.Contains(t.BoardId)).ToList();
|
||||||
|
outModules.ForEach(t =>
|
||||||
|
{
|
||||||
|
var outMatSns = MatDetails.Where(t => t.StoreInfo.ModuleId == t.Id)
|
||||||
|
.Select(t => t.MatSN)
|
||||||
|
.ToList();
|
||||||
|
t.GoInOutStoreMode(TcpCleint, outMatSns);
|
||||||
|
});
|
||||||
|
//所有板子亮灯后 亮警示灯
|
||||||
|
WarningLight.GreenLight(TcpCleint);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GoInStocktaking()
|
public void GoInStocktaking()
|
||||||
@ -201,6 +312,15 @@ namespace WCS.BLL.HardWare
|
|||||||
|
|
||||||
public void GoOutOutstore()
|
public void GoOutOutstore()
|
||||||
{
|
{
|
||||||
|
//找到在出库中的模组
|
||||||
|
var outingModules = Modules.Where(t => t.CurrentMode == Mode.出库模式)
|
||||||
|
.ToList();
|
||||||
|
foreach (var module in outingModules)
|
||||||
|
{
|
||||||
|
module.GoOutOutStoreMode(TcpCleint);
|
||||||
|
}
|
||||||
|
CurrentOutOrder = null;
|
||||||
|
CurrentOutStoreMatSNs.Clear();
|
||||||
this.CurentMode = Mode.待机模式;
|
this.CurentMode = Mode.待机模式;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,6 +356,7 @@ namespace WCS.BLL.HardWare
|
|||||||
#region 协议返回处理
|
#region 协议返回处理
|
||||||
public void ProtocolProcess(byte[] data, int boardId, int lightNumber)
|
public void ProtocolProcess(byte[] data, int boardId, int lightNumber)
|
||||||
{
|
{
|
||||||
|
Logs.Write("协议处理中的数据" + BitConverter.ToString(data) + $"板子id{boardId}");
|
||||||
//协议处理 判断功能位
|
//协议处理 判断功能位
|
||||||
switch (data[TcpCleint.PreFixLength + 2])
|
switch (data[TcpCleint.PreFixLength + 2])
|
||||||
{
|
{
|
||||||
@ -248,8 +369,21 @@ namespace WCS.BLL.HardWare
|
|||||||
case 0x03://正常入库信号
|
case 0x03://正常入库信号
|
||||||
InStoreReturnProcess(data);
|
InStoreReturnProcess(data);
|
||||||
break;
|
break;
|
||||||
|
case 0x04://入库模式中异常信号
|
||||||
|
InStoreExceptionReturnProcess(data, boardId, lightNumber);
|
||||||
|
break;
|
||||||
case 0x05://进入出库模式返回信号
|
case 0x05://进入出库模式返回信号
|
||||||
|
GoInOutstoreProcess(data, boardId, lightNumber);
|
||||||
|
break;
|
||||||
|
case 0x06://退出出库模式返回信号
|
||||||
|
GoOutOutstoreProcess(data, boardId, lightNumber);
|
||||||
|
break;
|
||||||
|
case 0x07://正常出库返回信号
|
||||||
|
OutstoreReturnProcess(data, boardId, lightNumber);
|
||||||
|
break;
|
||||||
|
case 0x13://复位的返回信号
|
||||||
|
ResetReturnProcess(data, boardId, lightNumber);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
;
|
;
|
||||||
break;
|
break;
|
||||||
@ -376,7 +510,7 @@ namespace WCS.BLL.HardWare
|
|||||||
//库位未配置、返回数据异常
|
//库位未配置、返回数据异常
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Logs.Write($"[进入入库模式异常]板Id{boardId},库位号{index + 1}找不到对应库位!");
|
//Logs.Write($"[进入入库模式异常]板Id{boardIds},库位号{index + 1}找不到对应库位!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (dataTemp[2 * index] == '0')
|
else if (dataTemp[2 * index] == '0')
|
||||||
@ -451,6 +585,9 @@ namespace WCS.BLL.HardWare
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
var exceptionMessage = storeInfo.StoreCode + "入库过程中存在物料未扫描上架!";
|
||||||
|
WebSoceketManager.TrySendMessage("127.0.0.1", exceptionMessage);
|
||||||
|
|
||||||
module.ComfirmErrInstore(TcpCleint);
|
module.ComfirmErrInstore(TcpCleint);
|
||||||
WarningLight.WaringLightBlueEnd(TcpCleint);
|
WarningLight.WaringLightBlueEnd(TcpCleint);
|
||||||
//WaringLightBlueEnd(shelfStatus.ClientIp, shelfStatus.LightId);
|
//WaringLightBlueEnd(shelfStatus.ClientIp, shelfStatus.LightId);
|
||||||
@ -463,7 +600,7 @@ namespace WCS.BLL.HardWare
|
|||||||
{
|
{
|
||||||
module.ComfirmErrInstore(TcpCleint);
|
module.ComfirmErrInstore(TcpCleint);
|
||||||
WarningLight.WaringLightBlueEnd(TcpCleint);
|
WarningLight.WaringLightBlueEnd(TcpCleint);
|
||||||
//ComfirmErrInstoreByIp(shelfStatus.ClientIp, boardId);
|
//ComfirmErrInstoreByIp(shelfStatus.ClientIp, boardIds);
|
||||||
//WaringLightBlueEnd(shelfStatus.ClientIp, shelfStatus.LightId);
|
//WaringLightBlueEnd(shelfStatus.ClientIp, shelfStatus.LightId);
|
||||||
//TO DO Logs.Write($"[{guid}]该位置已放置物料!");
|
//TO DO Logs.Write($"[{guid}]该位置已放置物料!");
|
||||||
return;
|
return;
|
||||||
@ -549,6 +686,64 @@ namespace WCS.BLL.HardWare
|
|||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 入库模式中异常处理
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="data"></param>
|
||||||
|
/// <param name="boardId"></param>
|
||||||
|
/// <param name="lightNumber"></param>
|
||||||
|
public void InStoreExceptionReturnProcess(byte[] data, int boardId, int lightNumber)
|
||||||
|
{
|
||||||
|
lightNumber = (int)data[TcpCleint.PreFixLength + 4];
|
||||||
|
var store = DbHelp.db.Queryable<StoreInfo>()
|
||||||
|
.Where(t => t.BoardId == boardId && t.LightNumber == lightNumber)
|
||||||
|
.First();
|
||||||
|
if (store == null)
|
||||||
|
{
|
||||||
|
//TO DO 库位未找到
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//已放物料丢失了 物料多放了 储位恢复正常
|
||||||
|
switch (data[TcpCleint.PreFixLength + 3])
|
||||||
|
{
|
||||||
|
case 0x00:
|
||||||
|
{
|
||||||
|
var exceptionMessage = store.StoreCode + "恢复正常!";
|
||||||
|
WebSoceketManager.TrySendMessage("127.0.0.1", exceptionMessage);
|
||||||
|
|
||||||
|
ProcessingExceptions.RemoveAll(t => t.BoardId == boardId);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x01:
|
||||||
|
{
|
||||||
|
var exceptionMessage = store.StoreCode + "入库过程中存在物料未扫描上架!";
|
||||||
|
WebSoceketManager.TrySendMessage("127.0.0.1", exceptionMessage);
|
||||||
|
|
||||||
|
ProcessingExceptions.Add(new ProcessingExceptionType()
|
||||||
|
{
|
||||||
|
BoardId = boardId,
|
||||||
|
LightNumber = lightNumber,
|
||||||
|
ExceptionMessage = store.StoreCode + "入库过程中存在物料未扫描上架!"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x02:
|
||||||
|
{
|
||||||
|
var exceptionMessage = store.StoreCode + "物料被取出!";
|
||||||
|
WebSoceketManager.TrySendMessage("127.0.0.1", exceptionMessage);
|
||||||
|
|
||||||
|
ProcessingExceptions.Add(new ProcessingExceptionType()
|
||||||
|
{
|
||||||
|
BoardId = boardId,
|
||||||
|
LightNumber = lightNumber,
|
||||||
|
ExceptionMessage = store.StoreCode + "入库过程中物料丢失!"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 进入出库模式协议返回
|
/// 进入出库模式协议返回
|
||||||
@ -570,7 +765,7 @@ namespace WCS.BLL.HardWare
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
module.CurrentMode = Mode.入库模式;
|
module.CurrentMode = Mode.出库模式;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//库存物料与实际情况不匹配
|
//库存物料与实际情况不匹配
|
||||||
@ -584,7 +779,7 @@ namespace WCS.BLL.HardWare
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
module.CurrentMode = Mode.入库模式;
|
module.CurrentMode = Mode.出库模式;
|
||||||
}
|
}
|
||||||
//获取当前板所有库位
|
//获取当前板所有库位
|
||||||
var storeInfos = DbHelp.db.Queryable<StoreInfo>()
|
var storeInfos = DbHelp.db.Queryable<StoreInfo>()
|
||||||
@ -673,7 +868,7 @@ namespace WCS.BLL.HardWare
|
|||||||
//库位未配置、返回数据异常
|
//库位未配置、返回数据异常
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Logs.Write($"[进入入库模式异常]板Id{boardId},库位号{index + 1}找不到对应库位!");
|
//Logs.Write($"[进入入库模式异常]板Id{boardIds},库位号{index + 1}找不到对应库位!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (dataTemp[2 * index] == '0')
|
else if (dataTemp[2 * index] == '0')
|
||||||
@ -695,6 +890,194 @@ namespace WCS.BLL.HardWare
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OutstoreReturnProcess(byte[] data, int boardId, int lightNumber)
|
||||||
|
{
|
||||||
|
if (CurentMode != Mode.出库模式)
|
||||||
|
{
|
||||||
|
//TO DO 未在出库模式 要报错
|
||||||
|
//Logs.Write($"[{guid}]出库错误:该货架模式不是出库模式或盘点模式{storeInfo.ShelfCode}!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
lightNumber = Convert.ToInt32(data[TcpCleint.PreFixLength + 3]);
|
||||||
|
var storeInfo = DbHelp.db.Queryable<StoreInfo>().Where(t => t.BoardId == boardId
|
||||||
|
&& t.LightNumber == lightNumber)
|
||||||
|
.First();
|
||||||
|
if (storeInfo == null)
|
||||||
|
{
|
||||||
|
//TO DO 报错
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var module = this.Modules.Where(t => t.BoardId == boardId)
|
||||||
|
.FirstOrDefault();
|
||||||
|
if (module == null)
|
||||||
|
{
|
||||||
|
//TO DO 报错
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//当前库位未记录MatSn
|
||||||
|
if (string.IsNullOrEmpty(storeInfo.CurrentMatSn))
|
||||||
|
{
|
||||||
|
//该库位是需要出库的库位,物料被多次取出or给了多个正常出库信号
|
||||||
|
Logs.Write($"该库位是需要出库的库位,物料被反复取出or给了多个正常出库信号,库位{storeInfo.StoreCode}");
|
||||||
|
//暂不进行处理
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//不是本次出库需要出的物料
|
||||||
|
if (!CurrentOutStoreMatSNs.Contains(storeInfo.CurrentMatSn))
|
||||||
|
{
|
||||||
|
//Logs.Write($"{storeInfo.CurrentMatSN}不是本次需要出库的物料");
|
||||||
|
//报警灯报警
|
||||||
|
WarningLight.WaringLightAlwaysRed(TcpCleint);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取当前的库存信息
|
||||||
|
var inventoryDetail = DbHelp.db.Queryable<InventoryDetail>().Where(t => t.MatSN == storeInfo.CurrentMatSn).First();
|
||||||
|
if (inventoryDetail == null)
|
||||||
|
{
|
||||||
|
//Logs.Write($"{storeInfo.CurrentMatSN}库存信息不存在");
|
||||||
|
//报警灯报警
|
||||||
|
WarningLight.WaringLightAlwaysRed(TcpCleint);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//获取对应的出库单明细
|
||||||
|
var orderOrderDetails = DbHelp.db.Queryable<OutOrderMatDetail>()
|
||||||
|
.Where(t => t.OrderId == CurrentOutOrder.Id)
|
||||||
|
.Where(t => t.MatSN == inventoryDetail.MatSN)
|
||||||
|
.ToList();
|
||||||
|
if (orderOrderDetails == null || orderOrderDetails.Count == 0)
|
||||||
|
{
|
||||||
|
//Logs.Write($"{storeInfo.CurrentMatSN},OrderDetail出库明细信息不存在");
|
||||||
|
//报警灯报警
|
||||||
|
WarningLight.WaringLightAlwaysRed(TcpCleint);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 校验项通过 处理出库逻辑
|
||||||
|
//当前库位的SN
|
||||||
|
var matSN = storeInfo.CurrentMatSn;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DbHelp.db.BeginTran();
|
||||||
|
//库存明细表 删除
|
||||||
|
;
|
||||||
|
//出入库记录表 新增
|
||||||
|
var inOutRecord = new InOutRecord()
|
||||||
|
{
|
||||||
|
StoreCode = storeInfo.StoreCode,
|
||||||
|
StoreId = storeInfo.Id,
|
||||||
|
StoreInfo = storeInfo,
|
||||||
|
|
||||||
|
MatSN = inventoryDetail.MatSN,
|
||||||
|
MatCode = inventoryDetail.MatCode,
|
||||||
|
MatName = inventoryDetail.MatName,
|
||||||
|
MatBatch = inventoryDetail.MatBatch,
|
||||||
|
MatQty = inventoryDetail.MatQty,
|
||||||
|
MatSpec = inventoryDetail.MatSpec,
|
||||||
|
MatCustomer = inventoryDetail.MatCustomer,
|
||||||
|
MatSupplier = inventoryDetail.MatSupplier,
|
||||||
|
|
||||||
|
Direction = DirectionEnum.出库,
|
||||||
|
};
|
||||||
|
//库位表 修改
|
||||||
|
storeInfo.CurrentMatSn = string.Empty;
|
||||||
|
|
||||||
|
//发料单明细表 更新为已出库
|
||||||
|
orderOrderDetails.ForEach(x =>
|
||||||
|
{
|
||||||
|
x.IsSended = true;
|
||||||
|
});
|
||||||
|
//TO DO 发料需求表增加数量
|
||||||
|
|
||||||
|
//保存数据
|
||||||
|
DbHelp.db.Deleteable(inventoryDetail).ExecuteCommand();
|
||||||
|
DbHelp.db.Insertable(inOutRecord).ExecuteCommand();
|
||||||
|
DbHelp.db.Updateable(storeInfo).ExecuteCommand();
|
||||||
|
DbHelp.db.Updateable(orderOrderDetails).ExecuteCommand();
|
||||||
|
DbHelp.db.CommitTran();
|
||||||
|
|
||||||
|
//报警灯同时亮绿灯并鸣叫一次提示。
|
||||||
|
WarningLight.SuccessLightGreenEnd(TcpCleint);
|
||||||
|
|
||||||
|
//确认本次出库
|
||||||
|
module.ComfirmOutstore(TcpCleint, data[TcpCleint.PreFixLength + 3]);
|
||||||
|
//shelfStatus.SetCurrentModeTime = DateTime.Now;
|
||||||
|
//LocalStatic.IsRefreshOrderDetail = true;
|
||||||
|
|
||||||
|
//当前柜子是否还存在未出库的
|
||||||
|
CurrentOutStoreMatSNs.RemoveAll(t => t == matSN);//删除本次已出的物料SN
|
||||||
|
|
||||||
|
var isExsistOut = CurrentOutStoreMatSNs.Any();
|
||||||
|
if (!isExsistOut)
|
||||||
|
{
|
||||||
|
//Logs.Write($"货架[{shelfStatus.ShelfCode}]:不存在待出物料,退出出库模式");
|
||||||
|
//退出出库模式
|
||||||
|
GoOutOutstore();
|
||||||
|
WarningLight.CloseLight(TcpCleint);
|
||||||
|
|
||||||
|
var currentPickBillNumber = CurrentOutOrder.OrderNumber;
|
||||||
|
CurrentOutOrder = null;
|
||||||
|
Task.Run(() =>
|
||||||
|
{
|
||||||
|
//LocalStatic.UpdatOutOrderStatus(currentPickBillNumber);
|
||||||
|
//给信号通知出库页面更新页面的状态
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
DbHelp.db.RollbackTran();
|
||||||
|
//报警灯报警
|
||||||
|
WarningLight.WaringLightAlwaysRed(TcpCleint);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 退出出库模式返回信号处理
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="data"></param>
|
||||||
|
public void GoOutOutstoreProcess(byte[] data, int boardId, int lightNumber)
|
||||||
|
{
|
||||||
|
var module = this.Modules.Where(t => t.BoardId == boardId && t.CurrentMode == Mode.出库模式).FirstOrDefault();
|
||||||
|
if (module == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
module.CurrentMode = Mode.待机模式;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ResetReturnProcess(byte[] data, int boardId, int lightNumber)
|
||||||
|
{
|
||||||
|
var module = this.Modules.Where(t => t.BoardId == boardId && t.CurrentMode == Mode.入库模式).FirstOrDefault();
|
||||||
|
if (module == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
module.CurrentMode = Mode.待机模式;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 过程中异常类型
|
||||||
|
/// </summary>
|
||||||
|
public class ProcessingExceptionType
|
||||||
|
{
|
||||||
|
public int BoardId { get; set; }
|
||||||
|
|
||||||
|
public int LightNumber { get; set; }
|
||||||
|
|
||||||
|
public string ExceptionMessage { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using TouchSocket.Core;
|
||||||
using WCS.DAL.Db;
|
using WCS.DAL.Db;
|
||||||
using WCS.DAL.DbModels;
|
using WCS.DAL.DbModels;
|
||||||
|
|
||||||
@ -32,6 +34,22 @@ namespace WCS.BLL.HardWare
|
|||||||
/// 自检模式
|
/// 自检模式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public byte[] CheckModeData = { 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
public byte[] CheckModeData = { 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 进入出库模式
|
||||||
|
/// </summary>
|
||||||
|
public byte[] GoInOutstoreModeData = { 0x05, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00 };
|
||||||
|
|
||||||
|
public byte[] ComfirmOutstoreData = { 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||||
|
/// <summary>
|
||||||
|
/// 退出出库模式
|
||||||
|
/// </summary>
|
||||||
|
public byte[] GoOutOutstoreModeData = { 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 复位命令
|
||||||
|
/// </summary>
|
||||||
|
public byte[] ResetData = { 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||||
#endregion
|
#endregion
|
||||||
public int ModuleId { get; set; }
|
public int ModuleId { get; set; }
|
||||||
public string ModuleCode { get; set; }
|
public string ModuleCode { get; set; }
|
||||||
@ -90,11 +108,24 @@ namespace WCS.BLL.HardWare
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//退出对应的模式 回到待机状态 并记录对应的状态日志(这个分支肯定是异常了)
|
//这里应该是状态异常的 正常不会是这种状态
|
||||||
//记录错误日志
|
Reset(tcpClient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 复位
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tcpClient"></param>
|
||||||
|
public void Reset(TCPClient tcpClient)
|
||||||
|
{
|
||||||
|
tcpClient.Send(tcpClient.GenerateMessage(BoardId, ResetData));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 自检
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tcpClient"></param>
|
||||||
public void ShelfCheck(TCPClient tcpClient)
|
public void ShelfCheck(TCPClient tcpClient)
|
||||||
{
|
{
|
||||||
if (CurrentMode != Mode.待机模式)
|
if (CurrentMode != Mode.待机模式)
|
||||||
@ -122,5 +153,68 @@ namespace WCS.BLL.HardWare
|
|||||||
|
|
||||||
tcpClient.Send(tcpClient.GenerateMessage(BoardId, CheckModeData));
|
tcpClient.Send(tcpClient.GenerateMessage(BoardId, CheckModeData));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 进入出库模式、亮灯
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tcpClient"></param>
|
||||||
|
public void GoInOutStoreMode(TCPClient tcpClient, List<string> outSns)
|
||||||
|
{
|
||||||
|
var storeInfos = DbHelp.db.Queryable<StoreInfo>()
|
||||||
|
.Where(t => t.BoardId == BoardId)
|
||||||
|
.OrderBy(t => t.LightNumber)
|
||||||
|
.ToList();
|
||||||
|
//计算物料在库的库位
|
||||||
|
char[] data = "0000000000000000".ToCharArray();
|
||||||
|
var storeNumber = storeInfos.Count();
|
||||||
|
foreach (var storeInfo in storeInfos)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(storeInfo.CurrentMatSn) && storeInfo.LightNumber > 0 && storeInfo.LightNumber <= storeNumber)
|
||||||
|
{
|
||||||
|
data[storeInfo.LightNumber - 1] = '1';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var dataStr = string.Join("", data.Reverse());
|
||||||
|
var data1 = dataStr.Substring(8, 8);
|
||||||
|
var data2 = dataStr.Substring(0, 8);
|
||||||
|
GoInOutstoreModeData[1] = Convert.ToByte(data1, 2);
|
||||||
|
GoInOutstoreModeData[2] = Convert.ToByte(data2, 2);
|
||||||
|
|
||||||
|
//出库位置亮灯
|
||||||
|
if (outSns != null && outSns.Count > 0)
|
||||||
|
{
|
||||||
|
var outStoreInfos = storeInfos.Where(t => outSns.Contains(t.CurrentMatSn))
|
||||||
|
.ToList();
|
||||||
|
char[] outData = "0000000000000000".ToCharArray();
|
||||||
|
foreach (var storeInfo in outStoreInfos)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(storeInfo.CurrentMatSn) && storeInfo.LightNumber > 0 && storeInfo.LightNumber <= storeNumber)
|
||||||
|
{
|
||||||
|
outData[storeInfo.LightNumber - 1] = '1';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var outDataStr = string.Join("", outData.Reverse());
|
||||||
|
var data3 = outDataStr.Substring(8, 8);
|
||||||
|
var data4 = outDataStr.Substring(0, 8);
|
||||||
|
GoInOutstoreModeData[3] = Convert.ToByte(data3, 2);
|
||||||
|
GoInOutstoreModeData[4] = Convert.ToByte(data4, 2);
|
||||||
|
}
|
||||||
|
tcpClient.Send(tcpClient.GenerateMessage(BoardId, GoInOutstoreModeData));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ComfirmOutstore(TCPClient tcpClient, byte lightNumber)
|
||||||
|
{
|
||||||
|
ComfirmOutstoreData[1] = lightNumber;
|
||||||
|
tcpClient.Send(tcpClient.GenerateMessage(BoardId, ComfirmOutstoreData));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 退出出库模式
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tcpClient"></param>
|
||||||
|
public void GoOutOutStoreMode(TCPClient tcpClient)
|
||||||
|
{
|
||||||
|
tcpClient.Send(tcpClient.GenerateMessage(BoardId, GoOutOutstoreModeData));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ using System.Security.Cryptography.X509Certificates;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using TouchSocket.Core;
|
using TouchSocket.Core;
|
||||||
|
using TouchSocket.Sockets;
|
||||||
using WCS.BLL.HardWare;
|
using WCS.BLL.HardWare;
|
||||||
using WCS.DAL.Db;
|
using WCS.DAL.Db;
|
||||||
using WCS.DAL.DbModels;
|
using WCS.DAL.DbModels;
|
||||||
@ -19,16 +20,18 @@ namespace WCS.BLL.Manager
|
|||||||
public static List<TCPClient> TCPClients = new List<TCPClient>();
|
public static List<TCPClient> TCPClients = new List<TCPClient>();
|
||||||
public static void InitTcpClient()
|
public static void InitTcpClient()
|
||||||
{
|
{
|
||||||
var ips = DbHelp.db.Queryable<ShelfInfo>().Select(t => t.ClientIp).ToList();
|
var ips = DbHelp.db.Queryable<ShelfInfo>().Where(t => t.ShelfCode.Contains("A")).Select(t => t.ClientIp).ToList();
|
||||||
foreach (var ip in ips)
|
foreach (var ip in ips)
|
||||||
{
|
{
|
||||||
var tcpCleint = new TCPClient(ip, "192.168.0.154:20003");
|
var tcpCleint = new TCPClient(ip, "192.168.0.183:20003");
|
||||||
|
|
||||||
|
|
||||||
|
//var tcpCleint = new TCPClient("192.168.0.183:20002", "192.168.0.183:20003");
|
||||||
|
//配置断线重连
|
||||||
|
|
||||||
tcpCleint.tcpClient.Received += (client, e) =>
|
tcpCleint.tcpClient.Received += (client, e) =>
|
||||||
{
|
{
|
||||||
var clientIpHost = client.IP + ":" + client.Port;
|
var clientIpHost = client.IP + ":" + client.Port;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var TcpCleint = TCPClientManager.GetTCPClientByIPHost(clientIpHost);
|
var TcpCleint = TCPClientManager.GetTCPClientByIPHost(clientIpHost);
|
||||||
if (TcpCleint == null)
|
if (TcpCleint == null)
|
||||||
{
|
{
|
||||||
@ -47,14 +50,15 @@ namespace WCS.BLL.Manager
|
|||||||
if (isEqual)
|
if (isEqual)
|
||||||
{
|
{
|
||||||
var dataTemp = data.Skip(index).Take(TcpCleint.PreFixLength + TcpCleint.DataLength).ToArray();
|
var dataTemp = data.Skip(index).Take(TcpCleint.PreFixLength + TcpCleint.DataLength).ToArray();
|
||||||
|
Logs.Write($"接受到数据:{BitConverter.ToString(dataTemp)}");
|
||||||
if (dataTemp.Length < TcpCleint.PreFixLength + TcpCleint.DataLength)//拆包后不满足一条指令的长度
|
if (dataTemp.Length < TcpCleint.PreFixLength + TcpCleint.DataLength)//拆包后不满足一条指令的长度
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
index += (TcpCleint.PreFixLength + TcpCleint.DataLength - 1);//每次循环index会+1 所以这里-1
|
index += (TcpCleint.PreFixLength + TcpCleint.DataLength - 1);//每次循环index会+1 所以这里-1
|
||||||
//获取板子ID
|
//获取板子ID
|
||||||
var boardId = (data[TcpCleint.PreFixLength + 0] << 8) + data[TcpCleint.PreFixLength + 1];
|
var boardId = (dataTemp[TcpCleint.PreFixLength + 0] << 8) + dataTemp[TcpCleint.PreFixLength + 1];
|
||||||
var lightNumber = Convert.ToInt32(data[TcpCleint.PreFixLength + 3]);
|
var lightNumber = Convert.ToInt32(dataTemp[TcpCleint.PreFixLength + 3]);
|
||||||
|
|
||||||
//报警灯
|
//报警灯
|
||||||
if (dataTemp[TcpCleint.PreFixLength + 2] == 0x20)
|
if (dataTemp[TcpCleint.PreFixLength + 2] == 0x20)
|
||||||
@ -63,7 +67,7 @@ namespace WCS.BLL.Manager
|
|||||||
.Where(t => t.LightId == boardId)
|
.Where(t => t.LightId == boardId)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
var smartShelf = shelf as SmartShelf;
|
var smartShelf = shelf as SmartShelf;
|
||||||
smartShelf?.ProtocolProcess(data, boardId, lightNumber);
|
smartShelf?.ProtocolProcess(dataTemp, boardId, lightNumber);
|
||||||
}
|
}
|
||||||
//货架类型协议返回
|
//货架类型协议返回
|
||||||
else
|
else
|
||||||
@ -73,7 +77,7 @@ namespace WCS.BLL.Manager
|
|||||||
.Where(t => t.ModuleIds.Contains(boardId))
|
.Where(t => t.ModuleIds.Contains(boardId))
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
var smartShelf = shelf as SmartShelf;
|
var smartShelf = shelf as SmartShelf;
|
||||||
smartShelf?.ProtocolProcess(data, boardId, lightNumber);
|
smartShelf?.ProtocolProcess(dataTemp, boardId, lightNumber);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
52
WCS.BLL/Manager/WebSoceketManager.cs
Normal file
52
WCS.BLL/Manager/WebSoceketManager.cs
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using TouchSocket.Core;
|
||||||
|
using TouchSocket.Http;
|
||||||
|
using TouchSocket.Sockets;
|
||||||
|
|
||||||
|
namespace WCS.BLL.Manager
|
||||||
|
{
|
||||||
|
public static class WebSoceketManager
|
||||||
|
{
|
||||||
|
public static HttpService service;
|
||||||
|
public static void InitWebSocket()
|
||||||
|
{
|
||||||
|
service = new HttpService();
|
||||||
|
service.Setup(new TouchSocketConfig()//加载配置
|
||||||
|
.SetListenIPHosts(7789)
|
||||||
|
.ConfigureContainer(a =>
|
||||||
|
{
|
||||||
|
a.AddConsoleLogger();
|
||||||
|
})
|
||||||
|
.ConfigurePlugins(a =>
|
||||||
|
{
|
||||||
|
a.UseWebSocket()//添加WebSocket功能
|
||||||
|
.SetWSUrl("/ws")//设置url直接可以连接。
|
||||||
|
.UseAutoPong();//当收到ping报文时自动回应pong
|
||||||
|
a.Add<WebSocketServicePlugin>();//自定义插件。
|
||||||
|
}));
|
||||||
|
|
||||||
|
service.Start();
|
||||||
|
service.Logger.Info("服务器已启动");
|
||||||
|
}
|
||||||
|
//尝试发送报警信息给前端
|
||||||
|
public static void TrySendMessage(string IpAddress, string Message)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var clients = service.GetClients().Where(t => t.IP == IpAddress).ToList();
|
||||||
|
foreach (var client in clients)
|
||||||
|
{
|
||||||
|
client.WebSocket.SendAsync(Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
74
WCS.BLL/Manager/WebSocketServicePlugin.cs
Normal file
74
WCS.BLL/Manager/WebSocketServicePlugin.cs
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using TouchSocket.Core;
|
||||||
|
using TouchSocket.Http.WebSockets;
|
||||||
|
|
||||||
|
namespace WCS.BLL.Manager
|
||||||
|
{
|
||||||
|
public class WebSocketServicePlugin : PluginBase, IWebSocketReceivedPlugin
|
||||||
|
{
|
||||||
|
private readonly ILog m_logger;
|
||||||
|
|
||||||
|
public WebSocketServicePlugin(ILog logger)
|
||||||
|
{
|
||||||
|
this.m_logger = logger;
|
||||||
|
}
|
||||||
|
public async Task OnWebSocketReceived(IWebSocket client, WSDataFrameEventArgs e)
|
||||||
|
{
|
||||||
|
switch (e.DataFrame.Opcode)
|
||||||
|
{
|
||||||
|
case WSDataType.Cont:
|
||||||
|
m_logger.Info($"收到中间数据,长度为:{e.DataFrame.PayloadLength}");
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
case WSDataType.Text:
|
||||||
|
m_logger.Info(e.DataFrame.ToText());
|
||||||
|
|
||||||
|
if (!client.Client.IsClient)
|
||||||
|
{
|
||||||
|
var clients = WebSoceketManager.service.GetClients().ToList();
|
||||||
|
clients.ForEach(t =>
|
||||||
|
{
|
||||||
|
t.WebSocket.Send("我已收到");
|
||||||
|
});
|
||||||
|
client.Send("我已收到");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
|
||||||
|
case WSDataType.Binary:
|
||||||
|
if (e.DataFrame.FIN)
|
||||||
|
{
|
||||||
|
m_logger.Info($"收到二进制数据,长度为:{e.DataFrame.PayloadLength}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_logger.Info($"收到未结束的二进制数据,长度为:{e.DataFrame.PayloadLength}");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
|
||||||
|
case WSDataType.Close:
|
||||||
|
{
|
||||||
|
m_logger.Info("远程请求断开");
|
||||||
|
client.Close("断开");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
|
||||||
|
case WSDataType.Ping:
|
||||||
|
client.Pong();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WSDataType.Pong:
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
await e.InvokeNext();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -17,6 +17,8 @@ namespace WCS.BLL.Services.IService
|
|||||||
|
|
||||||
public Task<ResponseBase> GetOutOrderDetail(GetOutOrderDetailRequest request);
|
public Task<ResponseBase> GetOutOrderDetail(GetOutOrderDetailRequest request);
|
||||||
|
|
||||||
|
public Task<ResponseBase> GetOutOrderMatDetail(GetOutOrderDetailRequest request);
|
||||||
|
|
||||||
public Task<ResponseBase> GoInOutstore(GetOutOrderDetailRequest request);
|
public Task<ResponseBase> GoInOutstore(GetOutOrderDetailRequest request);
|
||||||
|
|
||||||
public Task<ResponseBase> GoOutOutstore(GetOutOrderDetailRequest request);
|
public Task<ResponseBase> GoOutOutstore(GetOutOrderDetailRequest request);
|
||||||
|
@ -27,5 +27,8 @@ namespace WCS.BLL.Services.IService
|
|||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<ResponseCommon<object>> addOrUpdateShelfInfo(AddShelfInfoRequest<ShelfInfo> request);
|
public Task<ResponseCommon<object>> addOrUpdateShelfInfo(AddShelfInfoRequest<ShelfInfo> request);
|
||||||
|
|
||||||
|
|
||||||
|
public Task<ResponseCommon<object>> GenerateStoreInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,6 +64,7 @@ namespace WCS.BLL.Services.Service
|
|||||||
Message = $"货架进入入库模式失败:{string.Join(",", shelf.ExceptionMessages)}",
|
Message = $"货架进入入库模式失败:{string.Join(",", shelf.ExceptionMessages)}",
|
||||||
Data = null
|
Data = null
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResponseBase shelfGoOutInStore(ShelfGoOutInStoreRequest request)
|
public ResponseBase shelfGoOutInStore(ShelfGoOutInStoreRequest request)
|
||||||
@ -78,15 +79,23 @@ namespace WCS.BLL.Services.Service
|
|||||||
Message = $"退出入库模式失败:货架[{request.ShelfCode}]不存在!",
|
Message = $"退出入库模式失败:货架[{request.ShelfCode}]不存在!",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
//TO DO 判断扫码枪 是否被其他扫码枪所占用 如果占用 直接退出入库模式 不发指令
|
|
||||||
//两个扫码枪互相占用入库会有问题
|
//判断扫码枪 是否被其他扫码枪所占用 如果占用 直接退出入库模式 不发指令
|
||||||
shelf.GoOutInstore();
|
shelf.GoOutInstore();
|
||||||
|
|
||||||
return new ResponseCommon()
|
if (shelf.ExceptionMessages == null || shelf.ExceptionMessages.Count == 0)
|
||||||
{
|
//已退出
|
||||||
Code = 200,
|
return new ResponseCommon()
|
||||||
Message = $"货架[{request.ShelfCode}]已退出入库模式!",
|
{
|
||||||
};
|
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)
|
public async Task<ResponseBase> queryByMatSn(QueryByMatSnRequest request)
|
||||||
@ -120,8 +129,8 @@ namespace WCS.BLL.Services.Service
|
|||||||
Message = $"操作失败:物料{inventory.MatSN}已入库,库位为{inventory.StoreCode}",
|
Message = $"操作失败:物料{inventory.MatSN}已入库,库位为{inventory.StoreCode}",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#region 获取物料数据
|
#region 获取物料数据 //调用接口或者直接查询数据库
|
||||||
//调用接口或者直接查询数据库
|
//调用接口
|
||||||
if (1 != 1)
|
if (1 != 1)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -4,11 +4,14 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using TouchSocket.Sockets;
|
||||||
using WCS.BLL.DbModels;
|
using WCS.BLL.DbModels;
|
||||||
using WCS.BLL.Manager;
|
using WCS.BLL.Manager;
|
||||||
using WCS.BLL.Services.IService;
|
using WCS.BLL.Services.IService;
|
||||||
using WCS.DAL.Db;
|
using WCS.DAL.Db;
|
||||||
|
using WCS.DAL.DbModels;
|
||||||
using WCS.Model;
|
using WCS.Model;
|
||||||
|
using WCS.Model.ApiModel.OutStore;
|
||||||
|
|
||||||
namespace WCS.BLL.Services.Service
|
namespace WCS.BLL.Services.Service
|
||||||
{
|
{
|
||||||
@ -55,8 +58,10 @@ namespace WCS.BLL.Services.Service
|
|||||||
OrderId = order.Id,
|
OrderId = order.Id,
|
||||||
OrderNumber = order.OrderNumber,
|
OrderNumber = order.OrderNumber,
|
||||||
MatCode = item.MatCode,
|
MatCode = item.MatCode,
|
||||||
|
MatName = item.MatName,
|
||||||
MatBatch = item.MatBatch,
|
MatBatch = item.MatBatch,
|
||||||
ReqQty = item.ReqQty,
|
ReqQty = item.ReqQty,
|
||||||
|
OutQty = 0,
|
||||||
CreateUser = request.UserName
|
CreateUser = request.UserName
|
||||||
};
|
};
|
||||||
await DbHelp.db.Insertable(orderDetail).ExecuteCommandAsync();
|
await DbHelp.db.Insertable(orderDetail).ExecuteCommandAsync();
|
||||||
@ -202,18 +207,31 @@ namespace WCS.BLL.Services.Service
|
|||||||
public async Task<ResponseBase> GetOutOrderList(GetOutOrderListRequest request)
|
public async Task<ResponseBase> GetOutOrderList(GetOutOrderListRequest request)
|
||||||
{
|
{
|
||||||
//直接查询
|
//直接查询
|
||||||
var outOrderList = await DbHelp.db.Queryable<OutOrder>()
|
var recordsQueryable = DbHelp.db.Queryable<OutOrder>()
|
||||||
.WhereIF(!string.IsNullOrEmpty(request.OrderNumber), t => t.OrderNumber.Contains(request.OrderNumber))
|
.WhereIF(!string.IsNullOrEmpty(request.OrderNumber), t => t.OrderNumber.Contains(request.OrderNumber))
|
||||||
.Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize)
|
.WhereIF(!string.IsNullOrEmpty(request.OrderSource), t => t.OrderSource.Contains(request.OrderSource))
|
||||||
.ToListAsync();
|
.WhereIF(!string.IsNullOrEmpty(request.OrderType), t => t.OrderType.Contains(request.OrderType));
|
||||||
|
|
||||||
|
var totalCount = await recordsQueryable.CountAsync();
|
||||||
|
var records = await recordsQueryable
|
||||||
|
.Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize)
|
||||||
|
.ToListAsync();
|
||||||
|
//生成序号
|
||||||
|
for (int i = 0; i < records.Count; i++)
|
||||||
|
{
|
||||||
|
records[i].RowNumber = (request.PageNumber - 1) * 10 + i + 1;
|
||||||
|
}
|
||||||
|
|
||||||
return new PageQueryResponse<OutOrder>()
|
return new PageQueryResponse<OutOrder>()
|
||||||
{
|
{
|
||||||
Code = 200,
|
Code = 200,
|
||||||
Message = "success",
|
Message = $"success",
|
||||||
Data = new PageQueryResponseData<OutOrder>()
|
Data = new PageQueryResponseData<OutOrder>()
|
||||||
{
|
{
|
||||||
Lists = outOrderList,
|
TotalCount = totalCount,
|
||||||
Count = outOrderList.Count
|
MaxPage = request.PageSize == 0 ? 0 : (int)Math.Ceiling((decimal)totalCount / request.PageSize),
|
||||||
|
Count = records.Count,
|
||||||
|
Lists = records.ToList()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -235,7 +253,7 @@ namespace WCS.BLL.Services.Service
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (string.IsNullOrEmpty(request.OrderNumber))
|
else if (!string.IsNullOrEmpty(request.OrderNumber))
|
||||||
{
|
{
|
||||||
outOrder = await DbHelp.db.Queryable<OutOrder>().Where(t => t.OrderNumber == request.OrderNumber)
|
outOrder = await DbHelp.db.Queryable<OutOrder>().Where(t => t.OrderNumber == request.OrderNumber)
|
||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
@ -262,29 +280,84 @@ namespace WCS.BLL.Services.Service
|
|||||||
var orderDetailTask = DbHelp.db.Queryable<OutOrderDetail>()
|
var orderDetailTask = DbHelp.db.Queryable<OutOrderDetail>()
|
||||||
.Where(t => t.OrderId == outOrder.Id)
|
.Where(t => t.OrderId == outOrder.Id)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
var orderDetail = await orderDetailTask;
|
||||||
|
//生成序号
|
||||||
|
for (int i = 0; i < orderDetail.Count; i++)
|
||||||
|
{
|
||||||
|
orderDetail[i].RowNumber = i + 1;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
return new ResponseCommon<List<OutOrderDetail>>()
|
||||||
|
{
|
||||||
|
Code = 200,
|
||||||
|
Message = "Success",
|
||||||
|
Data = orderDetail
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ResponseBase> GetOutOrderMatDetail(GetOutOrderDetailRequest request)
|
||||||
|
{
|
||||||
|
OutOrder outOrder = null;
|
||||||
|
|
||||||
|
#region 查询出库单
|
||||||
|
if (request.OrderId != 0)
|
||||||
|
{
|
||||||
|
outOrder = await DbHelp.db.Queryable<OutOrder>().Where(t => t.Id == request.OrderId).FirstAsync();
|
||||||
|
if (outOrder == null)
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"查询失败:不存在Id为{request.OrderId}的出库单!",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!string.IsNullOrEmpty(request.OrderNumber))
|
||||||
|
{
|
||||||
|
outOrder = await DbHelp.db.Queryable<OutOrder>().Where(t => t.OrderNumber == request.OrderNumber)
|
||||||
|
.FirstAsync();
|
||||||
|
if (outOrder == null)
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"查询失败:不存在单据号为{request.OrderNumber}的出库单!",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"查询失败:缺少必要参数!",
|
||||||
|
};
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 出库物料明细
|
#region 出库物料明细
|
||||||
var orderMatDetailTask = DbHelp.db.Queryable<OutOrderMatDetail>()
|
var orderMatDetailTask = DbHelp.db.Queryable<OutOrderMatDetail>()
|
||||||
.Where(t => t.OrderId == outOrder.Id)
|
.Where(t => t.OrderId == outOrder.Id)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
var orderMatDetail = await orderMatDetailTask;
|
||||||
|
//生成序号
|
||||||
|
for (int i = 0; i < orderMatDetail.Count; i++)
|
||||||
|
{
|
||||||
|
orderMatDetail[i].RowNumber = i + 1;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
var orderDetail = await orderDetailTask;
|
|
||||||
var orderMatDetail = await orderMatDetailTask;
|
return new ResponseCommon<List<OutOrderMatDetail>>
|
||||||
return new ResponseCommon()
|
|
||||||
{
|
{
|
||||||
Code = 200,
|
Code = 200,
|
||||||
Message = "Success",
|
Message = "Success",
|
||||||
Data = new
|
Data = orderMatDetail
|
||||||
{
|
|
||||||
OrderDetailLists = orderDetail,
|
|
||||||
OrderMatDetailLists = orderMatDetail,
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private string GenerateOrderNumber()
|
private string GenerateOrderNumber()
|
||||||
{
|
{
|
||||||
var orderNumber = "PD" + DateTime.Now.ToString("yyyyMMddHHmmss");
|
var orderNumber = "PD" + DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||||
@ -303,26 +376,60 @@ namespace WCS.BLL.Services.Service
|
|||||||
return new ResponseCommon()
|
return new ResponseCommon()
|
||||||
{
|
{
|
||||||
Code = 201,
|
Code = 201,
|
||||||
Message = "不存在对应的出库单据!",
|
Message = $"不存在对应的出库单据{request.OrderNumber}!",
|
||||||
Data = null
|
Data = null
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
//获取出库单据明细
|
|
||||||
//TO DO 如果是按物料编码出库 需要计算物料明细保存并进行锁定
|
//如果是按物料编码出库 需要计算物料明细、并进行物料锁定
|
||||||
if (order.SyncType == SyncTypeEnum.ByMatCode)
|
if (order.SyncType == SyncTypeEnum.ByMatCode)
|
||||||
{
|
{
|
||||||
|
var result = CaculateOutOrderMatDetails(order);
|
||||||
|
if (result.Code != 200)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//分组 按物料找到对应的货架
|
//获取需要出库的物料明细
|
||||||
|
var outOrderMatDetails = DbHelp.db.Queryable<OutOrderMatDetail>()
|
||||||
|
.Where(t => t.OrderId == order.Id)
|
||||||
|
.Where(t => t.IsSended == false)
|
||||||
|
.Includes(t => t.StoreInfo)
|
||||||
|
.ToList();
|
||||||
|
if (outOrderMatDetails == null || outOrderMatDetails.Count == 0)
|
||||||
{
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"出库单据{request.OrderNumber}物料已全部出库!",
|
||||||
|
Data = null
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
//按货架分组 按物料找到对应的货架
|
||||||
|
var shelfIds = outOrderMatDetails.Select(t => t.StoreInfo.ShelfId)
|
||||||
|
.Distinct()
|
||||||
|
.ToList();
|
||||||
|
var shelfs = ShelfManager.Shelves.Where(t => shelfIds.Contains(t.ShelfId)).ToList(); ;
|
||||||
|
|
||||||
//对应的货架进入出库模式 亮灯
|
var outherModeShelfs = shelfs.Where(t => t.CurentMode != HardWare.Mode.待机模式).Select(t => t.ShelfCode).ToList();
|
||||||
|
if (outherModeShelfs != null && outherModeShelfs.Count > 0)
|
||||||
{
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"进入出库模式失败:货架{string.Join("", outherModeShelfs)}不在待机模式",
|
||||||
|
Data = null
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
//对应的货架对应位置 进入出库模式 亮灯
|
||||||
|
shelfs.ForEach(shelf =>
|
||||||
|
{
|
||||||
|
var matDetails = outOrderMatDetails.Where(t => t.StoreInfo.ShelfCode == shelf.ShelfCode)
|
||||||
|
.Distinct()
|
||||||
|
.ToList();
|
||||||
|
shelf.GoInOutstore(matDetails,order);
|
||||||
|
});
|
||||||
|
|
||||||
//返回
|
//返回
|
||||||
return new ResponseCommon()
|
return new ResponseCommon()
|
||||||
@ -333,17 +440,188 @@ namespace WCS.BLL.Services.Service
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ResponseBase CaculateOutOrderMatDetails(OutOrder order)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DbHelp.db.BeginTran();
|
||||||
|
|
||||||
|
////第一步 删除、解锁 放在上一次结束入库时操作
|
||||||
|
//var outOrderMatDetails = DbHelp.db.Queryable<OutOrderMatDetail>()
|
||||||
|
// .Where(t => t.OrderId == order.Id)
|
||||||
|
// .ToList();
|
||||||
|
//var inventoryIds = outOrderMatDetails.Select(t => t.Id).ToList();
|
||||||
|
//var inventoryDetails = DbHelp.db.Queryable<InventoryDetail>()
|
||||||
|
// .Where(t => inventoryIds.Contains(t.Id))
|
||||||
|
// .ToList();
|
||||||
|
//inventoryDetails.ForEach(t => { t.IsLocked = false; });
|
||||||
|
//DbHelp.db.Deleteable(outOrderMatDetails).ExecuteCommand();
|
||||||
|
//DbHelp.db.Updateable(inventoryDetails).ExecuteCommand();
|
||||||
|
|
||||||
|
//第一步 找到需求物料
|
||||||
|
var outOrderDetails = DbHelp.db.Queryable<OutOrderDetail>()
|
||||||
|
.Where(t => t.OrderId == order.Id)
|
||||||
|
.ToList();
|
||||||
|
if (outOrderDetails == null || outOrderDetails.Count == 0)
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"计算物料失败,{order.OrderNumber}没有单据明细!"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
//第二步 开始计算物料
|
||||||
|
List<OutOrderMatDetail> outOrderMatDetails = new List<OutOrderMatDetail>();
|
||||||
|
foreach (var outOrderDetail in outOrderDetails)
|
||||||
|
{
|
||||||
|
//2.1筛选 满足 图号 批次的库存
|
||||||
|
var matInventoryDetails = DbHelp.db.Queryable<InventoryDetail>()
|
||||||
|
.Where(t => t.MatCode == outOrderDetail.MatCode)
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(outOrderDetail.MatBatch), t => t.MatBatch == outOrderDetail.MatBatch)
|
||||||
|
.OrderBy(t => t.MatBatch)//先进先出
|
||||||
|
.OrderBy(t => t.MatQty)//零散料先出
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
//2.2按照搜索出来的库存和当前未出的数量 计算需要出的SN
|
||||||
|
for (int i = 0; i < matInventoryDetails.Count && outOrderDetail.ReqQty - outOrderDetail.OutQty > 0; i++)
|
||||||
|
{
|
||||||
|
if (outOrderDetail.ReqQty - outOrderDetail.OutQty <= matInventoryDetails[i].MatQty)
|
||||||
|
{
|
||||||
|
outOrderMatDetails.Add(new OutOrderMatDetail()
|
||||||
|
{
|
||||||
|
OrderId = outOrderDetail.Id,
|
||||||
|
OrderNumber = outOrderDetail.OrderNumber,
|
||||||
|
OutOrderDetailId = outOrderDetail.Id,
|
||||||
|
InventoryDetailId = matInventoryDetails[i].Id,
|
||||||
|
StoreId = matInventoryDetails[i].StoreId,
|
||||||
|
StoreCode = matInventoryDetails[i].StoreCode,
|
||||||
|
MatSN = matInventoryDetails[i].MatSN,
|
||||||
|
MatCode = matInventoryDetails[i].MatCode,
|
||||||
|
MatName = matInventoryDetails[i].MatName,
|
||||||
|
MatSpec = matInventoryDetails[i].MatSpec,
|
||||||
|
MatBatch = matInventoryDetails[i].MatBatch,
|
||||||
|
MatQty = matInventoryDetails[i].MatQty,
|
||||||
|
MatSupplier = matInventoryDetails[i].MatSupplier,
|
||||||
|
MatCustomer = matInventoryDetails[i].MatCustomer,
|
||||||
|
IsSended = false,
|
||||||
|
CreateUser = "待定",
|
||||||
|
});
|
||||||
|
outOrderDetail.ReqQty = 0;
|
||||||
|
|
||||||
|
matInventoryDetails[i].IsLocked = true;
|
||||||
|
DbHelp.db.Updateable(matInventoryDetails[i]).ExecuteCommand();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
outOrderDetail.ReqQty = outOrderDetail.ReqQty - matInventoryDetails[i].MatQty;
|
||||||
|
|
||||||
|
outOrderMatDetails.Add(new OutOrderMatDetail()
|
||||||
|
{
|
||||||
|
OrderId = outOrderDetail.Id,
|
||||||
|
OrderNumber = outOrderDetail.OrderNumber,
|
||||||
|
OutOrderDetailId = outOrderDetail.Id,
|
||||||
|
InventoryDetailId = matInventoryDetails[i].Id,
|
||||||
|
StoreId = matInventoryDetails[i].StoreId,
|
||||||
|
StoreCode = matInventoryDetails[i].StoreCode,
|
||||||
|
MatSN = matInventoryDetails[i].MatSN,
|
||||||
|
MatCode = matInventoryDetails[i].MatCode,
|
||||||
|
MatName = matInventoryDetails[i].MatName,
|
||||||
|
MatSpec = matInventoryDetails[i].MatSpec,
|
||||||
|
MatBatch = matInventoryDetails[i].MatBatch,
|
||||||
|
MatQty = matInventoryDetails[i].MatQty,
|
||||||
|
MatSupplier = matInventoryDetails[i].MatSupplier,
|
||||||
|
MatCustomer = matInventoryDetails[i].MatCustomer,
|
||||||
|
IsSended = false,
|
||||||
|
CreateUser = "待定",
|
||||||
|
});
|
||||||
|
|
||||||
|
matInventoryDetails[i].IsLocked = true;
|
||||||
|
DbHelp.db.Updateable(matInventoryDetails[i]).ExecuteCommand();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DbHelp.db.Insertable(outOrderMatDetails).ExecuteCommand();
|
||||||
|
DbHelp.db.CommitTran();
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 200,
|
||||||
|
Message = $"Success"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
DbHelp.db.RollbackTran();
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 300,
|
||||||
|
Message = $"发生异常:{ex.Message}"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ResponseBase CancelOutOrderMatDetails(OutOrder order)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DbHelp.db.BeginTran();
|
||||||
|
var outOrderMatDetails = DbHelp.db.Queryable<OutOrderMatDetail>()
|
||||||
|
.Where(t => t.OrderId == order.Id)
|
||||||
|
.ToList();
|
||||||
|
var inventoryIds = outOrderMatDetails.Select(t => t.Id).ToList();
|
||||||
|
var inventoryDetails = DbHelp.db.Queryable<InventoryDetail>()
|
||||||
|
.Where(t => inventoryIds.Contains(t.Id))
|
||||||
|
.ToList();
|
||||||
|
inventoryDetails.ForEach(t => { t.IsLocked = false; });
|
||||||
|
DbHelp.db.Deleteable(outOrderMatDetails).ExecuteCommand();
|
||||||
|
DbHelp.db.Updateable(inventoryDetails).ExecuteCommand();
|
||||||
|
DbHelp.db.CommitTran();
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 200,
|
||||||
|
Message = $"Success"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
DbHelp.db.RollbackTran();
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 300,
|
||||||
|
Message = $"发生异常:{ex.Message}"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<ResponseBase> GoOutOutstore(GetOutOrderDetailRequest request)
|
public async Task<ResponseBase> GoOutOutstore(GetOutOrderDetailRequest request)
|
||||||
{
|
{
|
||||||
|
//获取出库单
|
||||||
|
var order = await DbHelp.db.Queryable<OutOrder>()
|
||||||
|
.WhereIF(request.OrderId != 0, t => t.Id == request.OrderId)
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(request.OrderNumber), t => t.OrderNumber == request.OrderNumber)
|
||||||
|
.FirstAsync();
|
||||||
|
if (order == null)
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"不存在对应的出库单据{request.OrderNumber}!",
|
||||||
|
Data = null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
//找到正在出对应出库单的货架
|
//找到正在出对应出库单的货架
|
||||||
var shelves = ShelfManager.Shelves.Where(t => t.OrderNumber == request.OrderNumber)
|
var shelves = ShelfManager.Shelves.Where(t => t.OrderNumber == request.OrderNumber)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
//退出出库模式
|
//退出出库模式
|
||||||
shelves.ForEach(t =>
|
shelves.ForEach(t =>
|
||||||
{
|
{
|
||||||
t.GoOutOutstore();
|
t.GoOutOutstore();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//解锁物料 删除物料明细
|
||||||
|
CancelOutOrderMatDetails(order);
|
||||||
|
|
||||||
return new ResponseCommon()
|
return new ResponseCommon()
|
||||||
{
|
{
|
||||||
Code = 200,
|
Code = 200,
|
||||||
|
@ -236,5 +236,43 @@ namespace WCS.BLL.Services.Service
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Task<PageQueryResponse<ShelfInfo>> IStoreInfoService.GetShelves(GetShelvesRequest request)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
Task<ResponseCommon<object>> IStoreInfoService.addOrUpdateShelfInfo(AddShelfInfoRequest<ShelfInfo> request)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
async Task<ResponseCommon<object>> IStoreInfoService.GenerateStoreInfo()
|
||||||
|
{
|
||||||
|
var shelfInfo = await DbHelp.db.Queryable<ShelfInfo>().Where(t => t.ShelfCode == "C04-1").FirstAsync();
|
||||||
|
var ModuleInfos = await DbHelp.db.Queryable<ModuleInfo>().Where(t => t.ShelfId == shelfInfo.Id).ToListAsync();
|
||||||
|
ModuleInfos.ForEach(moduleInfo =>
|
||||||
|
{
|
||||||
|
for (int i = 1; i <= moduleInfo.LightCount; i++)
|
||||||
|
{
|
||||||
|
var storeInfo = new StoreInfo()
|
||||||
|
{
|
||||||
|
StoreCode = moduleInfo.ModuleCode + "-" + i.ToString(),
|
||||||
|
ModuleId = moduleInfo.Id,
|
||||||
|
ModuleCode = moduleInfo.ModuleCode,
|
||||||
|
ShelfId = shelfInfo.Id,
|
||||||
|
ShelfCode = shelfInfo.ShelfCode,
|
||||||
|
BoardId = moduleInfo.BoardId,
|
||||||
|
LightNumber = i,
|
||||||
|
Priority = 1,
|
||||||
|
CurrentMatSn = string.Empty,
|
||||||
|
};
|
||||||
|
DbHelp.db.Insertable(storeInfo).ExecuteCommand();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return new ResponseCommon<object>() { Message = "111"};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ namespace WCS.BLL
|
|||||||
//载入配置
|
//载入配置
|
||||||
tcpClient.Setup(new TouchSocketConfig()
|
tcpClient.Setup(new TouchSocketConfig()
|
||||||
.SetRemoteIPHost(RemoteIPHost)
|
.SetRemoteIPHost(RemoteIPHost)
|
||||||
.SetBindIPHost(BindIPHost)
|
//.SetBindIPHost(BindIPHost)
|
||||||
.ConfigurePlugins(a =>
|
.ConfigurePlugins(a =>
|
||||||
{
|
{
|
||||||
//配置断线重连
|
//配置断线重连
|
||||||
@ -156,24 +156,35 @@ namespace WCS.BLL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ReConnectAsync()
|
||||||
|
{
|
||||||
|
tcpClient.TryConnectAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void Send(byte[] message)
|
public void Send(byte[] message)
|
||||||
{
|
{
|
||||||
var boardId = (message[3] << 8) + message[4];
|
try
|
||||||
//记录发送指令 用于通信校验 同Id只校验最后一个指令
|
|
||||||
////MessageList.AddOrUpdate(boardId, new MessageDto()
|
|
||||||
////{
|
|
||||||
//// ID = boardId,
|
|
||||||
//// Message = message,
|
|
||||||
////}, (key, oldValue) => oldValue = new MessageDto()
|
|
||||||
////{
|
|
||||||
//// ID = boardId,
|
|
||||||
//// Message = message,
|
|
||||||
////});
|
|
||||||
lock (sendLockObject)
|
|
||||||
{
|
{
|
||||||
tcpClient.Send(message);
|
var boardId = (message[3] << 8) + message[4];
|
||||||
//发送自带10ms间隔
|
lock (sendLockObject)
|
||||||
Thread.Sleep(10);
|
{
|
||||||
|
tcpClient.Send(message);
|
||||||
|
//发送自带10ms间隔
|
||||||
|
Thread.Sleep(10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
//因异常断连时(网线已经被断了) 尝试重连一次
|
||||||
|
if (ex is NotConnectedException)
|
||||||
|
{
|
||||||
|
Task.Run(() =>
|
||||||
|
{
|
||||||
|
ReConnectAsync();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
throw ex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="TouchSocket" Version="2.0.0" />
|
<PackageReference Include="TouchSocket" Version="2.0.3" />
|
||||||
|
<PackageReference Include="TouchSocket.Http" Version="2.0.3" />
|
||||||
<PackageReference Include="XLParser" Version="1.7.2" />
|
<PackageReference Include="XLParser" Version="1.7.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace WCS.Model
|
namespace WCS.Model
|
||||||
{
|
{
|
||||||
public class GetOutOrderDetailRequest : ResponseBase
|
public class GetOutOrderDetailRequest : RequestBase
|
||||||
{
|
{
|
||||||
public int OrderId { get; set; }
|
public int OrderId { get; set; }
|
||||||
public string OrderNumber { get; set; }
|
public string OrderNumber { get; set; }
|
||||||
|
@ -10,10 +10,8 @@ namespace WCS.Model
|
|||||||
{
|
{
|
||||||
public string OrderNumber { get; set; }
|
public string OrderNumber { get; set; }
|
||||||
|
|
||||||
public int OrderStatus { get; set; }
|
public string OrderSource { get; set; }
|
||||||
|
|
||||||
//public int PageNumber { get; set; }
|
public string OrderType { get; set; }
|
||||||
|
|
||||||
//public int PageSize { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
31
WCS.Model/ApiModel/OutStore/OutOrderDetailModel.cs
Normal file
31
WCS.Model/ApiModel/OutStore/OutOrderDetailModel.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace WCS.Model.ApiModel.OutStore
|
||||||
|
{
|
||||||
|
public class OutOrderDetailModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public int OrderId { get; set; }
|
||||||
|
|
||||||
|
public string OrderNumber { get; set; }
|
||||||
|
|
||||||
|
public string MatCode { get; set; }
|
||||||
|
|
||||||
|
public string MatName { get; set; }
|
||||||
|
|
||||||
|
public string MatBatch { get; set; }
|
||||||
|
|
||||||
|
public int ReqQty { get; set; }
|
||||||
|
|
||||||
|
public int OutQty { get; set; }
|
||||||
|
|
||||||
|
public DateTime CreateTime { get; set; }
|
||||||
|
|
||||||
|
public string CreateUser { get; set; }
|
||||||
|
|
||||||
|
public int RowNumber { get; set; }
|
||||||
|
}
|
||||||
|
}
|
51
WCS.Model/ApiModel/OutStore/OutOrderMatDetailModel.cs
Normal file
51
WCS.Model/ApiModel/OutStore/OutOrderMatDetailModel.cs
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace WCS.Model.ApiModel.OutStore
|
||||||
|
{
|
||||||
|
public class OutOrderMatDetailModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public int OrderId { get; set; }
|
||||||
|
|
||||||
|
public string OrderNumber { get; set; }
|
||||||
|
|
||||||
|
public int OutOrderDetailId { get; set; }
|
||||||
|
|
||||||
|
public int InventoryDetailId { get; set; }
|
||||||
|
|
||||||
|
#region 库位属性
|
||||||
|
public int StoreId { get; set; }
|
||||||
|
|
||||||
|
public string StoreCode { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 物料属性
|
||||||
|
public string MatSN { get; set; }
|
||||||
|
public string MatCode { get; set; }
|
||||||
|
public string MatName { get; set; }
|
||||||
|
|
||||||
|
public string MatSpec { get; set; }
|
||||||
|
|
||||||
|
public string MatBatch { get; set; }
|
||||||
|
|
||||||
|
public int MatQty { get; set; }
|
||||||
|
|
||||||
|
public string? MatSupplier { get; set; }
|
||||||
|
|
||||||
|
public string? MatCustomer { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public bool IsSended { get; set; } = false;
|
||||||
|
|
||||||
|
public DateTime CreateTime { get; set; }
|
||||||
|
|
||||||
|
public string CreateUser { get; set; }
|
||||||
|
|
||||||
|
public int RowNumber { get; set; }
|
||||||
|
}
|
||||||
|
}
|
65
WCS.Model/ApiModel/OutStore/OutOrderModel.cs
Normal file
65
WCS.Model/ApiModel/OutStore/OutOrderModel.cs
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace WCS.Model.ApiModel.OutStore
|
||||||
|
{
|
||||||
|
public class OutOrderModel : INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string OrderNumber { get; set; }
|
||||||
|
public OutOrderStatus OrderStatus { get; set; }
|
||||||
|
|
||||||
|
public OutOrderExeStatus OutOrderExeStatus { get; set; }
|
||||||
|
|
||||||
|
public string OrderSource { get; set; }
|
||||||
|
|
||||||
|
public string OrderType { get; set; }
|
||||||
|
|
||||||
|
public SyncTypeEnum SyncType { get; set; }
|
||||||
|
|
||||||
|
public DateTime CreateTime { get; set; }
|
||||||
|
|
||||||
|
public string CreateUser { get; set; }
|
||||||
|
public bool IsSelected
|
||||||
|
{
|
||||||
|
get { return isSelected; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
isSelected = value;
|
||||||
|
OnPropertyChanged(nameof(IsSelected));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool isSelected;
|
||||||
|
public int RowNumber { get; set; }
|
||||||
|
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
protected virtual void OnPropertyChanged(string propertyName)
|
||||||
|
{
|
||||||
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum OutOrderStatus
|
||||||
|
{
|
||||||
|
未发料 = 0,
|
||||||
|
部分发料 = 1,
|
||||||
|
全部发料 = 2
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum OutOrderExeStatus
|
||||||
|
{
|
||||||
|
待发料 = 0,
|
||||||
|
开始发料 = 1,
|
||||||
|
暂停发料 = 2,
|
||||||
|
发料完成 = 3
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum SyncTypeEnum
|
||||||
|
{
|
||||||
|
ByMatCode = 0,
|
||||||
|
ByMatSn = 1
|
||||||
|
}
|
||||||
|
}
|
@ -23,6 +23,7 @@ namespace WCS.Model
|
|||||||
public class MatCodeItemList
|
public class MatCodeItemList
|
||||||
{
|
{
|
||||||
public string MatCode { get; set; }
|
public string MatCode { get; set; }
|
||||||
|
public string MatName { get; set; }
|
||||||
public string MatBatch { get; set; }
|
public string MatBatch { get; set; }
|
||||||
public int ReqQty { get; set; }
|
public int ReqQty { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -113,6 +113,30 @@ namespace WebApi.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <20><>ȡ<EFBFBD><C8A1><EFBFBD>ⵥ<EFBFBD><E2B5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[Route("getOutOrderMatDetail")]
|
||||||
|
[HttpPost(Name = "getOutOrderMatDetail")]
|
||||||
|
public async Task<ResponseBase> getOutOrderMatDetail(GetOutOrderDetailRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _outstoreService.GetOutOrderMatDetail(request);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return new ResponseBase()
|
||||||
|
{
|
||||||
|
Code = 300,
|
||||||
|
Message = "<22><>ѯʧ<D1AF>ܣ<EFBFBD>" + ex.Message,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD>ⵥ<EFBFBD>ݺſ<DDBA>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
/// ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD>ⵥ<EFBFBD>ݺſ<DDBA>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -147,7 +171,7 @@ namespace WebApi.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return await _outstoreService.GetOutOrderDetail(request);
|
return await _outstoreService.GoOutOutstore(request);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -35,5 +35,11 @@ namespace WCS.WebApi.Controllers
|
|||||||
{
|
{
|
||||||
return await _storeInfoService.addOrUpdateShelfInfo(request);
|
return await _storeInfoService.addOrUpdateShelfInfo(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost("GenerateStoreInfo")]
|
||||||
|
public async Task<ResponseCommon<object>> GenerateStoreInfo()
|
||||||
|
{
|
||||||
|
return await _storeInfoService.GenerateStoreInfo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ namespace WebApi
|
|||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
WebSoceketManager.InitWebSocket();
|
||||||
//LocalStatic.wCSTcpCleint = new WCS.BLL.TCPClient("127.0.0.1:20002");
|
//LocalStatic.wCSTcpCleint = new WCS.BLL.TCPClient("127.0.0.1:20002");
|
||||||
//LocalStatic.wCSTcpCleint.Send(new byte[] { 0x08, 0x00, 0x00, 0x11, 0x12, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 });
|
//LocalStatic.wCSTcpCleint.Send(new byte[] { 0x08, 0x00, 0x00, 0x11, 0x12, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 });
|
||||||
|
|
||||||
@ -28,7 +28,9 @@ namespace WebApi
|
|||||||
|
|
||||||
TCPClientManager.InitTcpClient();
|
TCPClientManager.InitTcpClient();
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
|
||||||
|
|
||||||
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
//// <20><><EFBFBD><EFBFBD>Kestrel
|
//// <20><><EFBFBD><EFBFBD>Kestrel
|
||||||
//builder.WebHost.ConfigureKestrel((context, options) =>
|
//builder.WebHost.ConfigureKestrel((context, options) =>
|
||||||
//{
|
//{
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
<PackageReference Include="MiniExcel" Version="1.31.3" />
|
<PackageReference Include="MiniExcel" Version="1.31.3" />
|
||||||
<PackageReference Include="NPOI" Version="2.7.0" />
|
<PackageReference Include="NPOI" Version="2.7.0" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||||
<PackageReference Include="TouchSocket" Version="2.0.0" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -10,6 +10,9 @@ EndProject
|
|||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WCS.BLL", "..\WCS.BLL\WCS.BLL.csproj", "{A6B0DB70-BE92-487C-BA6B-56441B676C85}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WCS.BLL", "..\WCS.BLL\WCS.BLL.csproj", "{A6B0DB70-BE92-487C-BA6B-56441B676C85}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "货架标准上位机", "..\货架标准上位机\货架标准上位机.csproj", "{A24FAA0F-8483-4741-BFE7-EC2C56C811A6}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "货架标准上位机", "..\货架标准上位机\货架标准上位机.csproj", "{A24FAA0F-8483-4741-BFE7-EC2C56C811A6}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{118D453B-1693-4C00-8378-20ECBFCF2700} = {118D453B-1693-4C00-8378-20ECBFCF2700}
|
||||||
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WCS.Model", "..\WCS.Model\WCS.Model.csproj", "{7CE9AF07-3538-46C3-BBF0-A039BDE15AAF}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WCS.Model", "..\WCS.Model\WCS.Model.csproj", "{7CE9AF07-3538-46C3-BBF0-A039BDE15AAF}"
|
||||||
EndProject
|
EndProject
|
||||||
|
@ -140,6 +140,7 @@ namespace 货架标准上位机.ViewModel
|
|||||||
{
|
{
|
||||||
scanner.ShelfCode = string.Empty;
|
scanner.ShelfCode = string.Empty;
|
||||||
scanner.ModulesStr = string.Empty;
|
scanner.ModulesStr = string.Empty;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -201,7 +202,7 @@ namespace 货架标准上位机.ViewModel
|
|||||||
{
|
{
|
||||||
scanner.MatSn = Result.Data.MatSN;
|
scanner.MatSn = Result.Data.MatSN;
|
||||||
}
|
}
|
||||||
else if(Result != null && !string.IsNullOrEmpty(Result.Message))
|
else if (Result != null && !string.IsNullOrEmpty(Result.Message))
|
||||||
{
|
{
|
||||||
Growl.Warning(Result.Message);
|
Growl.Warning(Result.Message);
|
||||||
}
|
}
|
||||||
@ -237,6 +238,7 @@ namespace 货架标准上位机.ViewModel
|
|||||||
t.MatSn = string.Empty;
|
t.MatSn = string.Empty;
|
||||||
|
|
||||||
t.ScannerDisplayControl.RefreshValues(t.ShelfCode, t.MatSn);
|
t.ScannerDisplayControl.RefreshValues(t.ShelfCode, t.MatSn);
|
||||||
|
Growl.Success(Result.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -11,6 +11,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Controls.Primitives;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Markup;
|
using System.Windows.Markup;
|
||||||
|
|
||||||
@ -25,6 +26,18 @@ namespace 货架标准上位机.ViewModel
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Title { get => title; set { SetProperty(ref title, value); } }
|
public string Title { get => title; set { SetProperty(ref title, value); } }
|
||||||
|
|
||||||
|
|
||||||
|
private bool goToOutVentoryView;
|
||||||
|
public bool GoToOutVentoryView
|
||||||
|
{
|
||||||
|
get { return goToOutVentoryView; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref goToOutVentoryView, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#region 专用_MainWindow2
|
#region 专用_MainWindow2
|
||||||
//隐藏式选项卡的高度
|
//隐藏式选项卡的高度
|
||||||
public double TabItemHeight { get; set; } = 0;
|
public double TabItemHeight { get; set; } = 0;
|
||||||
@ -72,6 +85,10 @@ namespace 货架标准上位机.ViewModel
|
|||||||
{
|
{
|
||||||
ScannerManager.InitScanners();
|
ScannerManager.InitScanners();
|
||||||
}),
|
}),
|
||||||
|
new Tuple<string, string, Action>("初始化WebSocket连接..", "初始化WebSocket连接失败,请联系管理员", () =>
|
||||||
|
{
|
||||||
|
WebSocket.InitWebSocket();
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
MainLoadWindow.TaskSleepTime = 200;
|
MainLoadWindow.TaskSleepTime = 200;
|
||||||
@ -88,7 +105,7 @@ namespace 货架标准上位机.ViewModel
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
////不登录,直接使用最高权限
|
//不登录,直接使用最高权限
|
||||||
//{
|
//{
|
||||||
// UserLoginView.NotLogin();
|
// UserLoginView.NotLogin();
|
||||||
// return true;
|
// return true;
|
||||||
|
@ -124,7 +124,6 @@ namespace 货架标准上位机.ViewModel
|
|||||||
CurrentPage = 1;
|
CurrentPage = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 调用接口获取数据
|
#region 调用接口获取数据
|
||||||
//var dia = Dialog.Show(new TextDialog());
|
//var dia = Dialog.Show(new TextDialog());
|
||||||
try
|
try
|
||||||
@ -159,8 +158,6 @@ namespace 货架标准上位机.ViewModel
|
|||||||
//dia.Close();
|
//dia.Close();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -116,8 +116,9 @@ namespace 货架标准上位机.ViewModels
|
|||||||
ItemList = DataGridItemSource.Select(t => new MatCodeItemList()
|
ItemList = DataGridItemSource.Select(t => new MatCodeItemList()
|
||||||
{
|
{
|
||||||
MatCode = t.MatCode,
|
MatCode = t.MatCode,
|
||||||
|
MatName = t.MatName,
|
||||||
MatBatch = t.MatBatch,
|
MatBatch = t.MatBatch,
|
||||||
ReqQty = t.NeedQty
|
ReqQty = t.NeedQty,
|
||||||
}).ToList(),
|
}).ToList(),
|
||||||
DeviceType = LocalFile.Config.DeviceType,
|
DeviceType = LocalFile.Config.DeviceType,
|
||||||
UserName = LocalStatic.CurrentUser
|
UserName = LocalStatic.CurrentUser
|
||||||
|
378
货架标准上位机/ViewModels/OutInventoryDocumentViewModel.cs
Normal file
378
货架标准上位机/ViewModels/OutInventoryDocumentViewModel.cs
Normal file
@ -0,0 +1,378 @@
|
|||||||
|
using HandyControl.Controls;
|
||||||
|
using Ping9719.WpfEx.Mvvm;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using WCS.Model;
|
||||||
|
using WCS.Model.ApiModel.MatBaseInfo;
|
||||||
|
using WCS.Model.ApiModel.OutStore;
|
||||||
|
using 货架标准上位机.Api;
|
||||||
|
|
||||||
|
namespace 货架标准上位机.ViewModels
|
||||||
|
{
|
||||||
|
public class OutInventoryDocumentViewModel : BindableBase
|
||||||
|
{
|
||||||
|
public OutInventoryDocumentViewModel()
|
||||||
|
{
|
||||||
|
BtnSearch();
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Properties界面绑定的实体
|
||||||
|
private ObservableCollection<OutOrderModel> dataGridItemSource;
|
||||||
|
public ObservableCollection<OutOrderModel> DataGridItemSource
|
||||||
|
{
|
||||||
|
get { return dataGridItemSource; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref dataGridItemSource, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public OutOrderModel selectedataGridItem;
|
||||||
|
public OutOrderModel SelectedataGridItem
|
||||||
|
{
|
||||||
|
get { return selectedataGridItem; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref selectedataGridItem, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string orderNumber;
|
||||||
|
public string OrderNumber
|
||||||
|
{
|
||||||
|
get { return orderNumber; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref orderNumber, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string orderType;
|
||||||
|
public string OrderType
|
||||||
|
{
|
||||||
|
get { return orderType; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref orderType, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string orderSource;
|
||||||
|
public string OrderSource
|
||||||
|
{
|
||||||
|
get { return orderSource; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref orderSource, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Command
|
||||||
|
public ICommand BtnSearchCommand { get => new DelegateCommand(BtnSearchReset); }
|
||||||
|
public void BtnSearchReset()
|
||||||
|
{
|
||||||
|
BtnSearch(true);
|
||||||
|
}
|
||||||
|
public void BtnSearch(bool IsPageReset = true)
|
||||||
|
{
|
||||||
|
if (CurrentPage == 0 || IsPageReset)
|
||||||
|
{
|
||||||
|
CurrentPage = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 调用接口获取数据
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var body = new GetOutOrderListRequest()
|
||||||
|
{
|
||||||
|
OrderNumber = OrderNumber,
|
||||||
|
OrderType = OrderType,
|
||||||
|
OrderSource = OrderSource,
|
||||||
|
UserName = LocalStatic.CurrentUser,
|
||||||
|
DeviceType = LocalFile.Config.DeviceType,
|
||||||
|
PageNumber = CurrentPage,
|
||||||
|
PageSize = 10,
|
||||||
|
};
|
||||||
|
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<OutOrderModel>>(LocalFile.Config.ApiIpHost + "outStore/GetOutOrderList", body, "POST");
|
||||||
|
if (Result != null && Result.Data != null && Result.Data.Lists != null)
|
||||||
|
{
|
||||||
|
DataGridItemSource = new ObservableCollection<OutOrderModel>(Result.Data.Lists);
|
||||||
|
MaxPage = Result.Data.MaxPage;
|
||||||
|
TotalCount = Result.Data.TotalCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Growl.Error("加载数据失败:" + ex.Message);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICommand BtnResetCommand { get => new DelegateCommand(BtnReset); }
|
||||||
|
public void BtnReset()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICommand BtnDeleteCommand { get => new DelegateCommand(BtnDelete); }
|
||||||
|
public void BtnDelete()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICommand BtnOrderDetailCommand { get => new DelegateCommand(BtnOrderDetail); }
|
||||||
|
public void BtnOrderDetail()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (DataGridItemSource == null)
|
||||||
|
{
|
||||||
|
Growl.Warning("未勾选数据!");
|
||||||
|
}
|
||||||
|
|
||||||
|
//判断是否勾选数据
|
||||||
|
var selectedOutOrder = DataGridItemSource.Where(t => t.IsSelected)
|
||||||
|
.FirstOrDefault();
|
||||||
|
if (selectedOutOrder == null)
|
||||||
|
{
|
||||||
|
Growl.Warning("未勾选数据!");
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 调用接口获取数据
|
||||||
|
|
||||||
|
var body = new GetOutOrderDetailRequest()
|
||||||
|
{
|
||||||
|
OrderId = selectedOutOrder.Id,
|
||||||
|
OrderNumber = selectedOutOrder.OrderNumber,
|
||||||
|
UserName = LocalStatic.CurrentUser,
|
||||||
|
DeviceType = LocalFile.Config.DeviceType,
|
||||||
|
|
||||||
|
};
|
||||||
|
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<List<OutOrderDetailModel>>>(LocalFile.Config.ApiIpHost + "outStore/getOutOrderDetail", body, "POST");
|
||||||
|
if (Result != null && Result.Code == 200)
|
||||||
|
{
|
||||||
|
if (Result.Data.Count > 0)
|
||||||
|
{
|
||||||
|
//打开窗体
|
||||||
|
var window = new OutInventoryDocumentDetailView(Result.Data);
|
||||||
|
window.Owner = Application.Current.MainWindow;
|
||||||
|
window.ShowDialog();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Growl.Warning("该单据没有单据明细!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (Result != null)
|
||||||
|
{
|
||||||
|
Growl.Warning(Result.Message);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Growl.Warning("调用接口失败!");
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Growl.Error("出现异常:" + ex.Message);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICommand BtnOrderMatDetailCommand { get => new DelegateCommand(BtnOrderMatDetail); }
|
||||||
|
public void BtnOrderMatDetail()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (DataGridItemSource == null)
|
||||||
|
{
|
||||||
|
Growl.Warning("未勾选数据!");
|
||||||
|
}
|
||||||
|
|
||||||
|
//判断是否勾选数据
|
||||||
|
var selectedOutOrder = DataGridItemSource.Where(t => t.IsSelected)
|
||||||
|
.FirstOrDefault();
|
||||||
|
if (selectedOutOrder == null)
|
||||||
|
{
|
||||||
|
Growl.Warning("未勾选数据!");
|
||||||
|
}
|
||||||
|
#region 调用接口获取数据
|
||||||
|
var body = new GetOutOrderDetailRequest()
|
||||||
|
{
|
||||||
|
OrderId = selectedOutOrder.Id,
|
||||||
|
OrderNumber = selectedOutOrder.OrderNumber,
|
||||||
|
UserName = LocalStatic.CurrentUser,
|
||||||
|
DeviceType = LocalFile.Config.DeviceType,
|
||||||
|
|
||||||
|
};
|
||||||
|
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<List<OutOrderMatDetailModel>>>(LocalFile.Config.ApiIpHost + "outStore/getOutOrderMatDetail", body, "POST");
|
||||||
|
if (Result != null && Result.Code == 200)
|
||||||
|
{
|
||||||
|
if (Result.Data.Count > 0)
|
||||||
|
{
|
||||||
|
//打开窗体
|
||||||
|
var window = new OutInventoryDocumentMatDetailView(Result.Data);
|
||||||
|
window.Owner = Application.Current.MainWindow;
|
||||||
|
window.ShowDialog();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Growl.Warning("该单据没有发料明细!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (Result != null)
|
||||||
|
{
|
||||||
|
Growl.Warning(Result.Message);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Growl.Warning("调用接口失败!");
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Growl.Error("出现异常:" + ex.Message);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//开始入库 如果成功就直接跳转出库界面
|
||||||
|
public ICommand BtnStartCommand { get => new DelegateCommand(BtnStart); }
|
||||||
|
public void BtnStart()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (DataGridItemSource == null)
|
||||||
|
{
|
||||||
|
Growl.Warning("未勾选数据!");
|
||||||
|
}
|
||||||
|
//判断是否勾选数据
|
||||||
|
var selectedOutOrder = DataGridItemSource.Where(t => t.IsSelected)
|
||||||
|
.FirstOrDefault();
|
||||||
|
if (selectedOutOrder == null)
|
||||||
|
{
|
||||||
|
Growl.Warning("未勾选数据!");
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 调用接口开始出库
|
||||||
|
var body = new GetOutOrderDetailRequest()
|
||||||
|
{
|
||||||
|
OrderId = selectedOutOrder.Id,
|
||||||
|
OrderNumber = selectedOutOrder.OrderNumber,
|
||||||
|
UserName = LocalStatic.CurrentUser,
|
||||||
|
DeviceType = LocalFile.Config.DeviceType,
|
||||||
|
};
|
||||||
|
var Result = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "outStore/goInOutstore", body, "POST");
|
||||||
|
if (Result != null && Result.Code == 200)
|
||||||
|
{
|
||||||
|
//成功后直接跳转
|
||||||
|
MainWindow1.viewModel.GoToOutVentoryView = true;
|
||||||
|
Growl.Success("已跳转到物料出库页面!");
|
||||||
|
}
|
||||||
|
else if (Result != null)
|
||||||
|
{
|
||||||
|
Growl.Warning(Result.Message);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Growl.Warning("调用接口失败!");
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Growl.Error("出现异常:" + ex.Message);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICommand BtnPauseCommand { get => new DelegateCommand(BtnPause); }
|
||||||
|
public void BtnPause()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region PageOperation 分页操作
|
||||||
|
private int currentPage;
|
||||||
|
public int CurrentPage
|
||||||
|
{
|
||||||
|
get { return currentPage; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref currentPage, value);
|
||||||
|
BtnSearch(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int maxPage;
|
||||||
|
public int MaxPage
|
||||||
|
{
|
||||||
|
get { return maxPage; }
|
||||||
|
set { SetProperty(ref maxPage, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
//总数量
|
||||||
|
private int totalCount;
|
||||||
|
public int TotalCount
|
||||||
|
{
|
||||||
|
get { return totalCount; }
|
||||||
|
set { SetProperty(ref totalCount, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); }
|
||||||
|
public void BtnFirstPage()
|
||||||
|
{
|
||||||
|
CurrentPage = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICommand BtnPrePageCommand { get => new DelegateCommand(BtnPrePage); }
|
||||||
|
public void BtnPrePage()
|
||||||
|
{
|
||||||
|
if (CurrentPage > 1)
|
||||||
|
{
|
||||||
|
CurrentPage--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICommand BtnNextPageCommand { get => new DelegateCommand(BtnNextPage); }
|
||||||
|
public void BtnNextPage()
|
||||||
|
{
|
||||||
|
if (CurrentPage < MaxPage)
|
||||||
|
{
|
||||||
|
CurrentPage++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICommand BtnLastPageCommand { get => new DelegateCommand(BtnLastPage); }
|
||||||
|
public void BtnLastPage()
|
||||||
|
{
|
||||||
|
if (CurrentPage != MaxPage)
|
||||||
|
{
|
||||||
|
CurrentPage = MaxPage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
@ -39,7 +39,7 @@
|
|||||||
<GroupBox.Header>
|
<GroupBox.Header>
|
||||||
<Grid Width="{Binding ActualWidth,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type GroupBox}}}">
|
<Grid Width="{Binding ActualWidth,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type GroupBox}}}">
|
||||||
<TextBlock Margin="5,0" HorizontalAlignment="Left" VerticalAlignment="Center">报警</TextBlock>
|
<TextBlock Margin="5,0" HorizontalAlignment="Left" VerticalAlignment="Center">报警</TextBlock>
|
||||||
<Button HorizontalAlignment="Right" Height="25" Margin="10,0" Padding="10,0" FontFamily="{StaticResource IconFont}" Command="{Binding ClearTextErrCommand}"> 清除</Button>
|
<Button HorizontalAlignment="Right" Height="25" Margin="10,0" Padding="10,0" FontFamily="{StaticResource IconFont}" Command="{Binding ClearTextErrCommand}"> 清除</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
</GroupBox.Header>
|
</GroupBox.Header>
|
||||||
<TextBox Style="{StaticResource TextBoxExtend.Multi}" IsReadOnly="True" Margin="-1" Text="{Binding TextErr}" Foreground="Tomato" hc:InfoElement.Placeholder="没有报警信息"></TextBox>
|
<TextBox Style="{StaticResource TextBoxExtend.Multi}" IsReadOnly="True" Margin="-1" Text="{Binding TextErr}" Foreground="Tomato" hc:InfoElement.Placeholder="没有报警信息"></TextBox>
|
||||||
@ -49,10 +49,10 @@
|
|||||||
<GroupBox.Header>
|
<GroupBox.Header>
|
||||||
<Grid Width="{Binding ActualWidth,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type GroupBox}}}">
|
<Grid Width="{Binding ActualWidth,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type GroupBox}}}">
|
||||||
<TextBlock Margin="5,0" HorizontalAlignment="Left" VerticalAlignment="Center">日志</TextBlock>
|
<TextBlock Margin="5,0" HorizontalAlignment="Left" VerticalAlignment="Center">日志</TextBlock>
|
||||||
<Button HorizontalAlignment="Right" Height="25" Margin="10,0" Padding="10,0" FontFamily="{StaticResource IconFont}" Command="{Binding ClearTextInfoCommand}"> 清空</Button>
|
<Button HorizontalAlignment="Right" Height="25" Margin="10,0" Padding="10,0" FontFamily="{StaticResource IconFont}" Command="{Binding ClearTextInfoCommand}"> 清空</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
</GroupBox.Header>
|
</GroupBox.Header>
|
||||||
<pi:TextBoxLog Style="{StaticResource TextBoxExtend.Multi}" Margin="-1" hc:InfoElement.Placeholder="没有日志信息" Foreground="CornflowerBlue"></pi:TextBoxLog>
|
<pi:TextBoxLog Token="123" Style="{StaticResource TextBoxExtend.Multi}" Margin="-1" hc:InfoElement.Placeholder="没有日志信息" Foreground="CornflowerBlue"></pi:TextBoxLog>
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
@ -13,7 +13,8 @@
|
|||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="*"></RowDefinition>
|
<RowDefinition Height="*"></RowDefinition>
|
||||||
<RowDefinition Height="10*"></RowDefinition>
|
<RowDefinition Height="5*"></RowDefinition>
|
||||||
|
<RowDefinition Height="5*"></RowDefinition>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<Border Grid.Row="0" Margin="0" Background="AliceBlue" CornerRadius="0" Padding="0" MouseUp="Border_MouseUp">
|
<Border Grid.Row="0" Margin="0" Background="AliceBlue" CornerRadius="0" Padding="0" MouseUp="Border_MouseUp">
|
||||||
@ -26,113 +27,51 @@
|
|||||||
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
|
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
|
<StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||||
<Button Style="{StaticResource ButtonDanger}" Margin="10" hc:BorderElement.CornerRadius="15"
|
<Button
|
||||||
MinHeight="40" FontSize="20" Content="结束入库" FontFamily="{StaticResource IconFont}"
|
Style="{StaticResource ButtonDanger}"
|
||||||
|
Margin="10"
|
||||||
|
PreviewKeyDown="Button_PreviewKeyDown"
|
||||||
|
hc:BorderElement.CornerRadius="15"
|
||||||
|
MinHeight="40"
|
||||||
|
FontSize="20"
|
||||||
|
Content="结束入库"
|
||||||
|
FontFamily="{StaticResource IconFont}"
|
||||||
Command="{Binding BtnEndCommand}">
|
Command="{Binding BtnEndCommand}">
|
||||||
</Button>
|
</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<Border Grid.Row="1" Margin="1" Background="AliceBlue" Padding="0">
|
<Border Grid.Row="1" Margin="5,5,5,5" BorderThickness="1" Background="White" BorderBrush="DodgerBlue" CornerRadius="3">
|
||||||
<WrapPanel Name="scannersWrapPanel">
|
<WrapPanel Name="scannersWrapPanel">
|
||||||
|
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
<!--<Grid>
|
</Border>
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="8*"></RowDefinition>
|
|
||||||
<RowDefinition Height="8*"></RowDefinition>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid Grid.Row="0">
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="*"></RowDefinition>
|
|
||||||
<RowDefinition Height="*"></RowDefinition>
|
|
||||||
<RowDefinition Height="*"></RowDefinition>
|
|
||||||
<RowDefinition Height="*"></RowDefinition>
|
|
||||||
<RowDefinition Height="*"></RowDefinition>
|
|
||||||
<RowDefinition Height="*"></RowDefinition>
|
|
||||||
<RowDefinition Height="1.2*"></RowDefinition>
|
|
||||||
<RowDefinition Height="1.2*"></RowDefinition>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
|
||||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
|
||||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
|
||||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<TextBlock Grid.Row="0" Grid.Column="0"
|
|
||||||
Text="最小包装条码:" FontSize="20"
|
|
||||||
VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
|
|
||||||
<TextBlock Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="3"
|
|
||||||
Text="{Binding MatSN}" FontSize="20"
|
|
||||||
VerticalAlignment="Center" HorizontalAlignment="Left"
|
|
||||||
></TextBlock>
|
|
||||||
<TextBlock Grid.Row="1" Grid.Column="0"
|
|
||||||
Text="物料编码:" FontSize="20"
|
|
||||||
VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
|
|
||||||
<TextBlock Grid.Row="1" Grid.Column="1"
|
|
||||||
Text="{Binding MatCode}" FontSize="20"
|
|
||||||
VerticalAlignment="Center" HorizontalAlignment="Left"
|
|
||||||
></TextBlock>
|
|
||||||
<TextBlock Grid.Row="2" Grid.Column="0"
|
|
||||||
Text="物料名称:" FontSize="20"
|
|
||||||
VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
|
|
||||||
<TextBlock Grid.Row="2" Grid.Column="1"
|
|
||||||
Text="{Binding MatName}" FontSize="20"
|
|
||||||
VerticalAlignment="Center" HorizontalAlignment="Left"
|
|
||||||
></TextBlock>
|
|
||||||
<TextBlock Grid.Row="3" Grid.Column="0"
|
|
||||||
Text="物料规格:" FontSize="20"
|
|
||||||
VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
|
|
||||||
<TextBlock Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="3"
|
|
||||||
Text="{Binding MatSpec}" FontSize="20"
|
|
||||||
VerticalAlignment="Center" HorizontalAlignment="Left"
|
|
||||||
>
|
|
||||||
</TextBlock>
|
|
||||||
|
|
||||||
<TextBlock Grid.Row="4" Grid.Column="0"
|
<Border Grid.Row="2" Margin="5,5,5,5" BorderThickness="1" Background="White" BorderBrush="DodgerBlue" CornerRadius="3">
|
||||||
Text="物料批次:" FontSize="20"
|
<Grid>
|
||||||
VerticalAlignment="Center" HorizontalAlignment="Right">
|
<Grid.ColumnDefinitions>
|
||||||
</TextBlock>
|
<ColumnDefinition Width="2*"></ColumnDefinition>
|
||||||
<TextBlock Grid.Row="4" Grid.Column="1"
|
<ColumnDefinition Width="3*"></ColumnDefinition>
|
||||||
Text="{Binding MatBatch}" FontSize="20"
|
</Grid.ColumnDefinitions>
|
||||||
VerticalAlignment="Center" HorizontalAlignment="Left">
|
<GroupBox Grid.Column="0" Background="White" Padding="0" Style="{StaticResource GroupBoxTab}" Margin="0,5,5,5" >
|
||||||
</TextBlock>
|
<GroupBox.Header>
|
||||||
|
<Grid Width="{Binding ActualWidth,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type GroupBox}}}">
|
||||||
<TextBlock Grid.Row="5" Grid.Column="0"
|
<TextBlock Margin="5,0" HorizontalAlignment="Left" VerticalAlignment="Center">入库报警信息</TextBlock>
|
||||||
Text="物料数量:" FontSize="20"
|
<Button HorizontalAlignment="Right" Height="25" Margin="10,0" Padding="10,0" FontFamily="{StaticResource IconFont}" Command="{Binding ClearTextInfoCommand}"> 清空</Button>
|
||||||
VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
|
</Grid>
|
||||||
<TextBlock Grid.Row="5" Grid.Column="1"
|
</GroupBox.Header>
|
||||||
Text="{Binding MatQty}" FontSize="20"
|
<pi:TextBoxLog Token="InstoreWarning" Style="{StaticResource TextBoxExtend.Multi}" Margin="-1" hc:InfoElement.Placeholder="没有日志信息" Foreground="CornflowerBlue"></pi:TextBoxLog>
|
||||||
VerticalAlignment="Center" HorizontalAlignment="Left"></TextBlock>
|
</GroupBox>
|
||||||
|
<GroupBox Grid.Column="1" Background="White" Padding="0" Style="{StaticResource GroupBoxTab}" Margin="0,5,5,5" >
|
||||||
<TextBlock Grid.Row="4" Grid.Column="2"
|
<GroupBox.Header>
|
||||||
Text="当前入库货架:" FontSize="20" FontWeight="Bold"
|
<Grid Width="{Binding ActualWidth,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type GroupBox}}}">
|
||||||
VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
|
<TextBlock Margin="5,0" HorizontalAlignment="Left" VerticalAlignment="Center">入库日志信息</TextBlock>
|
||||||
<TextBlock Grid.Row="4" Grid.Column="3" Grid.RowSpan="2"
|
<Button HorizontalAlignment="Right" Height="25" Margin="10,0" Padding="10,0" FontFamily="{StaticResource IconFont}" Command="{Binding ClearTextInfoCommand}"> 清空</Button>
|
||||||
Text="{Binding ShelfCode}" FontSize="5" FontWeight="Bold"
|
</Grid>
|
||||||
VerticalAlignment="Center" HorizontalAlignment="Left">
|
</GroupBox.Header>
|
||||||
</TextBlock>
|
<pi:TextBoxLog Token="InstoreLog" Style="{StaticResource TextBoxExtend.Multi}" Margin="-1" hc:InfoElement.Placeholder="没有日志信息" Foreground="CornflowerBlue"></pi:TextBoxLog>
|
||||||
|
</GroupBox>
|
||||||
|
</Grid>
|
||||||
</Grid>
|
|
||||||
<DataGrid Grid.Row="1" SelectedCellsChanged="DataGrid_SelectedCellsChanged"
|
|
||||||
ItemsSource="{Binding DataGridItemSource}"
|
|
||||||
RowHeight="39" Margin="5"
|
|
||||||
AutoGenerateColumns="False" FontSize="18" CanUserSortColumns="False">
|
|
||||||
<DataGrid.Columns>
|
|
||||||
<DataGridTextColumn IsReadOnly="True" Header="物料编码" Binding="{Binding MatCode}"></DataGridTextColumn>
|
|
||||||
<DataGridTextColumn IsReadOnly="True" Header="物料名称" Binding="{Binding MatName}"></DataGridTextColumn>
|
|
||||||
<DataGridTextColumn IsReadOnly="True" Header="物料规格" Binding="{Binding MatSpec}"></DataGridTextColumn>
|
|
||||||
<DataGridTextColumn IsReadOnly="True" Header="批次" Binding="{Binding MatBatch}"></DataGridTextColumn>
|
|
||||||
<DataGridTextColumn IsReadOnly="True" Header="数量" Binding="{Binding MatQty}"></DataGridTextColumn>
|
|
||||||
<DataGridTextColumn IsReadOnly="True" Header="入库位置" Binding="{Binding StoreCode}"></DataGridTextColumn>
|
|
||||||
<DataGridTextColumn IsReadOnly="True" Header="入库人" Binding="{Binding InstoreUser}"></DataGridTextColumn>
|
|
||||||
<DataGridTextColumn IsReadOnly="True" Header="入库时间" Binding="{Binding InstoreTime ,StringFormat='yyyy-MM-dd HH:mm:ss'}"></DataGridTextColumn>
|
|
||||||
<DataGridTextColumn IsReadOnly="True" Header="最小包装条码" Binding="{Binding MatSN}"></DataGridTextColumn>
|
|
||||||
</DataGrid.Columns>
|
|
||||||
</DataGrid>
|
|
||||||
</Grid>-->
|
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -65,5 +65,13 @@ namespace 货架标准上位机
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Button_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Space)
|
||||||
|
{
|
||||||
|
e.Handled = true; // 阻止空格键触发按钮点击事件
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@
|
|||||||
<RowDefinition Height="auto"></RowDefinition>
|
<RowDefinition Height="auto"></RowDefinition>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<!--内容-->
|
<!--内容-->
|
||||||
<TabControl Grid.Row="1" TabStripPlacement="Left" Margin="5,0,5,2" Padding="0,0,3,0" BorderThickness="0" Style="{StaticResource TabControlRectangle}" PreviewKeyDown="tabControl_PreviewKeyDown">
|
<TabControl Grid.Row="1" TabStripPlacement="Left" Margin="5,0,5,2" Padding="0,0,3,0" BorderThickness="0" Style="{StaticResource TabControlRectangle}" PreviewKeyDown="tabControl_PreviewKeyDown">
|
||||||
<TabItem Padding="10,10,40,10" IsSelected="True">
|
<TabItem Padding="10,10,40,10" IsSelected="True">
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
||||||
@ -86,9 +86,6 @@
|
|||||||
<View:HomeView />
|
<View:HomeView />
|
||||||
</hc:TransitioningContentControl>
|
</hc:TransitioningContentControl>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<TabItem Padding="10,10,40,10" Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.查询},Converter={StaticResource AuthVisConverter}}">
|
<TabItem Padding="10,10,40,10" Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.查询},Converter={StaticResource AuthVisConverter}}">
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
@ -103,6 +100,17 @@
|
|||||||
</TabItem>
|
</TabItem>
|
||||||
|
|
||||||
<TabItem Padding="10,10,40,10" Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.查询},Converter={StaticResource AuthVisConverter}}">
|
<TabItem Padding="10,10,40,10" Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.查询},Converter={StaticResource AuthVisConverter}}">
|
||||||
|
<TabItem.Header>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Text="" FontSize="20" FontFamily="{StaticResource IconFont}"></TextBlock>
|
||||||
|
<TextBlock Margin="10,0,0,0" FontSize="16">出库单据</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</TabItem.Header>
|
||||||
|
<hc:TransitioningContentControl TransitionMode="Fade">
|
||||||
|
<View:OutInventoryDocumentView/>
|
||||||
|
</hc:TransitioningContentControl>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem IsSelected="{Binding GoToOutVentoryView}" Padding="10,10,40,10" Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.查询},Converter={StaticResource AuthVisConverter}}">
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<TextBlock Text="" FontSize="20" FontFamily="{StaticResource IconFont}"></TextBlock>
|
<TextBlock Text="" FontSize="20" FontFamily="{StaticResource IconFont}"></TextBlock>
|
||||||
@ -113,7 +121,7 @@
|
|||||||
<View:OutVentoryView/>
|
<View:OutVentoryView/>
|
||||||
</hc:TransitioningContentControl>
|
</hc:TransitioningContentControl>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|
||||||
<TabItem Padding="10,10,40,10" Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.查询},Converter={StaticResource AuthVisConverter}}">
|
<TabItem Padding="10,10,40,10" Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.查询},Converter={StaticResource AuthVisConverter}}">
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
@ -251,7 +259,7 @@
|
|||||||
</TabItem>
|
</TabItem>
|
||||||
</TabControl>
|
</TabControl>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|
||||||
<TabItem Padding="10,10,40,10" Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.设置},Converter={StaticResource AuthVisConverter}}">
|
<TabItem Padding="10,10,40,10" Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.设置},Converter={StaticResource AuthVisConverter}}">
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
|
48
货架标准上位机/Views/OutInventoryDocumentDetailView.xaml
Normal file
48
货架标准上位机/Views/OutInventoryDocumentDetailView.xaml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<hc:Window x:Class="货架标准上位机.OutInventoryDocumentDetailView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
|
Height="500" Width="800" WindowStyle="None" BorderThickness="0" Background="{x:Null}" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Opacity="1">
|
||||||
|
<hc:Window.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<Style TargetType="Button" BasedOn="{StaticResource ButtonDefault}">
|
||||||
|
<Setter Property="Padding" Value="25,0"></Setter>
|
||||||
|
</Style>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</hc:Window.Resources>
|
||||||
|
<Border BorderBrush="Gray" Background="WhiteSmoke" CornerRadius="5" BorderThickness="1">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="auto"></RowDefinition>
|
||||||
|
<RowDefinition Height="*"></RowDefinition>
|
||||||
|
<RowDefinition Height="auto"></RowDefinition>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock FontSize="24" Name="Title" Text="单 据 明 细" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||||
|
<Button Margin="-5,-1" Visibility="{Binding IsClose,Converter={StaticResource Boolean2VisibilityConverter}}" Style="{StaticResource ButtonIcon}" hc:IconElement.Geometry="{StaticResource CloseGeometry}" HorizontalAlignment="Right" VerticalAlignment="Top" Click="closeClick"/>
|
||||||
|
|
||||||
|
<Grid Margin="5,0" Grid.Row="1" >
|
||||||
|
<DataGrid Grid.Row="1" SelectedCellsChanged="DataGrid_SelectedCellsChanged"
|
||||||
|
ItemsSource="{Binding DataGridItemSource}"
|
||||||
|
RowHeight="39"
|
||||||
|
AutoGenerateColumns="False" Name="dg1" FontSize="13">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn IsReadOnly="True" Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
|
||||||
|
<DataGridTextColumn IsReadOnly="True" Header="单据编号" Binding="{Binding OrderNumber}"></DataGridTextColumn>
|
||||||
|
<DataGridTextColumn IsReadOnly="True" Header="物料编码" Binding="{Binding MatCode}"></DataGridTextColumn>
|
||||||
|
<DataGridTextColumn IsReadOnly="True" Header="物料名称" Binding="{Binding MatName}"></DataGridTextColumn>
|
||||||
|
<DataGridTextColumn IsReadOnly="True" Header="物料批次" Binding="{Binding MatBatch}"></DataGridTextColumn>
|
||||||
|
<DataGridTextColumn IsReadOnly="True" Header="需求数量" Binding="{Binding ReqQty}"></DataGridTextColumn>
|
||||||
|
<DataGridTextColumn IsReadOnly="True" Header="已出库数量" Binding="{Binding OutQty}"></DataGridTextColumn>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<StackPanel Margin="5" x:Name="spacingPanel" Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||||
|
<Button Margin="5" Content="确认" FontSize="18" Click="closeClick"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</hc:Window>
|
46
货架标准上位机/Views/OutInventoryDocumentDetailView.xaml.cs
Normal file
46
货架标准上位机/Views/OutInventoryDocumentDetailView.xaml.cs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Media;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using WCS.Model.ApiModel.OutStore;
|
||||||
|
using static System.Net.Mime.MediaTypeNames;
|
||||||
|
|
||||||
|
|
||||||
|
namespace 货架标准上位机
|
||||||
|
{
|
||||||
|
public partial class OutInventoryDocumentDetailView : HandyControl.Controls.Window
|
||||||
|
{
|
||||||
|
public OutInventoryDocumentDetailView(List<OutOrderDetailModel> _matBaseInfo = null)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
if (_matBaseInfo != null)
|
||||||
|
{
|
||||||
|
dg1.ItemsSource = _matBaseInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void closeClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.DialogResult = false;
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DataGrid_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
|
||||||
|
{
|
||||||
|
DataGrid datagrid = sender as DataGrid;
|
||||||
|
datagrid.UnselectAllCells();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
51
货架标准上位机/Views/OutInventoryDocumentMatDetailView.xaml
Normal file
51
货架标准上位机/Views/OutInventoryDocumentMatDetailView.xaml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<hc:Window x:Class="货架标准上位机.OutInventoryDocumentMatDetailView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
|
Height="500" Width="800" WindowStyle="None" BorderThickness="0" Background="{x:Null}" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Opacity="1">
|
||||||
|
<hc:Window.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<Style TargetType="Button" BasedOn="{StaticResource ButtonDefault}">
|
||||||
|
<Setter Property="Padding" Value="25,0"></Setter>
|
||||||
|
</Style>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</hc:Window.Resources>
|
||||||
|
<Border BorderBrush="Gray" Background="WhiteSmoke" CornerRadius="5" BorderThickness="1">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="auto"></RowDefinition>
|
||||||
|
<RowDefinition Height="*"></RowDefinition>
|
||||||
|
<RowDefinition Height="auto"></RowDefinition>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock FontSize="24" Name="Title" Text="发 料 明 细" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||||
|
<Button Margin="-5,-1" Visibility="{Binding IsClose,Converter={StaticResource Boolean2VisibilityConverter}}" Style="{StaticResource ButtonIcon}" hc:IconElement.Geometry="{StaticResource CloseGeometry}" HorizontalAlignment="Right" VerticalAlignment="Top" Click="closeClick"/>
|
||||||
|
|
||||||
|
<Grid Margin="5,0" Grid.Row="1" >
|
||||||
|
<DataGrid Grid.Row="1" SelectedCellsChanged="DataGrid_SelectedCellsChanged"
|
||||||
|
ItemsSource="{Binding DataGridItemSource}"
|
||||||
|
RowHeight="39"
|
||||||
|
AutoGenerateColumns="False" Name="dg1" FontSize="13">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn IsReadOnly="True" Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
|
||||||
|
<DataGridTextColumn Header="库位" MaxWidth="120" Binding="{Binding StoreCode}"></DataGridTextColumn>
|
||||||
|
<DataGridTextColumn Header="物料编码" MaxWidth="150" Binding="{Binding MatCode}"></DataGridTextColumn>
|
||||||
|
<DataGridTextColumn Header="物料名称" MaxWidth="150" Binding="{Binding MatName}"></DataGridTextColumn>
|
||||||
|
<DataGridTextColumn Header="数量" Binding="{Binding MatQty}"></DataGridTextColumn>
|
||||||
|
<DataGridTextColumn Header="物料规格" MaxWidth="150" Binding="{Binding MatSpec}"></DataGridTextColumn>
|
||||||
|
<DataGridTextColumn Header="物料批次" MaxWidth="150" Binding="{Binding MatBatch}"></DataGridTextColumn>
|
||||||
|
<DataGridTextColumn Header="物料SN" MaxWidth="150" Binding="{Binding MatSN}"></DataGridTextColumn>
|
||||||
|
<DataGridTextColumn Header="是否已发" MaxWidth="100" Binding="{Binding IsSended}"></DataGridTextColumn>
|
||||||
|
<DataGridTextColumn Header="操作人" MaxWidth="150" Binding="{Binding OpUser}"></DataGridTextColumn>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<StackPanel Margin="5" x:Name="spacingPanel" Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||||
|
<Button Margin="5" Content="确认" FontSize="18" Click="closeClick"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</hc:Window>
|
40
货架标准上位机/Views/OutInventoryDocumentMatDetailView.xaml.cs
Normal file
40
货架标准上位机/Views/OutInventoryDocumentMatDetailView.xaml.cs
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Media;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using WCS.Model.ApiModel.OutStore;
|
||||||
|
|
||||||
|
|
||||||
|
namespace 货架标准上位机
|
||||||
|
{
|
||||||
|
public partial class OutInventoryDocumentMatDetailView : HandyControl.Controls.Window
|
||||||
|
{
|
||||||
|
public OutInventoryDocumentMatDetailView(List<OutOrderMatDetailModel> _matBaseInfo = null)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
if (_matBaseInfo != null )
|
||||||
|
{
|
||||||
|
dg1.ItemsSource= _matBaseInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void closeClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.DialogResult = false;
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DataGrid_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
|
||||||
|
{
|
||||||
|
DataGrid datagrid = sender as DataGrid;
|
||||||
|
datagrid.UnselectAllCells();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
181
货架标准上位机/Views/OutInventoryDocumentView.xaml
Normal file
181
货架标准上位机/Views/OutInventoryDocumentView.xaml
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
<pi:UserControlBase
|
||||||
|
xmlns:pi="https://github.com/ping9719/wpfex"
|
||||||
|
x:Class="货架标准上位机.OutInventoryDocumentView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="737" d:DesignWidth="1192">
|
||||||
|
<Border Margin="0" Background="LightGray" CornerRadius="3" Padding="0">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"></RowDefinition>
|
||||||
|
<RowDefinition Height="7*"></RowDefinition>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Border Grid.Row="0" Margin="5 5 5 0" Background="AliceBlue" CornerRadius="5" Padding="0">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||||
|
<ColumnDefinition Width="1.5*"></ColumnDefinition>
|
||||||
|
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||||
|
<ColumnDefinition Width="1.5*"></ColumnDefinition>
|
||||||
|
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||||
|
<ColumnDefinition Width="0.2*"></ColumnDefinition>
|
||||||
|
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||||
|
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition></RowDefinition>
|
||||||
|
<RowDefinition></RowDefinition>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Grid.Column="0"
|
||||||
|
VerticalAlignment="Center" HorizontalAlignment="Right"
|
||||||
|
Text="单据编号:" FontSize="18" ></TextBlock>
|
||||||
|
<TextBox Grid.Column="1" Text="{Binding OrderNumber}"
|
||||||
|
VerticalAlignment="Center" HorizontalAlignment="Left"
|
||||||
|
FontSize="18" MinWidth="120" ></TextBox>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="2"
|
||||||
|
VerticalAlignment="Center" HorizontalAlignment="Right"
|
||||||
|
Text="单据类型:" FontSize="18" ></TextBlock>
|
||||||
|
<TextBox Grid.Column="3" Text="{Binding OrderType}"
|
||||||
|
VerticalAlignment="Center" HorizontalAlignment="Left"
|
||||||
|
FontSize="18" MinWidth="120" ></TextBox>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="0"
|
||||||
|
VerticalAlignment="Center" HorizontalAlignment="Right"
|
||||||
|
Text="单据来源:" FontSize="18" ></TextBlock>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding OrderSource}"
|
||||||
|
VerticalAlignment="Center" HorizontalAlignment="Left"
|
||||||
|
FontSize="18" MinWidth="120" ></TextBox>
|
||||||
|
|
||||||
|
|
||||||
|
<!--<TextBlock Grid.Row="2" Grid.Column="2"
|
||||||
|
VerticalAlignment="Center" HorizontalAlignment="Right"
|
||||||
|
Text="单据状态:" FontSize="18" ></TextBlock>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="3" Text="{Binding OrderNumber}"
|
||||||
|
VerticalAlignment="Center" HorizontalAlignment="Left"
|
||||||
|
FontSize="18" MinWidth="120" ></TextBox>-->
|
||||||
|
|
||||||
|
<Button Style="{StaticResource ButtonSuccess}"
|
||||||
|
Command="{Binding BtnSearchCommand}"
|
||||||
|
hc:BorderElement.CornerRadius="15"
|
||||||
|
Grid.Column="6" MinHeight="40" FontSize="18" Content=" 搜索" FontFamily="{StaticResource IconFont}" Margin="0,0,0,-10" >
|
||||||
|
</Button>
|
||||||
|
<Button Style="{StaticResource ButtonWarning}"
|
||||||
|
Command="{Binding BtnResetCommand}"
|
||||||
|
hc:BorderElement.CornerRadius="15"
|
||||||
|
Grid.Column="7" MinHeight="40" FontSize="18" Content=" 重置" FontFamily="{StaticResource IconFont}" Margin="0,0,0,-10" >
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<Border Grid.Row="1" Margin="5" Background="AliceBlue" CornerRadius="5" Padding="0">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="0.8*"></RowDefinition>
|
||||||
|
<RowDefinition Height="8*"></RowDefinition>
|
||||||
|
<RowDefinition Height="0.8*"></RowDefinition>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<StackPanel Grid.Row="0" Orientation="Horizontal">
|
||||||
|
<Button MinHeight="40" FontSize="18" Margin="5" Command="{Binding BtnOrderDetailCommand}"
|
||||||
|
Content="单据明细" FontFamily="{StaticResource IconFont}" Background="#bccbb0" Foreground="White">
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button MinHeight="40" FontSize="18" Margin="5" Command="{Binding BtnOrderMatDetailCommand}"
|
||||||
|
Content="发料明细" FontFamily="{StaticResource IconFont}" Background="#bccbb0" Foreground="White">
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button MinHeight="40" FontSize="18" Margin="5" Command="{Binding BtnStartCommand}"
|
||||||
|
Content="开始发料" FontFamily="{StaticResource IconFont}" Background="CadetBlue" Foreground="White">
|
||||||
|
</Button>
|
||||||
|
<Button MinHeight="40" FontSize="18" Margin="5" Command="{Binding BtnPauseCommand}"
|
||||||
|
Content="暂停发料" FontFamily="{StaticResource IconFont}" Background="CadetBlue" Foreground="White">
|
||||||
|
</Button>
|
||||||
|
</StackPanel>
|
||||||
|
<DataGrid Grid.Row="1" SelectedCellsChanged="DataGrid_SelectedCellsChanged"
|
||||||
|
SelectedItem="{Binding SelectedataGridItem}"
|
||||||
|
ItemsSource="{Binding DataGridItemSource}"
|
||||||
|
Name="dg"
|
||||||
|
RowHeight="39"
|
||||||
|
AutoGenerateColumns="False" FontSize="13">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTemplateColumn CanUserResize="False">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<CheckBox Width="30" Height="30" IsHitTestVisible="False" IsChecked="{Binding IsSelected , UpdateSourceTrigger=PropertyChanged}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTextColumn IsReadOnly="True" Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
|
||||||
|
<DataGridTextColumn IsReadOnly="True" Header="单据编号" Binding="{Binding OrderNumber}"></DataGridTextColumn>
|
||||||
|
<DataGridTextColumn IsReadOnly="True" Header="单据来源" Binding="{Binding OrderSource}"></DataGridTextColumn>
|
||||||
|
<DataGridTextColumn IsReadOnly="True" Header="单据类型" Binding="{Binding OrderType}"></DataGridTextColumn>
|
||||||
|
<DataGridTextColumn IsReadOnly="True" Header="单据状态" Binding="{Binding OrderStatus}"></DataGridTextColumn>
|
||||||
|
<DataGridTextColumn IsReadOnly="True" Header="单据同步类型" Binding="{Binding SyncType}"></DataGridTextColumn>
|
||||||
|
<DataGridTextColumn IsReadOnly="True" Header="创建时间" Binding="{Binding CreateTime}"></DataGridTextColumn>
|
||||||
|
<DataGridTextColumn IsReadOnly="True" Header="创建人" Binding="{Binding CreateUser}"></DataGridTextColumn>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
|
||||||
|
<Grid Grid.Row="2">
|
||||||
|
<Border CornerRadius="3" Background="Transparent" VerticalAlignment="Center" >
|
||||||
|
<Grid HorizontalAlignment="Stretch" Margin="0" VerticalAlignment="Top" Width="Auto" MinHeight="26">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="5*"></ColumnDefinition>
|
||||||
|
<ColumnDefinition Width="5*"></ColumnDefinition>
|
||||||
|
<ColumnDefinition Width="5*"></ColumnDefinition>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<StackPanel Orientation="Horizontal" Margin="5">
|
||||||
|
<TextBlock FontSize="14" Text="共"></TextBlock>
|
||||||
|
<TextBlock FontSize="14" Text="{Binding TotalCount ,FallbackValue=0}"></TextBlock>
|
||||||
|
<TextBlock FontSize="14" Text="条记录 "></TextBlock>
|
||||||
|
<TextBlock FontSize="14" Text="第"></TextBlock>
|
||||||
|
<TextBlock FontSize="14" Text="{Binding CurrentPage,FallbackValue=0}"></TextBlock>
|
||||||
|
<TextBlock FontSize="14" Text="/"></TextBlock>
|
||||||
|
<TextBlock FontSize="14" Text="{Binding MaxPage,FallbackValue=0}"></TextBlock>
|
||||||
|
<TextBlock FontSize="14" Text="页"></TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Column="1">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions >
|
||||||
|
<RowDefinition Height="30"></RowDefinition>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="auto"/>
|
||||||
|
<ColumnDefinition Width="auto"/>
|
||||||
|
<ColumnDefinition Width="auto"/>
|
||||||
|
<ColumnDefinition Width="auto"/>
|
||||||
|
<ColumnDefinition Width="auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="0" Name="btnFirst" Content="首页" Foreground="Black" FontSize="14"
|
||||||
|
Command="{Binding BtnFirstPageCommand}"/>
|
||||||
|
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="1" Name="btnPrev" Content="上一页" FontSize="14"
|
||||||
|
Command="{Binding BtnPrePageCommand}"/>
|
||||||
|
<TextBox BorderBrush="Transparent" Grid.Column="2" FontSize="14" MinWidth="50" HorizontalAlignment="Center" VerticalAlignment="Center" Cursor="IBeam" IsEnabled="False"
|
||||||
|
Text ="{Binding CurrentPage}" TextAlignment="Center"/>
|
||||||
|
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="3" Name="btnNext" Content="下一页" FontSize="14"
|
||||||
|
Command="{Binding BtnNextPageCommand}"/>
|
||||||
|
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="4" Name="btnLast" Content="末页" FontSize="14"
|
||||||
|
Command="{Binding BtnLastPageCommand}"/>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</pi:UserControlBase>
|
66
货架标准上位机/Views/OutInventoryDocumentView.xaml.cs
Normal file
66
货架标准上位机/Views/OutInventoryDocumentView.xaml.cs
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
using Ping9719.WpfEx;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Web.UI.WebControls;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using 货架标准上位机.ViewModels;
|
||||||
|
using DataGrid = System.Windows.Controls.DataGrid;
|
||||||
|
|
||||||
|
namespace 货架标准上位机
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// InInventoryView.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class OutInventoryDocumentView : UserControlBase
|
||||||
|
{
|
||||||
|
public OutInventoryDocumentViewModel viewModel = new OutInventoryDocumentViewModel();
|
||||||
|
public OutInventoryDocumentView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
this.DataContext = viewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DataGrid_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (viewModel.SelectedataGridItem != null)
|
||||||
|
{
|
||||||
|
viewModel.SelectedataGridItem.IsSelected = !viewModel.SelectedataGridItem.IsSelected;
|
||||||
|
this.dg.UnselectAllCells();//取消选中 避免手动点击check选项时反选失败 和重新点击该项时反选失败
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DataGrid_ItemDataBound(object sender, DataGridItemEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Item.ItemType != ListItemType.Header && e.Item.ItemType != ListItemType.Pager)
|
||||||
|
{
|
||||||
|
if (e.Item.Cells[1].Text.Length > 20)
|
||||||
|
{
|
||||||
|
e.Item.Cells[1].Text = e.Item.Cells[1].Text.Substring(0, 20) + "...";
|
||||||
|
}
|
||||||
|
if (e.Item.Cells[2].Text.Length > 20)
|
||||||
|
{
|
||||||
|
e.Item.Cells[2].Text = e.Item.Cells[2].Text.Substring(0, 20) + "...";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -132,9 +132,9 @@ namespace 货架标准上位机
|
|||||||
{
|
{
|
||||||
var body = new GetUsersRequest()
|
var body = new GetUsersRequest()
|
||||||
{
|
{
|
||||||
UserName = "未登录",
|
UserName = "admin",
|
||||||
DeviceType = "WCS前端",
|
DeviceType = "WCS前端",
|
||||||
Info = "admin",
|
Info = "123",
|
||||||
};
|
};
|
||||||
var Result = ApiHelp.Post<ResponseCommon<List<UserModel>>>([LocalFile.Config.ApiIpHost, "user/getUsers"], body).Result;
|
var Result = ApiHelp.Post<ResponseCommon<List<UserModel>>>([LocalFile.Config.ApiIpHost, "user/getUsers"], body).Result;
|
||||||
if (Result != null && Result.Data.Any())
|
if (Result != null && Result.Data.Any())
|
||||||
@ -144,9 +144,9 @@ namespace 货架标准上位机
|
|||||||
|
|
||||||
var bodyRole = new GetUsersRequest()
|
var bodyRole = new GetUsersRequest()
|
||||||
{
|
{
|
||||||
UserName = "未登录",
|
UserName = "admin",
|
||||||
DeviceType = "WCS前端",
|
DeviceType = "WCS前端",
|
||||||
Info = string.Empty,
|
Info = "123",
|
||||||
|
|
||||||
};
|
};
|
||||||
var ResultRole = ApiHelp.Post<ResponseCommon<List<RoleModel>>>([LocalFile.Config.ApiIpHost, "user/getRoles"], body).Result;
|
var ResultRole = ApiHelp.Post<ResponseCommon<List<RoleModel>>>([LocalFile.Config.ApiIpHost, "user/getRoles"], body).Result;
|
||||||
|
100
货架标准上位机/WebSocket.cs
Normal file
100
货架标准上位机/WebSocket.cs
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
using HandyControl.Controls;
|
||||||
|
using Ping9719.WpfEx;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using TouchSocket.Core;
|
||||||
|
using TouchSocket.Http.WebSockets;
|
||||||
|
using TouchSocket.Sockets;
|
||||||
|
|
||||||
|
namespace 货架标准上位机
|
||||||
|
{
|
||||||
|
public static class WebSocket
|
||||||
|
{
|
||||||
|
public static void InitWebSocket()
|
||||||
|
{
|
||||||
|
var client = new WebSocketClient();
|
||||||
|
client.Setup(new TouchSocketConfig()
|
||||||
|
.SetRemoteIPHost("ws://127.0.0.1:7789/ws")
|
||||||
|
.ConfigureContainer(a =>
|
||||||
|
{
|
||||||
|
a.AddConsoleLogger();
|
||||||
|
})
|
||||||
|
.ConfigurePlugins(a =>
|
||||||
|
{
|
||||||
|
a.Add<WebSocketClientPlugin>();
|
||||||
|
//配置心跳
|
||||||
|
a.UseWebSocketHeartbeat()//使用心跳插件
|
||||||
|
.SetTick(TimeSpan.FromSeconds(5));//每5秒ping一次。
|
||||||
|
//配置断线重连
|
||||||
|
a.UseReconnection(-1, true, 1000);//-1表示一直重连
|
||||||
|
}));
|
||||||
|
|
||||||
|
client.Connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public class WebSocketClientPlugin : PluginBase, IWebSocketReceivedPlugin
|
||||||
|
{
|
||||||
|
private readonly ILog m_logger;
|
||||||
|
|
||||||
|
public WebSocketClientPlugin(ILog logger)
|
||||||
|
{
|
||||||
|
this.m_logger = logger;
|
||||||
|
}
|
||||||
|
public async Task OnWebSocketReceived(IWebSocket client, WSDataFrameEventArgs e)
|
||||||
|
{
|
||||||
|
switch (e.DataFrame.Opcode)
|
||||||
|
{
|
||||||
|
case WSDataType.Cont:
|
||||||
|
m_logger.Info($"收到中间数据,长度为:{e.DataFrame.PayloadLength}");
|
||||||
|
return;
|
||||||
|
|
||||||
|
case WSDataType.Text:
|
||||||
|
m_logger.Info(e.DataFrame.ToText());
|
||||||
|
if (!client.Client.IsClient)
|
||||||
|
{
|
||||||
|
client.Send("我已收到");
|
||||||
|
}
|
||||||
|
//返回的报警信息 出入库盘点等日志信息
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TextBoxLog.AddLog(e.DataFrame.ToText(), "123", DateTime.Now);
|
||||||
|
//Growl.Error(e.DataFrame.ToText());
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
|
||||||
|
case WSDataType.Binary:
|
||||||
|
if (e.DataFrame.FIN)
|
||||||
|
{
|
||||||
|
m_logger.Info($"收到二进制数据,长度为:{e.DataFrame.PayloadLength}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_logger.Info($"收到未结束的二进制数据,长度为:{e.DataFrame.PayloadLength}");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
|
||||||
|
case WSDataType.Close:
|
||||||
|
{
|
||||||
|
m_logger.Info("远程请求断开");
|
||||||
|
client.Close("断开");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
|
||||||
|
case WSDataType.Ping:
|
||||||
|
client.Pong();
|
||||||
|
break;
|
||||||
|
case WSDataType.Pong:
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
await e.InvokeNext();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -54,6 +54,7 @@
|
|||||||
<PackageReference Include="SqlSugar" Version="5.1.4.149" />
|
<PackageReference Include="SqlSugar" Version="5.1.4.149" />
|
||||||
<PackageReference Include="SqlSugar.MySqlConnector" Version="5.1.3.42" />
|
<PackageReference Include="SqlSugar.MySqlConnector" Version="5.1.3.42" />
|
||||||
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.118" />
|
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.118" />
|
||||||
|
<PackageReference Include="TouchSocket.Http" Version="2.0.3" />
|
||||||
<PackageReference Include="TouchSocket.SerialPorts" Version="2.0.2" />
|
<PackageReference Include="TouchSocket.SerialPorts" Version="2.0.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user