using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WeighBusiness.BL;
using WeighBusiness.BO;
namespace WeighBusiness.Utils
{
public static class SynchronousUtil
{
///
/// 插入需要同步的称重单信息
///
/// 客户端称重ID
public static bool InsertWeighSynchronous(long terminalWeighID)
{
return SynchronousLogBL.Insert(new SynchronousLog() { BillTypeID = Weigh.BillTypeID, TerminalBillID = terminalWeighID, RemoteBillID = 0 });
}
///
/// 删除同步信息
///
/// 客户端称重单ID
public static bool DeleteWeighSynchronous(long terminalWeighID)
{
return SynchronousLogBL.Delete(terminalWeighID);
}
///
/// 更新同步情况。即更新系统称重单ID。如果ID>0,则同步完成;否则同步未完成。
///
/// 客户端称重单ID
/// 系统称重单ID
/// 同步信息,为null时不更新
public static bool UpdateWeighSynchronous(long terminalWeighID, long remoteWeighID, string synchronousMessage)
{
var dmo = SynchronousLogBL.GetSynchronousDmoFromBillID(Weigh.BillTypeID, terminalWeighID);
dmo.RemoteBillID = remoteWeighID;
if (!string.IsNullOrEmpty(synchronousMessage))
dmo.SynchronousMessage = synchronousMessage;
return SynchronousLogBL.Update(dmo);
}
public static long[] GetAllNotSynchronousWeighIDs()
{
return SynchronousLogBL.GetAllNotSynchronousDmo(Weigh.BillTypeID);
}
}
}