This commit is contained in:
hehaibing-1996
2024-05-15 18:59:24 +08:00
parent cc65e985aa
commit 432a96198f
75 changed files with 2174 additions and 272 deletions

View File

@ -42,7 +42,7 @@ namespace WCS.BLL.DbModels
[SugarColumn(ColumnName = "mat_spec", Length = 150, IsNullable = true, ColumnDescription = "物料规格")]
public string? MatSpec { get; set; }
[SugarColumn(ColumnName = "mat_unit", Length = 100, IsNullable = true, ColumnDescription = "物料单位")]
public string? MatUnit { get; set; }
@ -75,6 +75,13 @@ namespace WCS.BLL.DbModels
/// </summary>
[SugarColumn(ColumnName = "is_printed", ColumnDescription = "是否已打印")]
public bool IsPrinted { get; set; } = false;
/// <summary>
/// 打印次数
/// </summary>
[SugarColumn(ColumnName = "printed_times", DefaultValue = "0", ColumnDescription = "打印次数")]
public int PrintedTimes { get; set; }
/// <summary>
/// Desc:更新人
/// Default:

View File

@ -12,7 +12,7 @@ namespace WCS.DAL.DbModels
///模组信息表
///</summary>
[SugarTable("module_info")]
public partial class ModuleInfo
public class ModuleInfo
{
/// <summary>
@ -80,5 +80,16 @@ namespace WCS.DAL.DbModels
[SugarColumn(ColumnName = "current_mode", IsNullable = true, ColumnDescription = "串联后大货架编码;大货架编码:未串联时是与货架编码是一对一的关系;串联后与货架编码是一对多的关系")]
public Mode CurrentMode { get; set; } = Mode.;
/// <summary>
/// 序号
/// </summary>
[SugarColumn(IsIgnore = true)]
public int RowNumber { get; set; }
/// <summary>
/// 是否已经选择
/// </summary>
[SugarColumn(IsIgnore = true)]
public bool IsSelected { get; set; }
}
}

View File

@ -50,6 +50,12 @@ namespace WCS.BLL.DbModels
[SugarColumn(ColumnName = "create_user", Length = 100, IsNullable = true, ColumnDescription = "创建人")]
public string CreateUser { get; set; }
/// <summary>
/// 更新时间
/// </summary>
[SugarColumn(ColumnName = "update_time", IsNullable = false, ColumnDescription = "更新时间")]
public DateTime UpdateTime { get; set; } = DateTime.Now;
/// <summary>
/// 序号
/// </summary>

View File

@ -87,5 +87,16 @@ namespace WCS.DAL.DbModels
/// </summary>
[SugarColumn(ColumnName = "offset_voltage", IsNullable = true, ColumnDescription = "电压偏移值")]
public decimal OffsetVoltage { get; set; }
/// <summary>
/// 序号
/// </summary>
[SugarColumn(IsIgnore = true)]
public int RowNumber { get; set; }
/// <summary>
/// 是否已经选择
/// </summary>
[SugarColumn(IsIgnore = true)]
public bool IsSelected { get; set; }
}
}

View File

@ -45,49 +45,6 @@ namespace WCS.BLL.HardWare
ModuleIds = Modules.Select(t => t.BoardId).ToList();
});
////初始化TCPCleint
//TcpCleint = new TCPClient("192.168.0.11:20002", "192.168.0.154:20003");
//TcpCleint.tcpClient.Received += (client, e) =>
//{
// var data = e.ByteBlock.Buffer.Take((int)e.ByteBlock.Length).ToArray();
// e.ByteBlock.Clear();
// var len = data.Length;
// for (int index = 0; index < data.Length - TcpCleint.PreFixLength; index++)
// {
// //协议拆包 通过前缀校验是否为完整数据包
// var prefixInData = data.Skip(index).Take(TcpCleint.PreFixLength);
// var isEqual = prefixInData.SequenceEqual(TcpCleint.Prefix);
// if (isEqual)
// {
// var dataTemp = data.Skip(index).Take(TcpCleint.PreFixLength + TcpCleint.DataLength).ToArray();
// if (dataTemp.Length < TcpCleint.PreFixLength + TcpCleint.DataLength)//拆包后不满足一条指令的长度
// {
// continue;
// }
// index += (TcpCleint.PreFixLength + TcpCleint.DataLength - 1);//每次循环index会+1 所以这里-1
// //获取板子ID
// var boardIds = (data[TcpCleint.PreFixLength + 0] << 8) + data[TcpCleint.PreFixLength + 1];
// var lightNumber = Convert.ToInt32(data[TcpCleint.PreFixLength + 3]);
// //协议处理 判断功能位
// switch (dataTemp[TcpCleint.PreFixLength + 2])
// {
// case 0x01://进入入库模式信号
// GoInInstoreProcess(dataTemp, boardIds, lightNumber);
// break;
// case 0x03://正常入库信号
// InStoreReturnProcess(dataTemp);
// break;
// default:
// ;
// break;
// }
// }
// }
// return EasyTask.CompletedTask;
//};
//TcpCleint.Connect();
}
@ -748,6 +705,7 @@ namespace WCS.BLL.HardWare
}
//获取当前板所有库位
var storeInfos = DbHelp.db.Queryable<StoreInfo>()
.Where(t => t.ShelfId == ShelfId)
.Where(t => t.BoardId == boardId)
.ToList();
//当前板子的灯数量
@ -915,7 +873,9 @@ namespace WCS.BLL.HardWare
{
var boardId = (data[TcpCleint.PreFixLength + 0] << 8) + data[TcpCleint.PreFixLength + 1];
var number = Convert.ToInt32(data[TcpCleint.PreFixLength + 3]);
var storeInfo = DbHelp.db.Queryable<StoreInfo>().Where(t => t.BoardId == boardId
var storeInfo = DbHelp.db.Queryable<StoreInfo>().Where(t =>
t.ShelfId == ShelfId
&& t.BoardId == boardId
&& t.LightNumber == number).First();
if (storeInfo == null)
@ -1062,6 +1022,7 @@ namespace WCS.BLL.HardWare
Logs.Write("协议处理5.1");
lightNumber = (int)data[TcpCleint.PreFixLength + 4];
var storeInfo = DbHelp.db.Queryable<StoreInfo>()
.Where(t => t.ShelfId == ShelfId)
.Where(t => t.BoardId == boardId && t.LightNumber == lightNumber)
.First();
Logs.Write("协议处理5.2");
@ -1202,6 +1163,7 @@ namespace WCS.BLL.HardWare
}
//获取当前板所有库位
var storeInfos = DbHelp.db.Queryable<StoreInfo>()
.Where(t => t.ShelfId == ShelfId)
.Where(t => t.BoardId == boardId)
.ToList();
//当前板子的灯数量
@ -1310,6 +1272,7 @@ namespace WCS.BLL.HardWare
}
lightNumber = Convert.ToInt32(data[TcpCleint.PreFixLength + 3]);
var storeInfo = DbHelp.db.Queryable<StoreInfo>().Where(t => t.BoardId == boardId
&& t.ShelfId == ShelfId
&& t.LightNumber == lightNumber)
.First();
if (storeInfo == null)
@ -1423,9 +1386,19 @@ namespace WCS.BLL.HardWare
//确认本次出库
module.ComfirmOutstore(TcpCleint, data[TcpCleint.PreFixLength + 3]);
//当前柜子是否还存在未出库的
CurrentOutStoreMatSNs.RemoveAll(t => t == matSN);//删除本次已出的物料SN
var isExsistOut = CurrentOutStoreMatSNs.Any();
var tempOrder = CurrentOutOrder;
//通知前台刷新
Task.Run(() =>
{
//更新订单状态
UpdateOutOrderStatus(tempOrder);
var messageMode = new WebSocketMessageModel()
{
IsWarning = false,
@ -1435,18 +1408,9 @@ namespace WCS.BLL.HardWare
WarningManager.SendWarning(messageMode);
});
//当前柜子是否还存在未出库的
CurrentOutStoreMatSNs.RemoveAll(t => t == matSN);//删除本次已出的物料SN
var isExsistOut = CurrentOutStoreMatSNs.Any();
//本次亮灯的物料已全部取出
if (!isExsistOut)
{
//更新订单状态
UpdateOutOrderStatus(CurrentOutOrder);
CurrentOutOrder = null;
//退出出库模式
@ -1547,7 +1511,6 @@ namespace WCS.BLL.HardWare
}
}
catch (Exception ex)
{
@ -1634,6 +1597,7 @@ namespace WCS.BLL.HardWare
{
lightNumber = (int)data[TcpCleint.PreFixLength + 4];
var storeInfo = DbHelp.db.Queryable<StoreInfo>()
.Where(t => t.ShelfId == ShelfId)
.Where(t => t.BoardId == boardId && t.LightNumber == lightNumber)
.First();
if (storeInfo == null)

View File

@ -92,6 +92,7 @@ namespace WCS.BLL.HardWare
//TO DO 退出对应的模式 然后再发送进入入库模式
}
var storeInfos = DbHelp.db.Queryable<StoreInfo>()
.Where(t => t.ModuleId == ModuleId)
.Where(t => t.BoardId == BoardId)
.OrderBy(t => t.LightNumber)
.ToList();
@ -156,6 +157,7 @@ namespace WCS.BLL.HardWare
return;
}
var storeInfos = DbHelp.db.Queryable<StoreInfo>()
.Where(t => t.ModuleId == ModuleId)
.Where(t => t.BoardId == BoardId)
.OrderBy(t => t.LightNumber)
.ToList();
@ -184,7 +186,7 @@ namespace WCS.BLL.HardWare
public void GoInOutStoreMode(TCPClient tcpClient, List<string> outSns)
{
CurrentOutSns = outSns;
var storeInfos = DbHelp.db.Queryable<StoreInfo>()
var storeInfos = DbHelp.db.Queryable<StoreInfo>().Where(t => t.ModuleId == ModuleId)
.Where(t => t.BoardId == BoardId)
.OrderBy(t => t.LightNumber)
.ToList();
@ -247,7 +249,7 @@ namespace WCS.BLL.HardWare
{
CurrentStockTakingSns = stockTakingSns;
var storeInfos = DbHelp.db.Queryable<StoreInfo>()
var storeInfos = DbHelp.db.Queryable<StoreInfo>().Where(t => t.ModuleId == ModuleId)
.Where(t => t.BoardId == BoardId)
.OrderBy(t => t.LightNumber)
.ToList();
@ -277,7 +279,7 @@ namespace WCS.BLL.HardWare
tcpClient.Send(tcpClient.GenerateMessage(BoardId, GoInStockTakingModeData));
}
/// <summary>
/// 已确认过的物料
/// </summary>
@ -286,7 +288,7 @@ namespace WCS.BLL.HardWare
{
CurrentStockTakingSns = stockTakingSns;
var storeInfos = DbHelp.db.Queryable<StoreInfo>()
var storeInfos = DbHelp.db.Queryable<StoreInfo>().Where(t => t.ModuleId == ModuleId)
.Where(t => t.BoardId == BoardId)
.OrderBy(t => t.LightNumber)
.ToList();
@ -317,14 +319,14 @@ namespace WCS.BLL.HardWare
tcpClient.Send(tcpClient.GenerateMessage(BoardId, ConfirmStockTakingData));
}
/// <summary>
/// 单个确认物料
/// </summary>
/// <param name="tcpClient"></param>
public void ConfirmStockTakingSingle(TCPClient tcpClient, int lightNumber)
{
var storeInfos = DbHelp.db.Queryable<StoreInfo>()
var storeInfos = DbHelp.db.Queryable<StoreInfo>().Where(t => t.ModuleId == ModuleId)
.Where(t => t.BoardId == BoardId)
.OrderBy(t => t.LightNumber)
.ToList();

View File

@ -28,7 +28,7 @@ namespace WCS.BLL.Manager
.ToList();
foreach (var ip in ips)
{
var tcpCleint = new TCPClient(ip, "192.168.9.183:20003");
var tcpCleint = new TCPClient(ip, "");
//配置断线重连
tcpCleint.tcpClient.Received += (client, e) =>
{
@ -102,9 +102,49 @@ namespace WCS.BLL.Manager
Logs.Write("协议处理完毕!");
return EasyTask.CompletedTask;
};
//配置首次连接后复位操作
tcpCleint.tcpClient.Connected += (client, e) =>
{
var clientIpHost = client.IP + ":" + client.Port;
var TcpCleint = TCPClientManager.GetTCPClientByIPHost(clientIpHost);
if (TcpCleint == null)
{
return EasyTask.CompletedTask;
}
//首次连接
if (TcpCleint.IsFirstConnected == false)
{
InitStatus(TcpCleint);
TcpCleint.IsFirstConnected = true;
}
return EasyTask.CompletedTask;
};
TCPClients.Add(tcpCleint);
tcpCleint.Connect();
}
//启动线程监听所有TCP是否已经完成首次连接
Task.Run(() =>
{
while (true)
{
Thread.Sleep(1000);
var noFirstConnectedClients = TCPClientManager.TCPClients.Where(t => t.IsFirstConnected == false)
.ToList();
if (noFirstConnectedClients.Count == 0)
{
break;
}
else
{
noFirstConnectedClients.ForEach(t =>
{
t.ReConnectAsync();
});
}
}
});
}
//后台启动时给所有板子、警示灯发送复位操作 保持状态一致
@ -133,6 +173,30 @@ namespace WCS.BLL.Manager
}
});
}
//后台启动时给所有板子、警示灯发送复位操作 保持状态一致
public static void InitStatus(TCPClient tcpClient)
{
Task.Run(() =>
{
try
{
Thread.Sleep(1000);
//板子复位
new SmartShelfModule()
{
BoardId = 2047
}.Reset(tcpClient);
//报警灯复位
new WarningLight().CloseLight(tcpClient);
}
catch (Exception ex)
{
Logs.Write($"[{tcpClient.RemoteIPHost}]:启动时复位异常,{ex.Message}");
}
});
}
public static TCPClient GetTCPClientByIPHost(string IpHost)
{
return TCPClients.Where(t => t.RemoteIPHost == IpHost).FirstOrDefault();

View File

@ -144,6 +144,7 @@ namespace WCS.BLL.Manager
{
//获取库位
var storeInfo = DbHelp.db.Queryable<StoreInfo>()
.Where(t => t.ShelfId == warning.ShelfId)
.Where(t => t.Id == warning.StoreId)
.First();
if (storeInfo != null)

View File

@ -14,7 +14,7 @@ namespace WCS.BLL.Services.IService
public Task<PageQueryResponse<MatBaseInfo>> exportMatBaseInfo(GetMatBaseInfoRequest request);
public Task<ResponseCommon<List<string>>> importMatBaseInfo(List<MatBaseInfoImportModel> lists,string userName,string deviceType);
public Task<ResponseCommon<List<string>>> importMatBaseInfo(List<MatBaseInfoImportModel> lists, string userName, string deviceType);
public Task<ResponseCommon<object>> addOrUpdateMatBaseInfo(AddMatBaseInfoRequest<MatBaseInfo> request);
@ -24,5 +24,7 @@ namespace WCS.BLL.Services.IService
public Task<PageQueryResponse<MatInfo>> getMatInfo(GetMatInfoRequest request);
public Task<ResponseCommon> printedMatInfo(PrintedMatInfoRequest request);
}
}

View File

@ -29,5 +29,22 @@ namespace WCS.BLL.Services.IService
public Task<ResponseCommon<object>> GenerateStoreInfo();
/// <summary>
/// 查询货架列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public Task<PageQueryResponse<ModuleInfo>> GetModules(GetModulesRequest request);
/// <summary>
/// 查询货架列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public Task<PageQueryResponse<StoreInfo>> GetStores(GetStoresRequest request);
}
}

View File

@ -78,9 +78,10 @@ namespace WCS.BLL.Services.Service
MatQty = request.MatQty,
ModifyUser = request.UserName
};
matInfo.Id = DbHelp.db.Insertable(matInfo).ExecuteReturnIdentity();
matInfoList.Add(matInfo);
}
DbHelp.db.Insertable(matInfoList).ExecuteCommand();
matBaseInfo.SerialNumber = startNumber + request.TotalCount;
DbHelp.db.Updateable(matBaseInfo).ExecuteCommand();
DbHelp.db.CommitTran();

View File

@ -49,7 +49,7 @@ namespace WCS.BLL.Services.Service
//生成序号
for (int i = 0; i < records.Count; i++)
{
records[i].RowNumber = (request.PageNumber - 1) * 10 + i + 1;
records[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1;
}
return new PageQueryResponse<InOutRecord>()

View File

@ -149,7 +149,7 @@ namespace WCS.BLL.Services.Service
}
#region //调用接口或者直接查询数据库
//TODO做成配置 调用接口
// 调用接口
if (LocalFile.Config.IsAccessWMS)
{
#region WMS接口获取物料信息

View File

@ -45,7 +45,7 @@ namespace WCS.BLL.Services.Service
//生成序号
for (int i = 0; i < records.Count; i++)
{
records[i].RowNumber = (request.PageNumber - 1) * 10 + i + 1;
records[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1;
}
//Task.WaitAll(new Task[] { recordsTask, totalCountTask });

View File

@ -23,7 +23,10 @@ namespace WCS.BLL.Services.Service
/// </summary>
public class MatBaseInfoService : IMatBaseInfoService
{
public MatBaseInfoService() { }
public MatBaseInfoService()
{
}
public async Task<PageQueryResponse<MatBaseInfo>> getMatBaseInfo(GetMatBaseInfoRequest request)
{
@ -42,7 +45,7 @@ namespace WCS.BLL.Services.Service
//生成序号
for (int i = 0; i < records.Count; i++)
{
records[i].RowNumber = (request.PageNumber - 1) * 10 + i + 1;
records[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1;
}
return new PageQueryResponse<MatBaseInfo>()
@ -410,8 +413,6 @@ namespace WCS.BLL.Services.Service
}
}
public async Task<PageQueryResponse<MatInfo>> getMatInfo(GetMatInfoRequest request)
{
try
@ -420,6 +421,8 @@ namespace WCS.BLL.Services.Service
.WhereIF(!string.IsNullOrEmpty(request.MatCode), t => t.MatCode.Contains(request.MatCode))
.WhereIF(!string.IsNullOrEmpty(request.MatName), t => t.MatName.Contains(request.MatName))
.WhereIF(!string.IsNullOrEmpty(request.MatSpec), t => t.MatSpec.Contains(request.MatSpec))
.WhereIF(!string.IsNullOrEmpty(request.MatBatch), t => t.MatBatch.Contains(request.MatBatch))
.WhereIF(request.IsPrinted != null, t => t.IsPrinted == request.IsPrinted)
.WhereIF(!string.IsNullOrEmpty(request.MatSN), t => t.MatSn.Contains(request.MatSN));
var totalCount = await recordsQueryable.CountAsync();
var records = await recordsQueryable
@ -428,7 +431,7 @@ namespace WCS.BLL.Services.Service
//生成序号
for (int i = 0; i < records.Count; i++)
{
records[i].RowNumber = (request.PageNumber - 1) * 10 + i + 1;
records[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1;
}
return new PageQueryResponse<MatInfo>()
@ -454,5 +457,51 @@ namespace WCS.BLL.Services.Service
}
}
public async Task<ResponseCommon> printedMatInfo(PrintedMatInfoRequest request)
{
try
{
if (request == null || request.PrintedMatInfoIds == null || request.PrintedMatInfoIds.Count == 0)
{
return new ResponseCommon()
{
Code = 300,
Message = $"操作失败:参数为null",
};
}
DbHelp.db.BeginTran();
//获取打印的具体数据
var matInfos = await DbHelp.db.Queryable<MatInfo>()
.Where(t => request.PrintedMatInfoIds.Contains(t.Id))
.ToListAsync();
//打印次数加一
matInfos.ForEach(matInfo =>
{
matInfo.IsPrinted = true;
matInfo.PrintedTimes = matInfo.PrintedTimes + 1;
});
await DbHelp.db.Updateable(matInfos).ExecuteCommandAsync();
DbHelp.db.CommitTran();
return new ResponseCommon()
{
Code = 200,
Message = $"Success",
};
}
catch (Exception ex)
{
DbHelp.db.RollbackTran();
return new ResponseCommon()
{
Code = 300,
Message = $"操作失败:{ex.Message}",
};
}
}
}
}

View File

@ -47,7 +47,7 @@ namespace WCS.BLL.Services.Service
//生成序号
for (int i = 0; i < records.Count; i++)
{
records[i].RowNumber = (request.PageNumber - 1) * 10 + i + 1;
records[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1;
}
return new PageQueryResponse<InventoryDetail>()

View File

@ -208,7 +208,7 @@ namespace WCS.BLL.Services.Service
//生成序号
for (int i = 0; i < records.Count; i++)
{
records[i].RowNumber = (request.PageNumber - 1) * 10 + i + 1;
records[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1;
}
return new PageQueryResponse<OutOrder>()
@ -378,7 +378,7 @@ namespace WCS.BLL.Services.Service
return new ResponseCommon<List<OutOrderMatDetail>>
{
Code = 200,
Message = "Success",
Message = outOrder.OrderStatus.ToString(),
Data = orderMatDetail
};
}
@ -527,7 +527,7 @@ namespace WCS.BLL.Services.Service
.WhereIF(!string.IsNullOrEmpty(outOrderDetail.MatBatch), t => t.MatBatch == outOrderDetail.MatBatch)
.Where(t => t.IsLocked == false)//未锁定的物料
.OrderBy(t => t.MatBatch)//先进先出
//(t => t.MatQty)//零散料先出
//(t => t.MatQty)//零散料先出
.ToList();
//2.2按照搜索出来的库存和当前未出的数量 计算需要出的SN

View File

@ -345,7 +345,7 @@ namespace WCS.BLL.Services.Service
//生成序号
for (int i = 0; i < records.Count; i++)
{
records[i].RowNumber = (request.PageNumber - 1) * 10 + i + 1;
records[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1;
}
return new PageQueryResponse<StockTakingOrder>()
@ -386,9 +386,6 @@ namespace WCS.BLL.Services.Service
case Model.ApiModel.Stocktaking.StocktakingOrderStatus.:
recordsQueryable = recordsQueryable.Where(t => t.StocktakingOrderStatus == StocktakingOrderStatus.);
break;
case Model.ApiModel.Stocktaking.StocktakingOrderStatus.:
recordsQueryable = recordsQueryable.Where(t => t.StocktakingOrderStatus == StocktakingOrderStatus.);
break;
case Model.ApiModel.Stocktaking.StocktakingOrderStatus.:
recordsQueryable = recordsQueryable.Where(t => t.StocktakingOrderStatus == StocktakingOrderStatus.);
break;
@ -397,7 +394,8 @@ namespace WCS.BLL.Services.Service
}
var records = await recordsQueryable
.OrderByDescending(t => t.CreateTime)
.Where(t => t.StocktakingOrderStatus != StocktakingOrderStatus.)
.OrderByDescending(t => t.UpdateTime)
.Take(40)
.ToListAsync();
@ -507,6 +505,14 @@ namespace WCS.BLL.Services.Service
Message = $"操作失败:不存在单据号为{request.StockTakingOrderNumber}的盘点单!",
};
}
if (order.StocktakingOrderStatus == StocktakingOrderStatus.)
{
return new ResponseCommon()
{
Code = 201,
Message = $"操作失败:盘点单据:{request.StockTakingOrderNumber}已提交!",
};
}
}
else
{
@ -562,6 +568,10 @@ namespace WCS.BLL.Services.Service
shelf.GoInStocktaking(matDetails, order);
shelf.OrderNumber = order.StocktakingOrderNumber;
});
//更新Order
order.UpdateTime = DateTime.Now;
DbHelp.db.Updateable(order).ExecuteCommand();
//返回
return new ResponseCommon()
{
@ -698,16 +708,24 @@ namespace WCS.BLL.Services.Service
};
}
//返回具体的单据信息
var stockTakinbgOrder = await DbHelp.db.Queryable<StockTakingOrderMatDetail>()
var stockTakinOrderMatDetail = await DbHelp.db.Queryable<StockTakingOrderMatDetail>()
.Where(t => t.StocktakingOrderId == stockTakingOrder.Id)
.Where(t => t.MatSN == request.MatSN)
.FirstAsync();
return new ResponseCommon<StockTakingOrderMatDetail>()
{
Code = 200,
Message = "success",
Data = stockTakinbgOrder
};
if (stockTakinOrderMatDetail != null)
return new ResponseCommon<StockTakingOrderMatDetail>()
{
Code = 200,
Message = "success",
Data = stockTakinOrderMatDetail
};
else
return new ResponseCommon<StockTakingOrderMatDetail>()
{
Code = 201,
Message = "不是本次盘点的物料!",
Data = null
};
}
public async Task<ResponseBase> confirmStocktakingOrder(ConfirmStocktakingOrderRequest request)
@ -736,6 +754,8 @@ namespace WCS.BLL.Services.Service
DbHelp.db.Updateable(stockTakingMatDetail)
.ExecuteCommand();
#region
//判断货架是否已进入盘点模式
var shelf = ShelfManager.Shelves
@ -771,6 +791,32 @@ namespace WCS.BLL.Services.Service
#endregion
DbHelp.db.CommitTran();
#region Order状态
Task.Run(() =>
{
//获取Order
var order = DbHelp.db.Queryable<StockTakingOrder>().Where(t => t.Id == stockTakingMatDetail.StocktakingOrderId).First();
if (order != null)
{
var orderDetails = DbHelp.db.Queryable<StockTakingOrderMatDetail>()
.Where(t => t.StocktakingOrderId == stockTakingMatDetail.StocktakingOrderId)
.ToList();
var stocktakedDetailCount = orderDetails.Where(t => t.IsStocktaking).Count();
if (stocktakedDetailCount < orderDetails.Count && order.StocktakingOrderStatus == StocktakingOrderStatus.)
{
order.StocktakingOrderStatus = StocktakingOrderStatus.;
DbHelp.db.Updateable(order).ExecuteCommand();
}
else if (stocktakedDetailCount == orderDetails.Count)
{
order.StocktakingOrderStatus = StocktakingOrderStatus.;
DbHelp.db.Updateable(order).ExecuteCommand();
}
}
});
#endregion
return new ResponseCommon()
{
Code = 200,

View File

@ -36,7 +36,7 @@ namespace WCS.BLL.Services.Service
//生成序号
for (int i = 0; i < records.Count; i++)
{
records[i].RowNumber = (request.PageNumber - 1) * 10 + i + 1;
records[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1;
}
return new PageQueryResponse<ShelfInfo>()
{
@ -236,8 +236,11 @@ namespace WCS.BLL.Services.Service
}
}
async Task<ResponseCommon<object>> IStoreInfoService.GenerateStoreInfo()
/// <summary>
/// TODO HardCode 根据模组信息生成库位
/// </summary>
/// <returns></returns>
public async Task<ResponseCommon<object>> 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();
@ -262,7 +265,93 @@ namespace WCS.BLL.Services.Service
}
});
return new ResponseCommon<object>() { Message = "111"};
return new ResponseCommon<object>() { Message = "111" };
}
#region
public async Task<PageQueryResponse<ModuleInfo>> GetModules(GetModulesRequest request)
{
try
{
var recordsQueryable = DbHelp.db.Queryable<ModuleInfo>()
.WhereIF(!string.IsNullOrEmpty(request.ModuleCode), t => t.ModuleCode.Contains(request.ModuleCode))
.WhereIF(!string.IsNullOrEmpty(request.ShelfCode), t => t.ShelfCode.Contains(request.ShelfCode));
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) * request.PageSize + i + 1;
}
return new PageQueryResponse<ModuleInfo>()
{
Code = 200,
Message = $"success",
Data = new PageQueryResponseData<ModuleInfo>()
{
TotalCount = totalCount,
MaxPage = request.PageSize == 0 ? 0 : (int)Math.Ceiling((decimal)totalCount / request.PageSize),
Count = records.Count,
Lists = records.ToList()
}
};
}
catch (Exception ex)
{
return new PageQueryResponse<ModuleInfo>()
{
Code = 300,
Message = $"操作失败:{ex.Message}",
};
}
}
#endregion
#region
public async Task<PageQueryResponse<StoreInfo>> GetStores(GetStoresRequest request)
{
try
{
var recordsQueryable = DbHelp.db.Queryable<StoreInfo>()
.WhereIF(!string.IsNullOrEmpty(request.ShelfCode), t => t.ShelfCode.Contains(request.ShelfCode))
.WhereIF(!string.IsNullOrEmpty(request.ModuleCode), t => t.ModuleCode.Contains(request.ModuleCode))
.WhereIF(!string.IsNullOrEmpty(request.StoreCode), t => t.StoreCode.Contains(request.StoreCode))
.WhereIF(!string.IsNullOrEmpty(request.CurrentMatSN), t => t.CurrentMatSn.Contains(request.CurrentMatSN))
;
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) * request.PageSize + i + 1;
}
return new PageQueryResponse<StoreInfo>()
{
Code = 200,
Message = $"success",
Data = new PageQueryResponseData<StoreInfo>()
{
TotalCount = totalCount,
MaxPage = request.PageSize == 0 ? 0 : (int)Math.Ceiling((decimal)totalCount / request.PageSize),
Count = records.Count,
Lists = records.ToList()
}
};
}
catch (Exception ex)
{
return new PageQueryResponse<StoreInfo>()
{
Code = 300,
Message = $"操作失败:{ex.Message}",
};
}
}
#endregion
}
}

View File

@ -17,6 +17,9 @@ namespace WCS.BLL
public bool IsOnline { get; set; } = false;
//第一次连接是否已连接
public bool IsFirstConnected { get; set; } = false;
//can模块协议前缀
public readonly byte[] Prefix = new byte[] { 0x08, 0x00, 0x00 };
//can模块协议前缀长度
@ -76,7 +79,6 @@ namespace WCS.BLL
tcpClient.Received += (client, e) =>
{
var data = e.ByteBlock.Buffer.Take((int)e.ByteBlock.Length).ToArray();
//e.ByteBlock.Clear();
Logs.Write($"校验发送接收,收到数据" + BitConverter.ToString(data));
var len = data.Length;
for (int index = 0; index < data.Length - PreFixLength; index++)
@ -106,7 +108,7 @@ namespace WCS.BLL
}
Logs.Write($"校验发送接收处理完毕" + BitConverter.ToString(data));
return null;
};
tcpClient.Connected += (client, e) =>
@ -114,7 +116,7 @@ namespace WCS.BLL
this.IsOnline = true;
return EasyTask.CompletedTask;
};
tcpClient.Disconnected += (client, e) =>
{
this.IsOnline = false;
@ -128,12 +130,12 @@ namespace WCS.BLL
{
try
{
//TODO如果指令未回应n次 则取消重发
//TODO如果指令已发两次 则取消重发
Console.WriteLine(Thread.CurrentThread.ManagedThreadId);
await Task.Delay(100);
if (MessageList.Count > 0)
{
var failedMessage = MessageList.Where(t => t.Value.SendTimes >= 3).ToList();
var failedMessage = MessageList.Where(t => t.Value.SendTimes >= 2).ToList();
foreach (var message in failedMessage)
{
Logs.Write(BitConverter.ToString(message.Value.Message) +
@ -152,15 +154,12 @@ namespace WCS.BLL
await Task.Delay(10);
}
}
}
}
catch
{
}
}
});
}
catch (Exception ex)

View File

@ -13,5 +13,9 @@ namespace WCS.Model.ApiModel.MatBaseInfo
public string MatSpec { get; set; }
public string MatSN { get; set; }
public string MatBatch { get; set; }
public bool? IsPrinted { get; set; }
}
}

View File

@ -30,6 +30,8 @@ namespace WCS.Model.ApiModel.MatBaseInfo
public bool IsPrinted { get; set; }
public int PrintedTimes { get; set; }
public string? ModifyUser { get; set; }
public DateTime? ModifyTime { get; set; } = DateTime.Now;

View File

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WCS.Model.ApiModel.MatBaseInfo
{
public class PrintedMatInfoRequest : RequestBase
{
public List<int> PrintedMatInfoIds { get; set; }
}
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WCS.Model.ApiModel.StoreInfo
{
public class GetModulesRequest : PageQueryRequestBase
{
public string ShelfCode { get; set; }
public string ModuleCode { get; set; }
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WCS.Model.ApiModel.StoreInfo
{
public class GetStoresRequest : PageQueryRequestBase
{
public string ShelfCode { get; set; }
public string ModuleCode { get; set; }
public string StoreCode { get; set; }
public string CurrentMatSN { get; set; }
}
}

View File

@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
namespace WCS.Model.ApiModel.StoreInfo
{
public class ModuleInfoModel : INotifyPropertyChanged
{
public int Id { get; set; }
public string ModuleCode { get; set; }
public int ShelfId { get; set; }
public string ShelfCode { get; set; }
public int BoardId { get; set; }
public int LightCount { get; set; }
public string CleintIp { get; set; }
public string R { get; set; }
public string C { get; set; }
public string? Bigshelfcode { get; set; }
public bool IsEnable { get; set; }
//public Mode CurrentMode { get; set; } = Mode.待机模式;
public int RowNumber { get; set; }
public bool IsSelected
{
get { return isSelected; }
set
{
isSelected = value;
OnPropertyChanged(nameof(IsSelected));
}
}
public bool isSelected;
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}

View File

@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
namespace WCS.Model.ApiModel.StoreInfo
{
public class StoreInfoModel : INotifyPropertyChanged
{
public int Id { get; set; }
public string StoreCode { get; set; }
public int ModuleId { get; set; }
public string ModuleCode { get; set; }
public int ShelfId { get; set; }
public string ShelfCode { get; set; }
public int BoardId { get; set; }
public int LightNumber { get; set; }
public int Priority { get; set; }
public string CurrentMatSn { get; set; }
public decimal CurrentVoltage { get; set; }
public decimal StandardVoltage { get; set; }
public decimal OffsetVoltage { get; set; }
public int RowNumber { get; set; }
public bool IsSelected
{
get { return isSelected; }
set
{
isSelected = value;
OnPropertyChanged(nameof(IsSelected));
}
}
public bool isSelected;
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}

View File

@ -122,5 +122,17 @@ namespace WCS.WebApi.Controllers
{
return await _matBaseInfoService.getMatInfo(request);
}
/// <summary>
/// 打印物料条码后上传打印
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("printedMatInfo")]
[HttpPost(Name = "printedMatInfo")]
public async Task<ResponseBase> printedMatInfo(PrintedMatInfoRequest request)
{
return await _matBaseInfoService.printedMatInfo(request);
}
}
}

View File

@ -11,7 +11,7 @@ using WCS.DAL.DbModels;
namespace WCS.WebApi.Controllers
{
/// <summary>
/// 货架\、库位管理的页面
/// 货架管理、模组管理、库位管理的接口
/// </summary>
[ApiController]
[Route("[controller]")]
@ -23,6 +23,7 @@ namespace WCS.WebApi.Controllers
_storeInfoService = storeInfoService;
}
#region
[Route("getShelves")]
[HttpPost(Name = "getShelves")]
public async Task<ResponseBase> getShelves(GetShelvesRequest request)
@ -41,5 +42,25 @@ namespace WCS.WebApi.Controllers
{
return await _storeInfoService.GenerateStoreInfo();
}
#endregion
#region
[Route("getModules")]
[HttpPost(Name = "getModules")]
public async Task<ResponseBase> getModules(GetModulesRequest request)
{
return await _storeInfoService.GetModules(request);
}
#endregion
#region
[Route("getStores")]
[HttpPost(Name = "getStores")]
public async Task<ResponseBase> getStores(GetStoresRequest request)
{
return await _storeInfoService.GetStores(request);
}
#endregion
}
}

View File

@ -32,7 +32,7 @@ namespace WebApi
ShelfManager.InitShelves();
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD>ƺͰ<C6BA><CDB0><EFBFBD>
TCPClientManager.InitStatus();
//TCPClientManager.InitStatus();
WarningManager.StartWarningMessageThread();

View File

@ -270,7 +270,15 @@ namespace 货架标准上位机.Api
}
}
/// <summary>
/// 调用接口超时时间10s
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="url"></param>
/// <param name="dataObj"></param>
/// <param name="httpMethod"></param>
/// <param name="isSaveLog"></param>
/// <returns></returns>
public static T GetDataFromHttp<T>(string url, object dataObj, string httpMethod, bool isSaveLog = false)
{
Guid guid = Guid.NewGuid();

View File

@ -17,6 +17,7 @@ namespace 货架标准上位机
= 2000,
= 3000,
= 4000,
= 5000,
}
public class EnumTreeAttribute : Attribute

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

@ -51,7 +51,7 @@ namespace 货架标准上位机.ViewModel
if (newBytes > 0)
{
var currentScanedCode = Encoding.UTF8.GetString(e.ByteBlock, 0, e.ByteBlock.Len);
Logs.Write($"接收到扫码枪扫码数据{currentScanedCode}");
Logs.Write($"接收到扫码枪[{scanner.COM}]扫码数据{currentScanedCode}", LogsType.Scanner);
scanner.TempCode += currentScanedCode;
//校验末尾码
CheckDataCompleteness(scanner);
@ -88,11 +88,18 @@ namespace 货架标准上位机.ViewModel
var isModuleCode = Regex.IsMatch(scanner.TempCode, ModuleCodePattern);
if (isModuleCode)
{
Logs.Write($"[{scanner.COM}]校验到扫码数据为货架码【{scanner.TempCode}】", LogsType.Scanner);
ModuleCodeProcess(scanner);
}
else if (scanner.TempCode == "shelfGoOutInStore")
{
Logs.Write($"[{scanner.COM}]校验到扫码数据为结束入库码【{scanner.TempCode}】", LogsType.Scanner);
ShelfGoOutInstoreProcess(scanner);
}
//TODO 增加正则表达式进行判断是否扫到的是物料码
else
{
Logs.Write($"[{scanner.COM}]校验到扫码数据为物料码【{scanner.TempCode}】", LogsType.Scanner);
MatSnProcess(scanner);
}
}
@ -118,13 +125,15 @@ namespace 货架标准上位机.ViewModel
//如果扫码枪前一个货架未退出入库
if (scanner.IsInstoreMode)
{
//判断当前入库货架是否包含本次扫码的模组
//判断当前入库货架是否包含本次扫码的模组 表示用户重复对货架码进行扫码 不能让其多次进入入库
if (scanner.ModulesStr.Contains(scanner.TempCode))
{
Logs.Write($"当前扫码模组{scanner.TempCode},是当前入库货架{scanner.ShelfCode}的模组,不进行操作!", LogsType.Scanner);
return;
}
else
{
Logs.Write($"当前扫码模组{scanner.TempCode},不是当前入库货架{scanner.ShelfCode}的模组,先进行当前入库货架的退出入库操作!", LogsType.Scanner);
#region
try
{
@ -135,26 +144,32 @@ namespace 货架标准上位机.ViewModel
DeviceType = LocalFile.Config.DeviceType,
UserName = LocalStatic.CurrentUser,
};
var Result = ApiHelp.GetDataFromHttp<ResponseBase>(LocalFile.Config.ApiIpHost + "instore/shelfGoOutInStore", body, "POST");
var Result = ApiHelp.GetDataFromHttp<ResponseBase>(LocalFile.Config.ApiIpHost + "instore/shelfGoOutInStore", body, "POST", true);
if (Result != null && Result.Code == 200)
{
Logs.Write($"货架{scanner.ShelfCode}已成功退出入库!", LogsType.Scanner);
scanner.ShelfCode = string.Empty;
scanner.ModulesStr = string.Empty;
}
else
{
Logs.Write($"货架{scanner.ShelfCode}退出入库失败!", LogsType.Scanner);
return;
}
}
catch (Exception ex)
{
Logs.Write($"货架{scanner.ShelfCode}退出入库失败!发生异常:{ex.Message}", LogsType.Scanner);
}
#endregion
}
}
//调用接口 请求进入入库模式
//调用接口 本次扫码的货架进入入库模式
#region
try
{
Logs.Write($"扫码模组{scanner.TempCode},请求进入入库!", LogsType.Scanner);
var body = new ShelfGoInInstoreRequest()
{
ModuleCode = scanner.TempCode,
@ -165,20 +180,25 @@ namespace 货架标准上位机.ViewModel
var Result = ApiHelp.GetDataFromHttp<ShelfGoInInstoreResponse>(LocalFile.Config.ApiIpHost + "instore/shelfGoInInStore", body, "POST");
if (Result != null && Result.Code == 200)
{
Logs.Write($"扫码模组{scanner.TempCode},进入入库模式成功!", LogsType.Scanner);
scanner.IsInstoreMode = true;
scanner.ShelfCode = Result.Data.ShelfCode;
scanner.ModulesStr = Result.Data.ModulesStr;
//TODO 清除其他扫码枪的占用
//清除其他扫码枪的占用
var sacnners = ScannerManager.Scanners
.Where(t => ShelfCode == Result.Data.ShelfCode)
.Where(t => t.COM != scanner.COM)
.ToList();
foreach (var item in sacnners)
foreach (var scanner1 in sacnners)
{
item.ShelfCode = string.Empty;
scanner1.ShelfCode = string.Empty;
scanner1.ModulesStr = string.Empty;
}
}
else if (Result != null && !string.IsNullOrEmpty(Result.Message))
{
Logs.Write($"扫码模组{scanner.TempCode},进入入库模式失败!{Result.Message}", LogsType.Scanner);
Growl.Warning(Result.Message);
}
}
@ -189,6 +209,36 @@ namespace 货架标准上位机.ViewModel
#endregion
}
/// <summary>
/// 扫码枪扫到结束码
/// </summary>
/// <param name="scanner"></param>
public void ShelfGoOutInstoreProcess(Scanner scanner)
{
#region
try
{
var body = new ShelfGoOutInStoreRequest()
{
ShelfCode = scanner.ShelfCode,
IPAdress = scanner.COM,
DeviceType = LocalFile.Config.DeviceType,
UserName = LocalStatic.CurrentUser,
};
var Result = ApiHelp.GetDataFromHttp<ResponseBase>(LocalFile.Config.ApiIpHost + "instore/shelfGoOutInStore", body, "POST");
if (Result != null && Result.Code == 200)
{
scanner.ShelfCode = string.Empty;
scanner.ModulesStr = string.Empty;
}
}
catch (Exception ex)
{
}
#endregion
}
/// <summary>
/// 扫到物料码的数据处理
/// </summary>

View File

@ -243,7 +243,7 @@ namespace 货架标准上位机.ViewModel
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10,
PageSize = PageSize,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<InOutRecordModel>>(LocalFile.Config.ApiIpHost + "inOutRecord/getInOutRecord", body, "POST");
if (Result != null && Result.Data != null && Result.Data.Lists != null)
@ -293,7 +293,7 @@ namespace 货架标准上位机.ViewModel
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10,
PageSize = 65535,
};
await ApiHelp.PostDownloadFileAsync(path, System.Net.Http.HttpMethod.Post, LocalFile.Config.ApiIpHost + "inOutRecord/exportInOutRecord", body);
Growl.Success("导出成功!");
@ -334,6 +334,14 @@ namespace 货架标准上位机.ViewModel
set { SetProperty(ref totalCount, value); }
}
private int pageSize = 10;
public int PageSize
{
get => pageSize;
set { SetProperty(ref pageSize, value); }
}
public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); }
public void BtnFirstPage()
{

View File

@ -157,7 +157,7 @@ namespace 货架标准上位机.ViewModel
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10,
PageSize = PageSize,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<SystemApiLogModel>>(LocalFile.Config.ApiIpHost + "interfaceRecord/getInterfaceRecord", body, "POST");
@ -211,7 +211,7 @@ namespace 货架标准上位机.ViewModel
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10,
PageSize = 65535,
};
await ApiHelp.PostDownloadFileAsync(path, System.Net.Http.HttpMethod.Post, LocalFile.Config.ApiIpHost + "interfaceRecord/exportInterfaceRecord", body);
@ -251,6 +251,14 @@ namespace 货架标准上位机.ViewModel
set { SetProperty(ref totalCount, value); }
}
private int pageSize = 10;
public int PageSize
{
get => pageSize;
set { SetProperty(ref pageSize, value); }
}
public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); }
public void BtnFirstPage()
{

View File

@ -142,7 +142,7 @@ namespace 货架标准上位机.ViewModel
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10,
PageSize = PageSize,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<MatBaseInfoModel>>(LocalFile.Config.ApiIpHost + "matBaseInfo/getMatBaseInfo", body, "POST");
@ -163,8 +163,6 @@ namespace 货架标准上位机.ViewModel
dia.Close();
}
#endregion
}
/// <summary>
@ -173,7 +171,6 @@ namespace 货架标准上位机.ViewModel
public ICommand BtnExportCommand { get => new DelegateCommand(BtnExport); }
public async void BtnExport()
{
try
{
#region
@ -199,7 +196,7 @@ namespace 货架标准上位机.ViewModel
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10,
PageSize = 65535,
};
await ApiHelp.PostDownloadFileAsync(path, System.Net.Http.HttpMethod.Post, LocalFile.Config.ApiIpHost + "matBaseInfo/exportMatBaseInfo", body);
Growl.Success("导出成功!");
@ -240,7 +237,7 @@ namespace 货架标准上位机.ViewModel
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10,
PageSize = 65535,
};
var result = await ApiHelp.PostImportFileAsync<ResponseCommon<List<string>>>(path, System.Net.Http.HttpMethod.Post,
LocalFile.Config.ApiIpHost + "matBaseInfo/importMatBaseInfo", LocalStatic.CurrentUser, LocalFile.Config.DeviceType);
@ -256,7 +253,6 @@ namespace 货架标准上位机.ViewModel
else
HandyControl.Controls.MessageBox.Show(result.Message);
}
}
catch (Exception ex)
{
@ -295,7 +291,6 @@ namespace 货架标准上位机.ViewModel
else
{
Growl.Error($"{Result?.Message?.ToString()}");
//BtnAdd();
}
}
}
@ -430,6 +425,14 @@ namespace 货架标准上位机.ViewModel
set { SetProperty(ref totalCount, value); }
}
private int pageSize = 10;
public int PageSize
{
get => pageSize;
set { SetProperty(ref pageSize, value); }
}
public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); }
public void BtnFirstPage()
{

View File

@ -26,11 +26,22 @@ using WCS.Model.ApiModel.MatBaseInfo;
using System.Collections.ObjectModel;
using HandyControl.Tools.Extension;
using .Tool;
using System.Printing;
using System.Printing.IndexedProperties;
namespace .ViewModel
{
public class MatInfoViewModel : BindableBase
{
public MatInfoViewModel()
{
IsPrintedItemSource = new List<ComboBoxItem>()
{
new ComboBoxItem(){Text = "全部",Value = null},
new ComboBoxItem(){Text = "否",Value = false },
new ComboBoxItem(){Text = "是",Value = true},
};
}
#region Property
private ObservableCollection<MatInfoModel> dataGridItemSource;
public ObservableCollection<MatInfoModel> DataGridItemSource
@ -52,6 +63,35 @@ namespace 货架标准上位机.ViewModel
}
}
private List<ComboBoxItem> isPrintedItemSource;
public List<ComboBoxItem> IsPrintedItemSource
{
get => isPrintedItemSource;
set { SetProperty(ref isPrintedItemSource, value); }
}
public class ComboBoxItem
{
public string Text { get; set; }
public bool? Value { get; set; }
}
private bool? isPrinted;
public bool? IsPrinted
{
get => isPrinted;
set { SetProperty(ref isPrinted, value); }
}
private string matBatch;
public string MatBatch
{
get => matBatch;
set { SetProperty(ref matBatch, value); }
}
/// <summary>
/// 物料编码
/// </summary>
@ -125,7 +165,6 @@ namespace 货架标准上位机.ViewModel
return;
}
#region
//var dia = Dialog.Show(new TextDialog());
try
{
var body = new GetMatInfoRequest()
@ -134,11 +173,13 @@ namespace 货架标准上位机.ViewModel
MatName = MatName,
MatSpec = MatSpec,
MatSN = MatSN,
MatBatch = MatBatch,
IsPrinted = IsPrinted,
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10,
PageSize = PageSize,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<MatInfoModel>>(LocalFile.Config.ApiIpHost + "matBaseInfo/getMatInfo", body, "POST");
@ -166,7 +207,7 @@ namespace 货架标准上位机.ViewModel
public ICommand BtnDeleteCommand { get => new DelegateCommand(BtnDelete); }
public async void BtnDelete()
{
Growl.Ask($"是否删除所有勾选数据]!", isConfirmed =>
Growl.Ask($"是否删除所有勾选数据]!", isConfirmed =>
{
if (isConfirmed)
{
@ -187,7 +228,7 @@ namespace 货架标准上位机.ViewModel
DeviceType = LocalFile.Config.DeviceType,
MatBaseInfoIds = matBaseInfoIds,
};
var Result = ApiHelp.GetDataFromHttp<ResponseBase<UserModel>>(LocalFile.Config.ApiIpHost + "matBaseInfo/deleteMatBaseInfo", body, "POST");
var Result = ApiHelp.GetDataFromHttp<ResponseBase<UserModel>>(LocalFile.Config.ApiIpHost + "matBaseInfos/deleteMatBaseInfo", body, "POST");
if (Result != null && Result.Code == 200)
{
CurrentPage = 1;
@ -204,10 +245,99 @@ namespace 货架标准上位机.ViewModel
}
public ICommand BtnPrintCommand { get => new DelegateCommand(BtnPrint); }
public async void BtnPrint()
public void BtnPrint()
{
var matBaseInfo = DataGridItemSource?.Where(t => t.IsSelected == true).ToList();
//TO DO后台批量打印
var matBaseInfos = DataGridItemSource?.Where(t => t.IsSelected == true).ToList();
if (matBaseInfos == null || matBaseInfos.Count == 0)
{
Growl.Warning("请选择需要打印的物料!");
return;
}
//重复打印提示
#region
var printedMatBaseInfo = matBaseInfos.Where(t => t.IsPrinted).ToList();
if (printedMatBaseInfo != null && printedMatBaseInfo.Count > 0)
{
//拼接提示字符串
var messageStr = "以下条码已打印:\r\n" +
string.Join("\r\n", printedMatBaseInfo.Select(t => $"[{t.MatSN}]已打印{t.PrintedTimes}次!").ToList())
+ "\r\n\r\n是否继续打印(重复打印可能造成条码重复)";
var result = HandyControl.Controls.MessageBox.Show(messageStr, "重复打印提示", MessageBoxButton.OKCancel);
if (result == MessageBoxResult.Cancel)
{
return;
}
}
#endregion
//批量打印
Task.Run(() =>
{
try
{
ProcessDialog process = null;
Dialog dia = null;
var totalCount = matBaseInfos.Count();
int currentCount = 0;
App.Current.Dispatcher.Invoke(() =>
{
process = new ProcessDialog();
dia = Dialog.Show(process);
});
matBaseInfos.ForEach(t =>
{
PrintTender.PrintTag(new PrintClass()
{
MatSn = t.MatSN,
MatName = t.MatName,
MatCode = t.MatCode,
MatBatch = t.MatBatch,
MatQty = t.MatQty.ToString(),
MatSpec = t.MatSpec,
});
currentCount++;
if (process != null)
process.viewModel.ProcessValue = Convert.ToInt32(((decimal)currentCount / totalCount) * 100);
});
App.Current.Dispatcher.Invoke(() =>
{
dia.Close();
dia.Collapse();
});
#region
try
{
var body = new PrintedMatInfoRequest()
{
PrintedMatInfoIds = matBaseInfos.Select(t => t.Id).ToList(),
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
};
var Result = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "matBaseInfo/printedMatInfo", body, "POST");
if (Result != null && Result.Code == 200)
{
//回传成功
}
else
{
//回传失败
}
}
catch (Exception ex)
{
Logs.Write("回传“打印成功”失败:" + ex.Message);
}
#endregion
}
catch (Exception ex)
{
Logs.Write("打印条码失败:" + ex.Message);
}
});
}
#endregion
@ -238,6 +368,14 @@ namespace 货架标准上位机.ViewModel
set { SetProperty(ref totalCount, value); }
}
private int pageSize = 10;
public int PageSize
{
get => pageSize;
set { SetProperty(ref pageSize, value); }
}
public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); }
public void BtnFirstPage()
{

View File

@ -220,7 +220,7 @@ namespace 货架标准上位机.ViewModel
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10,
PageSize = PageSize,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<MatInventoryDetailModel>>(LocalFile.Config.ApiIpHost + "matInventoryDetail/getMatInventoryDetail", body, "POST");
if (Result != null && Result.Data != null && Result.Data.Lists != null)
@ -270,7 +270,7 @@ namespace 货架标准上位机.ViewModel
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10,
PageSize = 65535,
};
await ApiHelp.PostDownloadFileAsync(path, System.Net.Http.HttpMethod.Post, LocalFile.Config.ApiIpHost + "matInventoryDetail/exportMatInventoryDetail", body);
Growl.Success("导出成功!");
@ -301,7 +301,7 @@ namespace 货架标准上位机.ViewModel
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = 1,
PageSize = 10000,
PageSize = 65535,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<MatInventoryDetailModel>>(LocalFile.Config.ApiIpHost + "matInventoryDetail/getMatInventoryDetail", body, "POST");
if (Result != null && Result.Data != null && Result.Data.Lists != null)
@ -399,7 +399,7 @@ namespace 货架标准上位机.ViewModel
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10000,
PageSize = 65535,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<MatInventoryDetailModel>>(LocalFile.Config.ApiIpHost + "matInventoryDetail/getMatInventoryDetail", body, "POST");
if (Result != null && Result.Data != null && Result.Data.Lists != null)
@ -506,6 +506,14 @@ namespace 货架标准上位机.ViewModel
set { SetProperty(ref totalCount, value); }
}
private int pageSize = 10;
public int PageSize
{
get => pageSize;
set { SetProperty(ref pageSize, value); }
}
public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); }
public void BtnFirstPage()
{

View File

@ -0,0 +1,228 @@
using HandyControl.Controls;
using MiniExcelLibs;
using Ping9719.WpfEx.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Input;
using .Views.Controls;
using .Api;
using WCS.Model;
using WCS.Model.ApiModel.Home;
using WCS.Model.ApiModel.StoreInfo;
using WCS.BLL.DbModels;
using WCS.Model.ApiModel.MatBaseInfo;
using WCS.Model.ApiModel.User;
using WCS.Model.ApiModel;
using Newtonsoft.Json.Bson;
namespace .ViewModel
{
public class ModuleInfoViewModel : BindableBase
{
public ModuleInfoViewModel()
{
}
#region Property
private List<ModuleInfoModel> dataGridItemSource;
public List<ModuleInfoModel> DataGridItemSource
{
get { return dataGridItemSource; }
set
{
SetProperty(ref dataGridItemSource, value);
}
}
private ModuleInfoModel selectedataGridItem;
public ModuleInfoModel SelectedataGridItem
{
get { return selectedataGridItem; }
set
{
SetProperty(ref selectedataGridItem, value);
}
}
private string shelfCode;
public string ShelfCode
{
get { return shelfCode; }
set
{
SetProperty(ref shelfCode, value);
}
}
private string moduleCode;
public string ModuleCode
{
get => moduleCode;
set { SetProperty(ref moduleCode, value); }
}
#endregion
#region Command
public ICommand BtnResetCommand { get => new DelegateCommand(BtnReset); }
public void BtnReset()
{
ModuleCode = string.Empty;
ShelfCode = string.Empty;
}
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
var dia = Dialog.Show(new TextDialog());
try
{
var body = new GetShelvesRequest()
{
ShelfCode = ShelfCode,
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = PageSize,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<ModuleInfoModel>>(LocalFile.Config.ApiIpHost + "storeInfo/getModules", body, "POST");
if (Result != null && Result.Data != null && Result.Data.Lists != null)
{
DataGridItemSource = Result.Data.Lists;
MaxPage = Result.Data.MaxPage;
TotalCount = Result.Data.TotalCount;
}
}
catch (Exception ex)
{
Growl.Error("加载数据失败:" + ex.Message);
}
finally
{
dia.Close();
}
#endregion
}
public ICommand BtnDeleteCommand { get => new DelegateCommand(BtnDelete); }
public void BtnDelete()
{
//查询勾选的第一个数据
var shelfInfo = DataGridItemSource?.Where(t => t.IsSelected == true).FirstOrDefault();
if (shelfInfo == null)
{
Growl.Warning("请选择需要删除的数据!");
}
else
{
var body = new AddShelfInfoRequest<ShelfInfoModel>()
{
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
//ShelfInfo = shelfInfo,
AddOrUpdate = AddOrUpdate.Delete
};
var Result = ApiHelp.GetDataFromHttp<ResponseBase<object>>(LocalFile.Config.ApiIpHost + "storeInfo/addOrUpdateShelfInfo", body, "POST");
if (Result != null && Result.Code == 200)
{
Growl.Success("删除成功!");
CurrentPage = 1;
}
else
{
Growl.Error($"{Result?.Message?.ToString()}");
}
}
}
#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); }
}
private int pageSize = 10;
public int PageSize
{
get => pageSize;
set { SetProperty(ref pageSize, 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
}
}

View File

@ -100,7 +100,7 @@ namespace 货架标准上位机.ViewModels
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10,
PageSize = PageSize,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<OutOrderModel>>(LocalFile.Config.ApiIpHost + "outStore/GetOutOrderList", body, "POST");
if (Result != null && Result.Data != null && Result.Data.Lists != null)
@ -412,6 +412,14 @@ namespace 货架标准上位机.ViewModels
set { SetProperty(ref totalCount, value); }
}
private int pageSize = 10;
public int PageSize
{
get => pageSize;
set { SetProperty(ref pageSize, value); }
}
public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); }
public void BtnFirstPage()
{
@ -445,5 +453,6 @@ namespace 货架标准上位机.ViewModels
}
}
#endregion
}
}

View File

@ -278,6 +278,7 @@ namespace 货架标准上位机.ViewModel
if (Result.Data.Count > 0)
{
DataGridItemSource = new ObservableCollection<OutOrderMatDetailModel>(Result.Data);
OrderStatus = Result.Message;
}
else
{
@ -285,7 +286,6 @@ namespace 货架标准上位机.ViewModel
{
DataGridItemSource?.Clear();
});
Growl.Warning("该单据未查询到发料明细!");
}
}

View File

@ -135,7 +135,7 @@ namespace 货架标准上位机.ViewModel
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10,
PageSize = PageSize,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<ShelfInfoModel>>(LocalFile.Config.ApiIpHost + "storeInfo/getShelves", body, "POST");
if (Result != null && Result.Data != null && Result.Data.Lists != null)
@ -250,6 +250,14 @@ namespace 货架标准上位机.ViewModel
set { SetProperty(ref totalCount, value); }
}
private int pageSize = 10;
public int PageSize
{
get => pageSize;
set { SetProperty(ref pageSize, value); }
}
public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); }
public void BtnFirstPage()
{

View File

@ -101,7 +101,7 @@ namespace 货架标准上位机.ViewModels
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10,
PageSize = PageSize,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<StockTakingOrderModel>>(LocalFile.Config.ApiIpHost + "stockTaking/getStockTakingOrders", body, "POST");
if (Result != null && Result.Data != null && Result.Data.Lists != null)
@ -398,6 +398,7 @@ namespace 货架标准上位机.ViewModels
{
Growl.Warning("单据已提交,库存数据已修改!");
BtnSearch();
StockTakingView.viewModel.RefreshStockTakingOrderList(StockTakingView.viewModel.SelectedOutOrderNumber);
}
else if (Result != null)
{
@ -419,6 +420,7 @@ namespace 货架标准上位机.ViewModels
}
#endregion
#region PageOperation
private int currentPage;
public int CurrentPage
@ -446,6 +448,14 @@ namespace 货架标准上位机.ViewModels
set { SetProperty(ref totalCount, value); }
}
private int pageSize = 10;
public int PageSize
{
get => pageSize;
set { SetProperty(ref pageSize, value); }
}
public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); }
public void BtnFirstPage()
{

View File

@ -232,6 +232,10 @@ namespace 货架标准上位机.ViewModel
{
SelectedOutOrder = OutOrderList.Where(t => t.StocktakingOrderNumber == OrderNumber).FirstOrDefault();
}
else
{
SelectedOutOrder = OutOrderList.FirstOrDefault(); ;
}
}
else if (Result != null && !string.IsNullOrEmpty(Result.Message))
{

View File

@ -0,0 +1,214 @@
using HandyControl.Controls;
using MiniExcelLibs;
using Ping9719.WpfEx.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Input;
using .Views.Controls;
using .Api;
using WCS.Model;
using WCS.Model.ApiModel.Home;
using WCS.Model.ApiModel.StoreInfo;
using WCS.BLL.DbModels;
using WCS.Model.ApiModel.MatBaseInfo;
using WCS.Model.ApiModel.User;
using WCS.Model.ApiModel;
using Newtonsoft.Json.Bson;
namespace .ViewModel
{
public class StoreInfoViewModel : BindableBase
{
public StoreInfoViewModel()
{
}
#region Property
private List<StoreInfoModel> dataGridItemSource;
public List<StoreInfoModel> DataGridItemSource
{
get { return dataGridItemSource; }
set
{
SetProperty(ref dataGridItemSource, value);
}
}
private StoreInfoModel selectedataGridItem;
public StoreInfoModel SelectedataGridItem
{
get { return selectedataGridItem; }
set
{
SetProperty(ref selectedataGridItem, value);
}
}
private string shelfCode;
public string ShelfCode
{
get { return shelfCode; }
set
{
SetProperty(ref shelfCode, value);
}
}
private string moduleCode;
public string ModuleCode
{
get => moduleCode;
set { SetProperty(ref moduleCode, value); }
}
private string storeCode;
public string StoreCode
{
get => storeCode;
set { SetProperty(ref storeCode, value); }
}
private string currentMatSN;
public string CurrentMatSN
{
get => currentMatSN;
set { SetProperty(ref currentMatSN, value); }
}
#endregion
#region Command
public ICommand BtnResetCommand { get => new DelegateCommand(BtnReset); }
public void BtnReset()
{
ShelfCode = string.Empty;
ModuleCode = string.Empty;
StoreCode = string.Empty;
CurrentMatSN = string.Empty;
}
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
var dia = Dialog.Show(new TextDialog());
try
{
var body = new GetStoresRequest()
{
ShelfCode = ShelfCode,
ModuleCode = ModuleCode,
StoreCode = StoreCode,
CurrentMatSN = CurrentMatSN,
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = PageSize,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<StoreInfoModel>>(LocalFile.Config.ApiIpHost + "storeInfo/getStores", body, "POST");
if (Result != null && Result.Data != null && Result.Data.Lists != null)
{
DataGridItemSource = Result.Data.Lists;
MaxPage = Result.Data.MaxPage;
TotalCount = Result.Data.TotalCount;
}
}
catch (Exception ex)
{
Growl.Error("加载数据失败:" + ex.Message);
}
finally
{
dia.Close();
}
#endregion
}
#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); }
}
private int pageSize = 10;
public int PageSize
{
get => pageSize;
set { SetProperty(ref pageSize, 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
}
}

View File

@ -0,0 +1,16 @@
<Border x:Class="货架标准上位机.Views.Controls.ProcessDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hc="https://handyorg.github.io/handycontrol"
CornerRadius="10"
Width="300"
Height="186"
Background="{DynamicResource RegionBrush}">
<hc:SimplePanel>
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
<ProgressBar Style="{StaticResource ProgressBarSuccess}" Value="{Binding ProcessValue}" Width="200"/>
<TextBlock Text="正在打印,请稍候..." FontSize="20" TextAlignment="Center"></TextBlock>
</StackPanel>
<Button Width="22" Height="22" Command="hc:ControlCommands.Close" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource PrimaryBrush}" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,4,4,0"/>
</hc:SimplePanel>
</Border>

View File

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
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.Navigation;
using System.Windows.Shapes;
namespace .Views.Controls
{
/// <summary>
/// TextDialog.xaml 的交互逻辑
/// </summary>
public partial class ProcessDialog
{
public ProcessDialogViewModel viewModel = new ProcessDialogViewModel();
public ProcessDialog()
{
InitializeComponent();
this.DataContext = viewModel;
}
}
}

View File

@ -0,0 +1,20 @@
using Ping9719.WpfEx.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace .Views.Controls
{
public class ProcessDialogViewModel : BindableBase
{
private int processValue;
public int ProcessValue
{
get => processValue;
set { SetProperty(ref processValue, value); }
}
}
}

View File

@ -34,7 +34,7 @@
hc:BorderElement.CornerRadius="15"
MinHeight="40"
FontSize="20"
Content="&#xe61b;结束入库"
Content="&#xe61b;结束入库"
FontFamily="{StaticResource IconFont}"
Command="{Binding BtnEndCommand}">
</Button>
@ -50,19 +50,10 @@
<Border Grid.Row="2" Margin="5,5,5,5" BorderThickness="1" Background="White" BorderBrush="DodgerBlue" CornerRadius="3">
<Grid>
<Grid.ColumnDefinitions>
<!--<ColumnDefinition Width="2*"></ColumnDefinition>-->
<ColumnDefinition Width="3*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!--<GroupBox Grid.Column="0" Background="White" Padding="0" Style="{StaticResource GroupBoxTab}" Margin="0,5,5,5" >
<GroupBox.Header>
<Grid Width="{Binding ActualWidth,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type GroupBox}}}">
<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}">&#xe652; 清空</Button>
</Grid>
</GroupBox.Header>
<pi:TextBoxLog Token="InstoreWarning" Style="{StaticResource TextBoxExtend.Multi}" Margin="-1" hc:InfoElement.Placeholder="没有日志信息" Foreground="CornflowerBlue"></pi:TextBoxLog>
</GroupBox>-->
<GroupBox Grid.Column="1" Background="White" Padding="0" Style="{StaticResource GroupBoxTab}" Margin="0,5,5,5" >
<GroupBox Grid.Column="1" Background="White" Padding="0" Style="{StaticResource GroupBoxTab}">
<GroupBox.Header>
<Grid Width="{Binding ActualWidth,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type GroupBox}}}">
<TextBlock Margin="5,0" HorizontalAlignment="Left" VerticalAlignment="Center">入库日志信息</TextBlock>

View File

@ -161,15 +161,26 @@
<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 Orientation="Horizontal" VerticalAlignment="Center" Margin="5">
<TextBlock FontSize="14" VerticalAlignment="Center" Text="共"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding TotalCount ,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="条记录 "></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="第"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding CurrentPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="/"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding MaxPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="页 "></TextBlock>
<ComboBox FontSize="14" VerticalAlignment="Center" SelectedValue="{Binding PageSize}" SelectedValuePath="Tag">
<ComboBoxItem Tag="10" IsSelected="True">10条/页</ComboBoxItem>
<ComboBoxItem Tag="20">20条/页</ComboBoxItem>
<ComboBoxItem Tag="50">50条/页</ComboBoxItem>
<ComboBoxItem Tag="100">100条/页</ComboBoxItem>
<ComboBoxItem Tag="500">500条/页</ComboBoxItem>
</ComboBox>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Column="1">

View File

@ -34,6 +34,7 @@ namespace 货架标准上位机
{
viewModel.InitMatCode();
viewModel.BtnReset();
viewModel.BtnSearchReset();
}
}
}

View File

@ -135,15 +135,26 @@
<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 Orientation="Horizontal" VerticalAlignment="Center" Margin="5">
<TextBlock FontSize="14" VerticalAlignment="Center" Text="共"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding TotalCount ,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="条记录 "></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="第"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding CurrentPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="/"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding MaxPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="页 "></TextBlock>
<ComboBox FontSize="14" VerticalAlignment="Center" SelectedValue="{Binding PageSize}" SelectedValuePath="Tag">
<ComboBoxItem Tag="10" IsSelected="True">10条/页</ComboBoxItem>
<ComboBoxItem Tag="20">20条/页</ComboBoxItem>
<ComboBoxItem Tag="50">50条/页</ComboBoxItem>
<ComboBoxItem Tag="100">100条/页</ComboBoxItem>
<ComboBoxItem Tag="500">500条/页</ComboBoxItem>
</ComboBox>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Column="1">
@ -173,7 +184,6 @@
Command="{Binding BtnLastPageCommand}"/>
</Grid>
</StackPanel>
</Grid>
</Border>
</Grid>

View File

@ -41,6 +41,7 @@ namespace 货架标准上位机
private void LoadedVisible(object sender, EventArgs e)
{
viewModel.BtnReset();
viewModel.BtnSearchReset();
}
}
}

View File

@ -186,12 +186,12 @@
</TabItem>
<TabItem Header="模组管理">
<hc:TransitioningContentControl TransitionMode="Fade">
<View:RoleView />
<View:ModuleInfoView />
</hc:TransitioningContentControl>
</TabItem>
<TabItem Header="库位管理">
<hc:TransitioningContentControl TransitionMode="Fade">
<View:RoleView />
<View:StoreInfoView />
</hc:TransitioningContentControl>
</TabItem>
</TabControl>

View File

@ -184,15 +184,26 @@
<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 Orientation="Horizontal" VerticalAlignment="Center" Margin="5">
<TextBlock FontSize="14" VerticalAlignment="Center" Text="共"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding TotalCount ,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="条记录 "></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="第"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding CurrentPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="/"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding MaxPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="页 "></TextBlock>
<ComboBox FontSize="14" VerticalAlignment="Center" SelectedValue="{Binding PageSize}" SelectedValuePath="Tag">
<ComboBoxItem Tag="10" IsSelected="True">10条/页</ComboBoxItem>
<ComboBoxItem Tag="20">20条/页</ComboBoxItem>
<ComboBoxItem Tag="50">50条/页</ComboBoxItem>
<ComboBoxItem Tag="100">100条/页</ComboBoxItem>
<ComboBoxItem Tag="500">500条/页</ComboBoxItem>
</ComboBox>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Column="1">

View File

@ -28,6 +28,7 @@ namespace 货架标准上位机
private void LoadedVisible(object sender, EventArgs e)
{
viewModel.BtnReset();
viewModel.BtnSearchReset();
}
private void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)

View File

@ -1,15 +1,21 @@
using HandyControl.Controls;
using HandyControl.Tools.Extension;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using WCS.BLL.DbModels;
using WCS.Model;
using WCS.Model.ApiModel.MatBaseInfo;
using .Api;
using .Tool;
using .ViewModel;
using .Views.Controls;
namespace
{
@ -36,6 +42,7 @@ namespace 货架标准上位机
private void btnOk_Click(object sender, RoutedEventArgs e)
{
var button = sender as Button;
#region
if (string.IsNullOrEmpty(txtMatBatch.Text.Trim()))
{
@ -88,6 +95,69 @@ namespace 货架标准上位机
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<List<MatInfoModel>>>(LocalFile.Config.ApiIpHost + "matBaseInfo/generateMatInfo", body, "POST");
if (Result != null && Result.Data != null && Result.Data.Count > 0)
{
if (button != null && button.Content.ToString().Contains("打印"))
//批量打印
{
Task.Run(() =>
{
ProcessDialog process = null;
Dialog dia = null;
var totalCount = Result.Data.Count;
int currentCount = 0;
App.Current.Dispatcher.Invoke(() =>
{
process = new ProcessDialog();
dia = Dialog.Show(process);
});
Result.Data.ForEach(t =>
{
PrintTender.PrintTag(new PrintClass()
{
MatSn = t.MatSN,
MatName = t.MatName,
MatCode = t.MatCode,
MatBatch = t.MatBatch,
MatQty = t.MatQty.ToString(),
MatSpec = t.MatSpec,
});
currentCount++;
if (process != null)
process.viewModel.ProcessValue = Convert.ToInt32(((decimal)currentCount / totalCount) * 100);
});
App.Current.Dispatcher.Invoke(() =>
{
dia.Close();
dia.Collapse();
});
#region
try
{
var body = new PrintedMatInfoRequest()
{
PrintedMatInfoIds = Result.Data.Select(t => t.Id).ToList(),
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
};
var Result11 = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "matBaseInfo/printedMatInfo", body, "POST");
if (Result11 != null && Result11.Code == 200)
{
//回传成功
}
else
{
//回传失败
Logs.Write("回传“打印成功”失败");
}
}
catch (Exception ex)
{
Logs.Write("回传“打印成功”失败:" + ex.Message);
}
#endregion
});
}
Growl.Success("生成成功!");
}
}

View File

@ -11,7 +11,8 @@
<Border Margin="0" Background="AliceBlue" CornerRadius="3" Padding="0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"></RowDefinition>
<RowDefinition Height="0.8*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="10*"></RowDefinition>
</Grid.RowDefinitions>
<Border Grid.Row="0" Margin="5 5 5 0" Background="AliceBlue" CornerRadius="5" Padding="0">
@ -58,7 +59,6 @@
VerticalAlignment="Center" HorizontalAlignment="Stretch"
FontSize="18" MinWidth="90" Text="{Binding MatSN}"></TextBox>
<Button Style="{StaticResource ButtonSuccess}" hc:BorderElement.CornerRadius="15"
Grid.Column="9" MinHeight="40" FontSize="18" Content="&#xe8b9; 搜索" FontFamily="{StaticResource IconFont}"
Command="{Binding BtnSearchCommand}">
@ -69,8 +69,44 @@
</Button>
</Grid>
</Border>
<Border Grid.Row="1" Margin="5 5 5 0" Background="AliceBlue" CornerRadius="5" Padding="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.9*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="1.9*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="1.9*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="1.9*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<Border Grid.Row="1" Margin="5" Background="AliceBlue" CornerRadius="5" Padding="0">
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center" HorizontalAlignment="Right"
Text="物料批次:" FontSize="18" ></TextBlock>
<TextBox Grid.Column="1"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
FontSize="18" MinWidth="90" Text="{Binding MatBatch}"></TextBox>
<TextBlock
Grid.Column="2"
VerticalAlignment="Center" HorizontalAlignment="Right"
Text="已 打 印:" FontSize="18" ></TextBlock>
<ComboBox Grid.Column="3"
DisplayMemberPath="Text"
SelectedValuePath="Value"
ItemsSource="{Binding IsPrintedItemSource}"
SelectedValue="{Binding IsPrinted}"
Height="35" FontSize="18">
</ComboBox>
</Grid>
</Border>
<Border Grid.Row="2" Margin="5" Background="AliceBlue" CornerRadius="5" Padding="0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.8*"></RowDefinition>
@ -79,26 +115,12 @@
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal">
<!--<Button MinHeight="40" FontSize="18" Margin="5"
Content="&#xe8c1;删 除" FontFamily="{StaticResource IconFont}"
Foreground="WhiteSmoke"
Command="{Binding BtnDeleteCommand}"
Style="{StaticResource ButtonDanger}"
>
</Button>-->
<Button MinHeight="40" FontSize="18" Margin="5"
<Button MinHeight="40" FontSize="18" Margin="4" hc:BorderElement.CornerRadius="6"
Content="&#xe866;打印/补打" FontFamily="{StaticResource IconFont}"
Command="{Binding BtnPrintCommand}"
Foreground="WhiteSmoke"
Background="DarkOrange"
>
Foreground="WhiteSmoke"
Background="DarkOrange">
</Button>
</StackPanel>
<DataGrid
@ -133,7 +155,8 @@
<DataGridTextColumn Header="供应商" MaxWidth="150" Binding="{Binding MatSupplier}"></DataGridTextColumn>
<DataGridTextColumn Header="客户" MaxWidth="150" Binding="{Binding MatCustomer}"></DataGridTextColumn>
<DataGridTextColumn Header="物料SN" Binding="{Binding MatSN}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="打印次数" Binding="{Binding PrintTimes}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="打印" Binding="{Binding IsPrinted,Converter={StaticResource Boolean2StringConverter},ConverterParameter=否;是}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="打印次数" Binding="{Binding PrintedTimes}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="更新人" Binding="{Binding ModifyUser}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="更新时间" Binding="{Binding ModifyTime ,StringFormat='yyyy-MM-dd HH:mm:ss'}"></DataGridTextColumn>
</DataGrid.Columns>
@ -151,15 +174,26 @@
<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 Orientation="Horizontal" VerticalAlignment="Center" Margin="5">
<TextBlock FontSize="14" VerticalAlignment="Center" Text="共"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding TotalCount ,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="条记录 "></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="第"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding CurrentPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="/"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding MaxPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="页 "></TextBlock>
<ComboBox FontSize="14" VerticalAlignment="Center" SelectedValue="{Binding PageSize}" SelectedValuePath="Tag">
<ComboBoxItem Tag="10" IsSelected="True">10条/页</ComboBoxItem>
<ComboBoxItem Tag="20">20条/页</ComboBoxItem>
<ComboBoxItem Tag="50">50条/页</ComboBoxItem>
<ComboBoxItem Tag="100">100条/页</ComboBoxItem>
<ComboBoxItem Tag="500">500条/页</ComboBoxItem>
</ComboBox>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Column="1">

View File

@ -29,6 +29,7 @@ namespace 货架标准上位机
private void LoadedVisible(object sender, EventArgs e)
{
viewModel.BtnReset();
viewModel.BtnSearchReset();
}
private void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)

View File

@ -161,15 +161,26 @@
<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 Orientation="Horizontal" VerticalAlignment="Center" Margin="5">
<TextBlock FontSize="14" VerticalAlignment="Center" Text="共"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding TotalCount ,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="条记录 "></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="第"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding CurrentPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="/"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding MaxPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="页 "></TextBlock>
<ComboBox FontSize="14" VerticalAlignment="Center" SelectedValue="{Binding PageSize}" SelectedValuePath="Tag">
<ComboBoxItem Tag="10" IsSelected="True">10条/页</ComboBoxItem>
<ComboBoxItem Tag="20">20条/页</ComboBoxItem>
<ComboBoxItem Tag="50">50条/页</ComboBoxItem>
<ComboBoxItem Tag="100">100条/页</ComboBoxItem>
<ComboBoxItem Tag="500">500条/页</ComboBoxItem>
</ComboBox>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Column="1">

View File

@ -34,6 +34,7 @@ namespace 货架标准上位机
{
viewModel.InitMatCode();
viewModel.BtnReset();
viewModel.BtnSearchReset();
}
}
}

View File

@ -0,0 +1,164 @@
<pi:UserControlBase
xmlns:pi="https://github.com/ping9719/wpfex"
x:Class="货架标准上位机.ModuleInfoView"
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" LoadedVisibleFirst="LoadedVisible">
<Border Margin="0" Background="AliceBlue" CornerRadius="3" Padding="0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"></RowDefinition>
<RowDefinition Height="10*"></RowDefinition>
</Grid.RowDefinitions>
<Border Grid.Row="0" Margin="0" Background="AliceBlue" CornerRadius="5" Padding="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="3*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="3*"></ColumnDefinition>
<ColumnDefinition Width="1.9*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="1.9*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center" HorizontalAlignment="Right"
Text="货架编码:" FontSize="18" ></TextBlock>
<TextBox Grid.Column="1"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
FontSize="18" MinWidth="90" Text="{Binding ShelfCode}"></TextBox>
<TextBlock Grid.Column="2"
VerticalAlignment="Center" HorizontalAlignment="Right"
Text="模组编码:" FontSize="18" ></TextBlock>
<TextBox Grid.Column="3"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
FontSize="18" MinWidth="90" Text="{Binding ModuleCode}"></TextBox>
<Button Style="{StaticResource ButtonSuccess}" hc:BorderElement.CornerRadius="15"
Grid.Column="9" MinHeight="40" FontSize="18" Content="&#xe8b9; 搜索" FontFamily="{StaticResource IconFont}"
Command="{Binding BtnSearchCommand}">
</Button>
<Button Style="{StaticResource ButtonWarning}" hc:BorderElement.CornerRadius="15"
Grid.Column="10" MinHeight="40" FontSize="18" Content="&#xe652; 重置" FontFamily="{StaticResource IconFont}"
Command="{Binding BtnResetCommand}">
</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="9*"></RowDefinition>
<RowDefinition Height="0.8*"></RowDefinition>
</Grid.RowDefinitions>
<DataGrid Grid.Row="1"
SelectedItem="{Binding SelectedataGridItem}"
Name="dataGrid"
ItemsSource="{Binding DataGridItemSource}"
SelectionChanged="dataGrid_SelectionChanged"
RowHeight="39"
AutoGenerateColumns="False" FontSize="13">
<DataGrid.Columns>
<!--<DataGridTemplateColumn CanUserResize="False">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox Width="30" Height="30" IsHitTestVisible="False" IsChecked="{Binding IsSelected}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.HeaderTemplate>
<DataTemplate>
<CheckBox Width="30" Height="30" Unchecked="allChecked_Unchecked" Checked="allChecked_Checked" Name="allChecked"/>
</DataTemplate>
</DataGridTemplateColumn.HeaderTemplate>
</DataGridTemplateColumn>-->
<DataGridTextColumn IsReadOnly="True" Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="货架编码" Binding="{Binding ShelfCode}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="模组编码" Binding="{Binding ModuleCode}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="PCB板ID" Binding="{Binding BoardId}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="单板灯数量" Binding="{Binding LightCount}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="TCP连接信息" Binding="{Binding CleintIp}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="R" Binding="{Binding R}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="C" Binding="{Binding C}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="是否启用" Binding="{Binding IsEnable,Converter={StaticResource Boolean2StringConverter},ConverterParameter=否;是}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="绑定后货架编码" Binding="{Binding BindShelfCode}"></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" VerticalAlignment="Center" Margin="5">
<TextBlock FontSize="14" VerticalAlignment="Center" Text="共"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding TotalCount ,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="条记录 "></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="第"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding CurrentPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="/"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding MaxPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="页 "></TextBlock>
<ComboBox FontSize="14" VerticalAlignment="Center" SelectedValue="{Binding PageSize}" SelectedValuePath="Tag">
<ComboBoxItem Tag="10" IsSelected="True">10条/页</ComboBoxItem>
<ComboBoxItem Tag="20">20条/页</ComboBoxItem>
<ComboBoxItem Tag="50">50条/页</ComboBoxItem>
<ComboBoxItem Tag="100">100条/页</ComboBoxItem>
<ComboBoxItem Tag="500">500条/页</ComboBoxItem>
</ComboBox>
</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>

View File

@ -0,0 +1,90 @@
using Ping9719.WpfEx;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
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 .ViewModel;
namespace
{
public partial class ModuleInfoView : UserControlBase
{
public ModuleInfoViewModel viewModel { get; set; } = new ModuleInfoViewModel();
public ModuleInfoView()
{
InitializeComponent();
this.DataContext = viewModel;
}
private void LoadedVisible(object sender, EventArgs e)
{
viewModel.BtnReset();
viewModel.BtnSearchReset();
}
private void allChecked_Checked(object sender, RoutedEventArgs e)
{
if (viewModel != null && viewModel.DataGridItemSource != null && viewModel.DataGridItemSource.Count() > 0)
{
foreach (var item in viewModel.DataGridItemSource)
{
item.IsSelected = true;
}
}
}
private void allChecked_Unchecked(object sender, RoutedEventArgs e)
{
if (viewModel != null && viewModel.DataGridItemSource != null && viewModel.DataGridItemSource.Count() > 0)
{
foreach (var item in viewModel.DataGridItemSource)
{
item.IsSelected = false;
}
}
}
private void dataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
try
{
// 更新选中项的状态
if (dataGrid.SelectedCells.Count > 0 && viewModel.SelectedataGridItem != null)
{
viewModel.SelectedataGridItem.IsSelected = !viewModel.SelectedataGridItem.IsSelected;
//dataGrid.UnselectAllCells(); // 取消选中所有单元格
}
}
catch(Exception ex)
{
Debug.WriteLine("SelectionChanged event handler failed: " + ex.Message);
}
}
private void CheckBox_Checked(object sender, RoutedEventArgs e)
{
;
}
private void CheckBox_Unchecked(object sender, RoutedEventArgs e)
{
;
}
private void CheckBox_Click(object sender, RoutedEventArgs e)
{
;
}
}
}

View File

@ -14,7 +14,7 @@
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="7*"></RowDefinition>
</Grid.RowDefinitions>
<Border Grid.Row="0" Margin="2" Background="AliceBlue" CornerRadius="5" Padding="0">
<Border Grid.Row="0" Margin="2 2 2 0" Background="AliceBlue" CornerRadius="5" Padding="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
@ -51,15 +51,7 @@
<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"
@ -141,17 +133,29 @@
<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 Orientation="Horizontal" VerticalAlignment="Center" Margin="5">
<TextBlock FontSize="14" VerticalAlignment="Center" Text="共"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding TotalCount ,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="条记录 "></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="第"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding CurrentPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="/"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding MaxPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="页 "></TextBlock>
<ComboBox FontSize="14" VerticalAlignment="Center" SelectedValue="{Binding PageSize}" SelectedValuePath="Tag">
<ComboBoxItem Tag="10" IsSelected="True">10条/页</ComboBoxItem>
<ComboBoxItem Tag="20">20条/页</ComboBoxItem>
<ComboBoxItem Tag="50">50条/页</ComboBoxItem>
<ComboBoxItem Tag="100">100条/页</ComboBoxItem>
<ComboBoxItem Tag="500">500条/页</ComboBoxItem>
</ComboBox>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Column="1">
<Grid>
<Grid.RowDefinitions >

View File

@ -43,7 +43,7 @@
</Border>
<Border Grid.Row="1" Margin="0" Background="LightGray" Padding="0">
<Border Margin="1" CornerRadius="3" Background="AliceBlue" Padding="0">
<Border Margin="0" CornerRadius="3" Background="AliceBlue" Padding="0">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"></ColumnDefinition>
@ -172,10 +172,9 @@
<ColumnDefinition Width="5*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1">
<!--<TextBlock Text="当前状态:" FontSize="22">
<TextBlock Text="当前状态:" FontSize="22">
</TextBlock>
<TextBlock Text="{Binding OrderStatus,FallbackValue=未发料或未发完}" Foreground="red" FontSize="22">
</TextBlock>-->
<TextBlock Text="{Binding OrderStatus,FallbackValue=未}" Foreground="Red" FontSize="22"></TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="2">
<TextBlock Text="总盘数:" VerticalAlignment="Bottom" FontSize="22">

View File

@ -83,12 +83,12 @@
Command="{Binding BtnDeleteCommand}"
Style="{StaticResource ButtonDanger}">
</Button>
<Button MinHeight="40" FontSize="18" Margin="5"
<!--<Button MinHeight="40" FontSize="18" Margin="5"
Content="&#xe866;生成模组" FontFamily="{StaticResource IconFont}"
Command="{Binding BtnImportCommand}"
Foreground="WhiteSmoke"
Background="Green">
</Button>
</Button>-->
</StackPanel>
<DataGrid Grid.Row="1"
@ -119,7 +119,7 @@
<DataGridTextColumn IsReadOnly="True" Header="报警灯ID" Binding="{Binding LightId}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="TCP连接信息" Binding="{Binding ClientIp}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="货架区域(组别)" Binding="{Binding GroupName}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="是否绑定" Binding="{Binding IsBind}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="是否绑定" Binding="{Binding IsBind,Converter={StaticResource Boolean2StringConverter},ConverterParameter=否;是}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="绑定后货架编码" Binding="{Binding BindShelfCode}"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
@ -136,15 +136,26 @@
<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 Orientation="Horizontal" VerticalAlignment="Center" Margin="5">
<TextBlock FontSize="14" VerticalAlignment="Center" Text="共"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding TotalCount ,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="条记录 "></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="第"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding CurrentPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="/"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding MaxPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="页 "></TextBlock>
<ComboBox FontSize="14" VerticalAlignment="Center" SelectedValue="{Binding PageSize}" SelectedValuePath="Tag">
<ComboBoxItem Tag="10" IsSelected="True">10条/页</ComboBoxItem>
<ComboBoxItem Tag="20">20条/页</ComboBoxItem>
<ComboBoxItem Tag="50">50条/页</ComboBoxItem>
<ComboBoxItem Tag="100">100条/页</ComboBoxItem>
<ComboBoxItem Tag="500">500条/页</ComboBoxItem>
</ComboBox>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Column="1">

View File

@ -31,6 +31,7 @@ namespace 货架标准上位机
{
viewModel.BtnReset();
viewModel.InitShelfTypeItems();
viewModel.BtnSearchReset();
}
private void allChecked_Checked(object sender, RoutedEventArgs e)
@ -66,7 +67,7 @@ namespace 货架标准上位机
dataGrid.UnselectAllCells(); // 取消选中所有单元格
}
}
catch(Exception ex)
catch (Exception ex)
{
Debug.WriteLine("SelectionChanged event handler failed: " + ex.Message);
}

View File

@ -8,7 +8,7 @@
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:货架标准上位机="clr-namespace:货架标准上位机"
mc:Ignorable="d"
d:DesignHeight="737" d:DesignWidth="1192">
d:DesignHeight="737" d:DesignWidth="1192" LoadedVisible="UserControlBase_LoadedVisible" >
<Border Margin="0" Background="LightGray" CornerRadius="3" Padding="0">
<Grid>
<Grid.RowDefinitions>

View File

@ -65,5 +65,10 @@ namespace 货架标准上位机
{
viewModel.RefreshStockTakingOrderList(viewModel.SelectedOutOrderNumber);
}
private void UserControlBase_LoadedVisible(object sender, EventArgs e)
{
viewModel.RefreshStockTakingOrderList();
}
}
}

View File

@ -93,7 +93,7 @@
</Button>
<Button MinHeight="40" FontSize="18" Margin="5" Command="{Binding BtnCommitCommand}"
Content="&#xe67e;提交盘点" FontFamily="{StaticResource IconFont}" Background="SaddleBrown" Foreground="White">
Content="&#xe600;提交盘点" FontFamily="{StaticResource IconFont}" Background="SaddleBrown" Foreground="White">
</Button>
</StackPanel>
<DataGrid Grid.Row="1" SelectedCellsChanged="DataGrid_SelectedCellsChanged"
@ -131,17 +131,29 @@
<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 Orientation="Horizontal" VerticalAlignment="Center" Margin="5">
<TextBlock FontSize="14" VerticalAlignment="Center" Text="共"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding TotalCount ,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="条记录 "></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="第"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding CurrentPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="/"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding MaxPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="页 "></TextBlock>
<ComboBox FontSize="14" VerticalAlignment="Center" SelectedValue="{Binding PageSize}" SelectedValuePath="Tag">
<ComboBoxItem Tag="10" IsSelected="True">10条/页</ComboBoxItem>
<ComboBoxItem Tag="20">20条/页</ComboBoxItem>
<ComboBoxItem Tag="50">50条/页</ComboBoxItem>
<ComboBoxItem Tag="100">100条/页</ComboBoxItem>
<ComboBoxItem Tag="500">500条/页</ComboBoxItem>
</ComboBox>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Column="1">
<Grid>
<Grid.RowDefinitions >

View File

@ -0,0 +1,178 @@
<pi:UserControlBase
xmlns:pi="https://github.com/ping9719/wpfex"
x:Class="货架标准上位机.StoreInfoView"
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" LoadedVisibleFirst="LoadedVisible">
<Border Margin="0" Background="AliceBlue" CornerRadius="3" Padding="0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1.3*"></RowDefinition>
<RowDefinition Height="10*"></RowDefinition>
</Grid.RowDefinitions>
<Border Grid.Row="0" Margin="0" Background="AliceBlue" CornerRadius="5" Padding="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="3*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="3*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="3*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="2.5*"></ColumnDefinition>
<ColumnDefinition Width="2.5*"></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"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
FontSize="18" MinWidth="90" Text="{Binding ShelfCode}"></TextBox>
<TextBlock Grid.Column="2"
VerticalAlignment="Center" HorizontalAlignment="Right"
Text="模组编码:" FontSize="18" ></TextBlock>
<TextBox Grid.Column="3"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
FontSize="18" MinWidth="90" Text="{Binding ModuleCode}"></TextBox>
<TextBlock Grid.Column="4"
VerticalAlignment="Center" HorizontalAlignment="Right"
Text="库位编码:" FontSize="18" ></TextBlock>
<TextBox Grid.Column="5"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
FontSize="18" MinWidth="90" Text="{Binding StoreCode}"></TextBox>
<TextBlock Grid.Column="0" Grid.Row="1"
VerticalAlignment="Center" HorizontalAlignment="Right"
Text="当前物料:" FontSize="18" ></TextBlock>
<TextBox Grid.Column="1" Grid.Row="1"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
FontSize="18" MinWidth="90" Text="{Binding CurrentMatSN}"></TextBox>
<Button Style="{StaticResource ButtonSuccess}" hc:BorderElement.CornerRadius="15"
Grid.Column="8" MinHeight="40" FontSize="18" Content="&#xe8b9; 搜索" FontFamily="{StaticResource IconFont}"
Command="{Binding BtnSearchCommand}">
</Button>
<Button Style="{StaticResource ButtonWarning}" hc:BorderElement.CornerRadius="15"
Grid.Column="9" MinHeight="40" FontSize="18" Content="&#xe652; 重置" FontFamily="{StaticResource IconFont}"
Command="{Binding BtnResetCommand}">
</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="9*"></RowDefinition>
<RowDefinition Height="0.8*"></RowDefinition>
</Grid.RowDefinitions>
<DataGrid Grid.Row="1"
SelectedItem="{Binding SelectedataGridItem}"
Name="dataGrid"
ItemsSource="{Binding DataGridItemSource}"
SelectionChanged="dataGrid_SelectionChanged"
RowHeight="39"
AutoGenerateColumns="False" FontSize="13">
<DataGrid.Columns>
<DataGridTextColumn IsReadOnly="True" Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="货架编码" Binding="{Binding ShelfCode}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="模组编码" Binding="{Binding ModuleCode}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="库位编码" Binding="{Binding StoreCode}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="PCB板ID" Binding="{Binding BoardId}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="储位号" Binding="{Binding LightNumber}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="电压标准值" Binding="{Binding StandardVoltage}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="电压偏移值" Binding="{Binding OffsetVoltage}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="当前电压" Binding="{Binding CurrentVoltage}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="当前物料" Binding="{Binding CurrentMatSn}"></DataGridTextColumn>
<DataGridTemplateColumn CanUserResize="False" Width="auto">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" IsEnabled="{Binding IsAdmin,Converter={StaticResource Boolean2BooleanReConverter}}">
<Button Style="{StaticResource ButtonWarning}" Margin="0,0,5,0" IsEnabled="True" Content="禁用" Width="60" Command="{Binding DataContext.UpdateCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" CommandParameter="{Binding }" />
<Button Style="{StaticResource ButtonDanger}" Margin="0,0,0,0" IsEnabled="True" Content="启用" Width="60" Command="{Binding DataContext.DelCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" CommandParameter="{Binding }"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</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" VerticalAlignment="Center" Margin="5">
<TextBlock FontSize="14" VerticalAlignment="Center" Text="共"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding TotalCount ,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="条记录 "></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="第"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding CurrentPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="/"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding MaxPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="页 "></TextBlock>
<ComboBox FontSize="14" VerticalAlignment="Center" SelectedValue="{Binding PageSize}" SelectedValuePath="Tag">
<ComboBoxItem Tag="10" IsSelected="True">10条/页</ComboBoxItem>
<ComboBoxItem Tag="20">20条/页</ComboBoxItem>
<ComboBoxItem Tag="50">50条/页</ComboBoxItem>
<ComboBoxItem Tag="100">100条/页</ComboBoxItem>
<ComboBoxItem Tag="500">500条/页</ComboBoxItem>
</ComboBox>
</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>

View File

@ -0,0 +1,90 @@
using Ping9719.WpfEx;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
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 .ViewModel;
namespace
{
public partial class StoreInfoView : UserControlBase
{
public StoreInfoViewModel viewModel { get; set; } = new StoreInfoViewModel();
public StoreInfoView()
{
InitializeComponent();
this.DataContext = viewModel;
}
private void LoadedVisible(object sender, EventArgs e)
{
viewModel.BtnReset();
viewModel.BtnSearchReset();
}
private void allChecked_Checked(object sender, RoutedEventArgs e)
{
if (viewModel != null && viewModel.DataGridItemSource != null && viewModel.DataGridItemSource.Count() > 0)
{
foreach (var item in viewModel.DataGridItemSource)
{
item.IsSelected = true;
}
}
}
private void allChecked_Unchecked(object sender, RoutedEventArgs e)
{
if (viewModel != null && viewModel.DataGridItemSource != null && viewModel.DataGridItemSource.Count() > 0)
{
foreach (var item in viewModel.DataGridItemSource)
{
item.IsSelected = false;
}
}
}
private void dataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
try
{
// 更新选中项的状态
if (dataGrid.SelectedCells.Count > 0 && viewModel.SelectedataGridItem != null)
{
viewModel.SelectedataGridItem.IsSelected = !viewModel.SelectedataGridItem.IsSelected;
//dataGrid.UnselectAllCells(); // 取消选中所有单元格
}
}
catch(Exception ex)
{
Debug.WriteLine("SelectionChanged event handler failed: " + ex.Message);
}
}
private void CheckBox_Checked(object sender, RoutedEventArgs e)
{
;
}
private void CheckBox_Unchecked(object sender, RoutedEventArgs e)
{
;
}
private void CheckBox_Click(object sender, RoutedEventArgs e)
{
;
}
}
}

View File

@ -16,9 +16,10 @@ namespace 货架标准上位机
{
public static class WebSocket
{
public static WebSocketClient client = null;
public static void InitWebSocket()
{
var client = new WebSocketClient();
client = new WebSocketClient();
client.Setup(new TouchSocketConfig()
.SetRemoteIPHost("ws://127.0.0.1:7789/ws")
.ConfigureContainer(a =>
@ -34,10 +35,8 @@ namespace 货架标准上位机
//配置断线重连
a.UseReconnection(-1, true, 1000);//-1表示一直重连
}));
client.Connect();
}
}
public class WebSocketClientPlugin : PluginBase, IWebSocketReceivedPlugin
{

View File

@ -64,6 +64,7 @@
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Http" />
<Reference Include="System.Printing" />
</ItemGroup>
<ItemGroup>
@ -104,6 +105,9 @@
<Compile Update="Views\Controls\ScannerDisplayControl.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Views\Controls\ProcessDialog.xaml.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>