wms_serve_m_jingwangchengpin/WmsMobileServe/DataBase/Base/Dao/TRKWareNOticeTabDao.cs
2025-01-08 15:43:26 +08:00

65 lines
1.7 KiB
C#

using WmsMobileServe.Annotation;
using WmsMobileServe.DataBase.Base.Po;
namespace WmsMobileServe.DataBase.Base.Dao;
/// <summary>
/// 入库单操作
/// </summary>
[Component]
public class TRKWareNOticeTabDao(DataBaseClient client)
{
public List<TRKWareNoticeTab>? SelectWithOrderIdAndGoodsId(string? orderId, string? goodsId)
{
try
{
var sqlFuc = client.Instance().Queryable<TRKWareNoticeTab>()
.Where(w => w.PurchaseId == orderId && w.GoodsId == goodsId)
.OrderBy(o => o.PoLineId);
return sqlFuc.ToList();
}
catch (Exception ex)
{
_ = ex;
return default;
}
}
public bool UpdateStatusAndInsertInTask(string? status, List<TOnGoodsShelf>? goodsShelves, string? vehicleNo)
{
if (goodsShelves == null || goodsShelves.Count < 1) return false;
try
{
var sqlFuc = client.Instance().UseTran(() =>
{
foreach(var goodsShelf in goodsShelves)
{
client.Instance().Updateable<TRKWareNoticeTab>()
.SetColumns(s => s.PrintSts == status)
.SetColumns(s => s.PackageId == vehicleNo)
.SetColumns(s => s.ArrAmount == goodsShelf.ShelfNum)
.Where(w => w.PurchaseId == goodsShelf.ProviderId && w.GoodsId == goodsShelf.GoodsId && w.PoLineId == Convert.ToInt32(goodsShelf.PoLineId)).ExecuteCommand();
client.Instance().Insertable(goodsShelf).ExecuteCommand();
}
});
return sqlFuc.IsSuccess;
}
catch (Exception ex)
{
_ = ex;
return false;
}
}
}