diff --git a/SlnMesnac.RfidUpload.Common/ListPage.cs b/SlnMesnac.RfidUpload.Common/ListPage.cs new file mode 100644 index 0000000..df14849 --- /dev/null +++ b/SlnMesnac.RfidUpload.Common/ListPage.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SlnMesnac.RfidUpload.Common +{ + public class ListPage + { + public int TotalPage { get; set; } + + public int Total { get; set; } + + public int PageSize { get; set; } = 50; + + public List Ls { get; set; } + + public ListPage(IEnumerable ls, int pageSize = 500) + { + if (!(ls is T[] objArray)) + objArray = ls.ToArray(); + T[] source = objArray; + this.Ls = ((IEnumerable)source).ToList(); + this.Total = ((IEnumerable)source).Count(); + this.PageSize = pageSize; + this.TotalPage = (((IEnumerable)source).Count() + this.PageSize - 1) / this.PageSize; + } + + public IEnumerable> GetPage() + { + List> page = new List>(); + for (int index = 0; index < this.TotalPage; ++index) + { + IEnumerable objs = this.Ls.Skip(this.PageSize * index).Take(this.PageSize); + page.Add(objs); + } + return (IEnumerable>)page; + } + } +} diff --git a/SlnMesnac.RfidUpload.NLog/LogHelper.cs b/SlnMesnac.RfidUpload.NLog/LogHelper.cs index 94a7b44..2d7e7d6 100644 --- a/SlnMesnac.RfidUpload.NLog/LogHelper.cs +++ b/SlnMesnac.RfidUpload.NLog/LogHelper.cs @@ -49,11 +49,7 @@ namespace SlnMesnac.RfidUpload.NLog } public readonly log4net.ILog loginfo = log4net.LogManager.GetLogger("loginfo"); public readonly log4net.ILog logerror = log4net.LogManager.GetLogger("logerror"); - public readonly log4net.ILog logPlc = log4net.LogManager.GetLogger("plclog"); - public readonly log4net.ILog logRfid = log4net.LogManager.GetLogger("rfidlog"); - public readonly log4net.ILog logView = log4net.LogManager.GetLogger("viewlog"); - public readonly log4net.ILog sqllog = log4net.LogManager.GetLogger("sqllog"); - public readonly log4net.ILog semaphorelog = log4net.LogManager.GetLogger("semaphorelog"); + /// /// 记录Info日志 /// @@ -67,58 +63,7 @@ namespace SlnMesnac.RfidUpload.NLog } } - /// - /// 记录PLC日志 - /// - /// - public void PlcLog(string msg) - { - if (logPlc.IsInfoEnabled) - { - logPlc.Info(msg); - } - } - - /// - /// 记录Rfid日志 - /// - /// - public void RfidLog(string msg) - { - if (logRfid.IsInfoEnabled) - { - logRfid.Info(msg); - } - } - - /// - /// 界面日志 - /// - /// - public void ViewLog(string msg) - { - if (logView.IsInfoEnabled) - { - logView.Info(msg); - } - } - - public void SqlLog(string msg) - { - if (sqllog.IsInfoEnabled) - { - sqllog.Info(msg); - } - } - - public void SemaphoreLog(string msg) - { - if (semaphorelog.IsInfoEnabled) - { - semaphorelog.Info(msg); - } - } - + /// /// 记录Error日志 /// diff --git a/SlnMesnac.RfidUpload.UI/viewModel/MainWindowViewModel.cs b/SlnMesnac.RfidUpload.UI/viewModel/MainWindowViewModel.cs index c84dca0..657bfff 100644 --- a/SlnMesnac.RfidUpload.UI/viewModel/MainWindowViewModel.cs +++ b/SlnMesnac.RfidUpload.UI/viewModel/MainWindowViewModel.cs @@ -415,10 +415,19 @@ namespace SlnMesnac.RfidUpload.UI.viewModel { var info = labelItems.ToList(); var strList = info.Select(x => x.result).ToList(); - string opBatch = Guid.NewGuid().ToString("N").Substring(0, 20); - CsbResult res = csbHandleBusiness.containerScanSealByCsb(TransferOrderInfoItem.ffjhNo, - System.Guid.NewGuid().ToString("N").Substring(0, 20), - TransferOrderInfoItem.ffjhscrq, "1", strList); + int batchNo = 0; + string opBatch = System.Guid.NewGuid().ToString("N").Substring(0, 20); + ListPage ls = new ListPage(strList,500); + CsbResult res = new CsbResult(); + foreach (var enumerable in ls.GetPage()) + { + batchNo++; + res = csbHandleBusiness.containerScanSealByCsb(TransferOrderInfoItem.ffjhNo, + opBatch, + TransferOrderInfoItem.ffjhscrq, batchNo.ToString(), enumerable.ToList()); + } + + MessageBox.Show("封发-按调拨单"+res.message); Task.Run(() =>