wms_serve_m_jingwangchengpin/WmsMobileServe/DataBase/Base/Dao/TOnGoodsShelfDao.cs

110 lines
2.8 KiB
C#
Raw Normal View History

2025-01-08 15:43:26 +08:00
using System.DirectoryServices.Protocols;
using WmsMobileServe.Annotation;
using WmsMobileServe.DataBase.Base.Po;
namespace WmsMobileServe.DataBase.Base.Dao;
/// <summary>
/// 入库任务表操作类
/// </summary>
[Component]
public class TOnGoodsShelfDao(DataBaseClient client)
{
/// <summary>
/// 插入数据
/// </summary>
/// <param name="onGoodsShelfs"></param>
/// <returns></returns>
public int Insert(params TOnGoodsShelf[] onGoodsShelfs)
{
try
{
return client.Instance().Insertable(onGoodsShelfs).ExecuteCommand();
}
catch (Exception ex)
{
_ = ex;
return 0;
}
}
public bool InsertWithCux(List<TOnGoodsShelf> onGoodsShelfs, List<(string? PoHeaderId, string? PoLineId, string? LineLocationId)> values)
{
try
{
var tranResult = client.Instance().UseTran(() =>
{
client.Instance().Insertable(onGoodsShelfs).ExecuteCommand(); // 插入任务
foreach (var item in values)
{
client.Instance().Updateable<CuxWmsPoLinesItf>().SetColumns(s => s.Status == 1)
.Where(w => w.PoHeaderId.ToString() == item.PoHeaderId && w.PoLineId.ToString() == item.PoLineId && w.LineLocationId.ToString() == item.LineLocationId).ExecuteCommand();
}
});
return tranResult.IsSuccess;
}
catch (Exception ex)
{
_ = ex;
return false;
}
}
/// <summary>
/// 根据载具号查询任务
/// </summary>
/// <param name="vehicleNo"></param>
/// <returns></returns>
public List<TOnGoodsShelf>? SelectWithVehicleNo(string vehicleNo)
{
try
{
return client.Instance().Queryable<TOnGoodsShelf>()
.Where(w => w.Ctl == vehicleNo).ToList();
}
catch (Exception ex)
{
_ = ex;
return default;
}
}
2025-08-24 08:40:49 +08:00
public List<TOnGoodsShelf>? SelectWithVehicleNo_Empty(string vehicleNo)
{
try
{
return client.Instance().Queryable<TOnGoodsShelf>()
.Where(w => w.Ctl == vehicleNo && w.Status =="0").ToList();
}
catch (Exception ex)
{
_ = ex;
return default;
}
}
2025-01-08 15:43:26 +08:00
2025-08-24 08:40:49 +08:00
public bool DeleteWithVehicleNo(string vehicleNo)
{
try
{
// 返回删除的记录数(>0 表示成功)
return client.Instance().Deleteable<TOnGoodsShelf>()
.Where(w => w.Ctl == vehicleNo)
.ExecuteCommand() > 0;
}
catch (Exception ex)
{
_ = ex; // 可记录日志
return false;
}
}
2025-01-08 15:43:26 +08:00
}