You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
3.0 KiB
C#

using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Text;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2024 WenJY
* CLR4.0.30319.42000
* LAPTOP-E0N2L34V
* SlnMesnac.Repository.service.Impl
* 2ef6cbc3-f5ce-4d6a-9750-06aac8227b6f
*
* WenJY
* wenjy@mesnac.com
* 2024-04-07 16:57:02
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace SlnMesnac.Repository.service.Impl
{
public class BasePalletInfoServiceImpl : BaseServiceImpl<BasePalletInfo>, IBasePalletInfoService
{
public BasePalletInfoServiceImpl(Repository<BasePalletInfo> rep):base(rep)
{
}
/// <summary>
/// 根据托盘编码获取托盘信息
/// </summary>
/// <param name="palleCode"></param>
/// <returns></returns>
/// <exception cref="InvalidOperationException"></exception>
public BasePalletInfo GetPalletInfoByPalletCode(string palleCode)
{
try
{
return base._rep.GetFirst(x => x.PalletInfoCode == palleCode);
}
catch (Exception e)
{
throw new InvalidOperationException($"根据托盘编码获取托盘信息异常:{e.Message}");
}
}
/// <summary>
/// 更新托盘信息
/// </summary>
/// <param name="palletInfo"></param>
/// <returns></returns>
/// <exception cref="InvalidOperationException"></exception>
public bool UpdatePalletInfo(BasePalletInfo palletInfo)
{
try
{
return base._rep.Update(palletInfo);
}
catch (Exception e)
{
throw new InvalidOperationException($"更新托盘信息异常:{e.Message}");
}
}
/// <summary>
/// 解绑托盘信息
/// </summary>
/// <param name="palletInfo"></param>
/// <returns></returns>
/// <exception cref="InvalidOperationException"></exception>
public bool UnBindPalletInfo(BasePalletInfo palletInfo)
{
try
{
palletInfo.MaterialId = null;
palletInfo.MaterialCode = string.Empty;
palletInfo.MaterialName = string.Empty;
palletInfo.MaterialBarcode = string.Empty;
palletInfo.UpdateTime = DateTime.Now;
return base._rep.Update(palletInfo);
}
catch (Exception e)
{
throw new InvalidOperationException($"解绑托盘信息异常:{e.Message}");
}
}
}
}