master
nodyang@aliyun.com 1 month ago
parent d52f947756
commit 1d2cba0704

@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SlnMesnac.RfidUpload.Common
{
public class ListPage<T>
{
public int TotalPage { get; set; }
public int Total { get; set; }
public int PageSize { get; set; } = 50;
public List<T> Ls { get; set; }
public ListPage(IEnumerable<T> ls, int pageSize = 500)
{
if (!(ls is T[] objArray))
objArray = ls.ToArray<T>();
T[] source = objArray;
this.Ls = ((IEnumerable<T>)source).ToList<T>();
this.Total = ((IEnumerable<T>)source).Count<T>();
this.PageSize = pageSize;
this.TotalPage = (((IEnumerable<T>)source).Count<T>() + this.PageSize - 1) / this.PageSize;
}
public IEnumerable<IEnumerable<T>> GetPage()
{
List<IEnumerable<T>> page = new List<IEnumerable<T>>();
for (int index = 0; index < this.TotalPage; ++index)
{
IEnumerable<T> objs = this.Ls.Skip<T>(this.PageSize * index).Take<T>(this.PageSize);
page.Add(objs);
}
return (IEnumerable<IEnumerable<T>>)page;
}
}
}

@ -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");
/// <summary>
/// 记录Info日志
/// </summary>
@ -67,57 +63,6 @@ namespace SlnMesnac.RfidUpload.NLog
}
}
/// <summary>
/// 记录PLC日志
/// </summary>
/// <param name="msg"></param>
public void PlcLog(string msg)
{
if (logPlc.IsInfoEnabled)
{
logPlc.Info(msg);
}
}
/// <summary>
/// 记录Rfid日志
/// </summary>
/// <param name="msg"></param>
public void RfidLog(string msg)
{
if (logRfid.IsInfoEnabled)
{
logRfid.Info(msg);
}
}
/// <summary>
/// 界面日志
/// </summary>
/// <param name="msg"></param>
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);
}
}
/// <summary>
/// 记录Error日志

@ -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<string> ls = new ListPage<string>(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(() =>

Loading…
Cancel
Save